Insert font into PDF form
I have a PDF form created by LibreOffice. Because of a known bug in LibreOffice, only a subset of fonts are embedded in the PDF, even when the font is used in form fields. Therefore, the form is not used or the form fields use the wrong leading edge (depending on the PDF viewer) if the font is not installed on the computer.
So I need to replace a subset of the PDF form with the whole font after generation in LibreOffice. Usually using ps2pdf
or is gs
recommended to fix the font issue in pdf. But both programs do not support PDF form. If used in a PDF form, the form fields will be split. I tested it with Ghostscript 9.10 under Unbunt 14.04 LTS.
I can use pdffonts
to display fonts embedded in PDF. But is there also a command line tool to insert a different font into a PDF?
source to share
Libreoffice v5.2 embedding fonts for form fields is easy:
Include the font in the form field: () Right click on the form field> Control> Font
Then tell your document to include the fonts in use in its file: () File> Properties> Font tab> Embed Fonts in Document In my case, the file size increases from 50K to 5000K (Using one font with two styles).
Finally, check the PDF options to include fonts in the pdf: () File> Export to Pdf> General Tab: x Enable Create PDF Form (so that the form fields are filled in for the user). Do not select whether both of the following options are needed: x Tagged PDF and x Hybrid PDF: The pdf format will be enlarged later to the size of the LibreOffice file.
source to share
There are a number of commercial solutions that can completely embed the font in the PDF if a commercial application is a viable option for you (they would be expensive to โjustโ do it, probably). The two main contenders are probably callas pdfToolbox (beware: I'm related to this product) and Enfocus Pitstop.
source to share
Until the error is resolved, you can use the PDF Toolbelt to fix your forms.
After loading the JAR file, the font of all fields can be reset to the default values โโfor Adobe Acrobat:
java -jar ./pdf-toolbelt.jar form-font-defaults input.pdf output.pdf
Disclaimer: I am the author of the above tool.
source to share