Help coderanch get a
new server
by contributing to the fundraiser

boofoni Brown

Greenhorn
+ Follow
since May 08, 2018
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
-2
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by boofoni Brown

Hello Helper !!,

Im using ITEXT5, and I'm trying to fit a string (so that I can see the whole string) into a existing PDF field using setField
AcroFields fields = stamper.getAcroFields();
fields.setField(MyField,String)

String = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX" = 35 characters
PDF field Name  myField  = Displays only 26 characters

Is there a simple way to auto fit (I would assume changing the fontsize of string), so that I can see the whole string on the PDF. i.e making the string fit the 26 chars being displayed?

If you could provide the code (step-by-step) to make this work using the variables I gave, and then point me to the documentation. That would be great!!

Thanks in advance
               



6 years ago
Hello all,

I'm trying to change the field name of a PDF file. The field look like:

                 original                                              want to change to
       Discount (0.25 = 25%)                                         Tax      ( if " (0.25 = 25%)" remains that's ok)

The code I'm using in eclipse is:


The new PDF file is created and tne System.out.println dtstement shows  "Tax" (among the other field names) in the console display but not in the new PDF file. It still displays  Discount (0.25 = 25%). Does the (0.25 = 25%) in the original PDF have anything to do with my problem? If so how do I resolve this. I did run the code without renaming the field name and "Discount" is listed as the field name.

Side note: If you can please look at my https://coderanch.com/t/693892/java/Changing-form-field-text-size#3257236 question
6 years ago
Prasad Saya thanks anyways... I'm using itext5. I see in the examples how to set the field (which I'm already doing), setting the color, etc. The answer was like asking Jeff gordan how to best pass the car in front of you, and he responds well you are a beginning driver and gives you copies of all of his races on tape and keys to a car or helping someone learn to fish from your garage by giving a person a fishing pole a tackle box then wonder why he didnt catch any fish. Example I helped sidmeone make a disk, I pulled up the youtube video, showed them how to pause the vid and we selp by step went through the vid until the dish was completed.
I hope that you are not at work and ask the subject matter expert a question and he/she hands you their text book.
I'm nicely trying to say, if you dont want to help a beginner, then don't respond to a post for help

Have a great day
6 years ago
Good Evening

I'm using the following code:

PdfReader reader = new PdfReader(inname);
AcroFields fields = stamper.getAcroFields();
// AcroFields fields = reader.getAcroFields();
   setthecharsize();
  Set<String> fldNames = fields.getFields().keySet();

       // insert here, possible call to methd here passing field name (or new value containing) the company name, and the size of the characters)
       fields.setField("Your Company Name:", "Capitol Heights Property Maintenance"); // Form field length 19
       
        // insert here, possible call to methd here passing field name (or new value containing) the company name, and the size of the characters)
       fields.setField("Your Company Name", "Capitol Heights Property Maintenance"); // form field length < 33

for (String fldName : fldNames) {
 System.out.println( fldName + ": " + fields.getField( fldName ) );}
stamper.close();
    } catch (IOException e) {
e.printStackTrace();


Im wanting to create a method that I can pass in a "form field name" and character size value to a method and change the character size. The 2 form fields
I want to change are named  "Your Company Name" and "your Name" and set them to a smaller size
Using the above code the PDF file produces

field named "Your Company Name">> Capitol Heights Property M
field named "Your Name" >>> ""

I would like to create  a method that I can pass any field name and change the size of the out characters. I have been googleing and getting how the change the fiels size, how to change a jbox size, etc... The closest this I found was textField.setFont command. I was hoping I  could simply change the size of the text the return and fill the form value with smaller/littler characters with the fields.setField("Your Company Name:" code

Thanks in advance for your help!! }
6 years ago