Adobe PDF Forms - Text Field displays value only when clicked on it - pdf

I have a PDF with forms defined in it.
One field in the form is a multi line text field.
The value in the text field is populated by a java program using Apache PDFBox.
The issue is when the value is of around 5 to 6 lines, the text box displays the text automatically. But if it is more than 6 lines, the text box does not display the value. I had to specifically click on the text field to display the text. If I click outside the text box again, the text disappears.
The text field is read only with Multi Line and Scrolling options enabled.
Any ideas what is causing this weird issue?
I have Adobe Acrobat Pro 11, Adobe Acrobat XI and Adobe Reader to view the files. All have the same issue.

It sounds like a typical "appearance" problem. There's no form field appearance in the field widget dictionary so when you click in the field, the raw string data is shown but when you click out there is no appearance to display so you get a blank. You can test this out by toggling the multi-line setting in the field properties in Acrobat so it generates an appearance. If that fixes it, then you the problem is the one I describe.
You can use PDFBox to set the "needs appearances" flag in the file that will tell Adobe viewers to regenerate field appearances when the file is opened but that doesn't work for all PDF viewers. To make the field value visible in all PDF viewers, it's best to generate appearances when you populate the field values.
The Datalogics PDF Java Toolkit can automatically generate appearances based on field values. Full disclosure, I represent Datalogics.

Related

Text changed to graphics, still selectable in PDF?

I have this PDF ebook with selectable text - the handwriting - but there is no such font embedded and the letters are all different, so it's not actually a font. How is this possible?
I've worked with CorelDraw and Adobe Acrobat, but I can't understand how this works.
The left side of the picture shows the document properties, the right side shows a page of the PDF file and I selected the last 3 rows. I can copy and paste that to a text file, no problem. How was this achieved?
There are a few possibilities but the most likely is the text is being converted to outlines/paths or vectors. Some software such as Adobe InDesign and other print design apps allow you to 'flatten' a font based text into vector or paths, meaning the original font isn't required to be embedded or installed on the system. The original text data is however still present and able to be copied into a text field or word processor.

Fill PDF form field with Hebrew text (RTL)

I tried to use iText 7 community to check if it supports filling PDF form fields in Hebrew. For some reason, I can't make it work.
Here is the code I'm using:
PdfAcroForm form = PdfAcroForm.getAcroForm(pdfDoc, false);
form.setGenerateAppearance(true);
form.getField("test").setValue("\u05de\u05d9\u05db\u05d0\u05dc");
form.flattenFields();
pdfDoc.close();
The PDF is a blank PDF page including only one text field with the following properties:
Font Adobe Hebrew
Text direction RTL
I tried with and without flattening fields.
When fields are not flattened, after opening the resulting PDF using Acrobat Reader, I see my field but it is empty. Only after I click on the field, the content of the field appears correctly. When I view the PDF on Chrome, the field doesn't appear (or it may be there but no text inside).
When fields are flattened, after opening the resulting PDF using Acrobat Reader, the field doesn't appear at all.
I precise that I created the PDF using Acrobat DC.
Any idea what is going on here?
EDIT: The test PDF can be downloaded from here
Try creating a font (not all fonts support IDENTITY_H, but Arial does). On windows this will look like this:
PdfFont f = PdfFontFactory.createFont("C:\\windows\\fonts\\arial.ttf", PdfEncodings.IDENTITY_H, true);
And then set the font to field:
form.getField("test").setValue("\u05de\u05d9\u05db\u05d0\u05dc").setFont(f);
This worked for me

How to autogenerate field in Adobe Acrobate Pro and also form get auto flow on adding auto generate field to the form

I have made PDF form containing Radiobutton, Text Field, Button,CheckBox and Barcode in Adobe Acrobat Pro. and all is working well.
But according to new requirement I have to "Autogenerate" some of the fields like Radiobutton, Text Field and CheckBox on clicking to the "Add Field" Button, and on clicking the button the control should get auto generate to that PDF form.
Additional the text which is already added to the PDF form get flow down whenever the fields get auto generate on the top of the form.
According to my findings I found that it is possible through Adobe liveCycle but I want it to happen in Adobe Acrobat Pro
Also I have tried adding the blank new PDF page so that according to requirement I autogenerate my field on that blank PDF but not able to add new PDF page through Javascript?
Thanks you in advance.
It is possible; you would need to use form fields for everything which can move when you add new fields (been there, done that).
Then you will need a pagination logic which places or moves the fields to their correct position.

iText - PDF file displaying message at the top about fillable form

Here is what I did:
1. I have a template WORD file that can be used to fill an application for some stuff. Assigned pre-defined tags to fillable fields.
2. Converted that word file to PDF file using CenoPdf
3. Used iText to fill the fields in generated PDF file.
4. Now when user downloads that filled file, they see a nice purple at the bar saying "Please fill out the following form. You can not save data typed into this form. Please print your completed form if you would like to copy for your records".
how can i get rid of this purple bar and the message? I am assuming i need to set some bits through iText to turn this off??
Thanks
You can't edit the purple bar at the top. This is a flaw with Acrobat. Whenever your PDF contains form fields, the message is automatically displayed by force and you cannot edit it. Adobe feels that it's users are more important than it's developers, and forces the bar and message whenever form fields are present.

Modify character spacing in a PDF form field

I'm trying to build a web app to programmatically fill out a PDF form. I am going to configure my form first in Adobe Acrobat, then write a Java app with iText to fill out all the form fields via user input from the web. The base form I need to fill out comes from the US government. They created form fields with extremely large kerning (character spacing) values I need to change. However, there appears to be no way to modify this value in the Acrobat UI.
Does anyone know how to manipulate character spacing on form fields in Acrobat 8.0 for Windows? I could try to use iText to programmatically manipulate the kerning of the original document, but this would be much more tedious.
I believe I figured this out: kerning is called "combing" in acrobat, and each of the form fields have been "combed". The strange thing is this option isn't checked when I view the properties of the form field, but "combing" is the behaviour I was attempting to replicate.