PDF with fillable form fields + "Save As" = PDF with fixed text - how? - pdf

I'm creating a PDF using iTextSharp and it contains some fillable form fields. What I need, is to somehow set it up so that when those form fields are filled in and the resulting PDF is saved (in one of the commercially-available PDF readers like Adobe's Reader), I need those form fields to be fixed text (no longer editable).
Is there any way to do this?

As a comment suggests, this sounds like "flattening the document".
The issue with that process is that it is not available in (Adobe) Reader; it would require Acrobat, or server-side help.
On the other hand, some mobile PDF viewers do actually offer flattening when saving.
The workaround for Reader is to set the fields to read-only when saving the document. You would do this in the willSave Document Action by looping through the fields and setting them to readonly.

Simply Print your document as PDF. This will flatten the file.
For this
1. Install Adobe PDF Printer or CutePDF or some similar tool.
2. From your document. Select File -> Print.
3. Select Printer as the tool you installed in Step 1.
4. Your document will be a flattened, non-editable PDF now.

Related

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

Visually show field names in a fillable PDF

I have a fillable PDF. I would like to know the names of the fields in it. I know I can find this out using pdftk and the dump_data_fields flag. However, it is a painful process to match the fieldname to the actual field in the PDF.
Is there a tool out there that shows the real PDF and the fieldnames over it?
When Adobe Acrobat Pro is put into Form Authoring mode, it will show the form fields with their name overlayed.

Print to pdf that is searchable and selectable from existing pdf that is selectable and searchable

I am trying to print a section of an existing pdf to a new pdf. The original is searchable and selectable but the new pdf cannot do either. I am using "adobe acrobat reader DC" and print via "Microsoft Print to PDF". Unsure if there is any other relevant information.
After searching for a period of time I could not find an answer that allows for direct PDF to PDF print.
I did find a workaround however.
I downloaded a free software called PrimoPDF. Once installed, PrimoPDF becomes a printer option within Adobe acrobat reader. I then selected my desired pages and printed to PrimoPDf instead of Microsoft Print to PDF. This Generated a .ps file. I then imported the .ps file into PrimoPDF application and was able to generate a .pdf from that. The newly generated pdf was searchable and selectable and exactly what I needed.
Hopefully someone else finds this useful in the future.
Generally refrying (printing to PostScript then converting back to PDF) is a bad idea. The reason that Microsoft Print to PDF created a file that wasn't searchable is because when Adobe Reader detects that the printer it is targeting isn't capable of rendering the PDF correctly because of any number of reasons, like it doesn't have the right fonts for example, it will render the PDF itself and send an image to the printer. A simpler PDF probably would have worked just fine.
You are much better off getting a tool that will simply allow you to extract the pages you need to a new file rather than printing.

How to read the value of fields in signed PDF using PDF Box API

Once after completion of digital signature for PDF using DocuSign, How to read value of the fields in PDF using field ID/Name (using PDF Box API)? I am not able get the field ids of Digitally Signed PDF.
The sample PDF showed that the fields in PDF are not PDF form fields after all, neither Acrofornm nor XFA, they merely are texts with some lines around them. (They may once have been PDF form fields which were flattened, or they may never have been PDF form fields to start with.)
Thus, your only option left is text extraction. PDFBox has a quite elaborate text extraction engine. Have a look at PDFTextStripper. You can try and use this class as is, looking in the extracted string for the field labels and extract the following text until the end-of-line; or if you have the time, you can try to make use of the internal PDF structure where the field contents are in a separate Xobject.

Exporting embedded Adobe PDF Reader text

I have an embedded Adobe PDF Reader in my Windows application. When I open a certain PDF file I need to do is manually select a text in that PDF and transfer it over to a textbox. I haven't done much work with PDF embedded components. But I can see two potential solutions. Either to find where in embedded component selected text can be grabbed from or use a Clipboard to cut selected text and transfer it over to a textbox.
Can anyone help me with this? So to put it plainly I want to know how the best way to access text (selected or not) in embedded PDF Reader Component.