Frequently Asked Toolkit Conversion Questions (FAQs)


Here are some short topics that answer conversion issues customers have had in the past.



  1. When using the StitchPDF method to stitch a PDF with populated fields, the data in the fields is missing in the output file.

  2. After encrypting a file using EncryptPDF set to AES 256 bit, the file does not open in Adobe Reader 8 and 9.

  3. After calling AddField, and then calling SetFormFieldData and setting its -997 flag to flatten the field, the field is not flattened.

  4. When using the OpenInputFile and CopyForm calls on PDFs with linked rather than embedded fonts, the process may use over 1GB of memory, because Windows font files are large.

  5. After setting PrintMultiline Text to the Full justified (3) alignment parameter, the output text is left justified.

  6. Toolkit ignores encryption on a PDF if a password was not set.

  7. After setting the font to Arial, Japanese characters do not display in form fields as expected.

  8. Field calculations do not seem to work after using SetFormFieldData.

  9. After using Barcode BorderStyle, the setting is ignored.

  10. Characters within form fields display differently when the form field is no longer in focus.

  11. Toolkit outputs a bad PDF when encoding is explicitly set for a font loaded from disk.

  12. After calling:SetOutputRotation(90) the output pages were not rotated.

  13. When the DisableForntCache was enabled, the resulting PDF file had garbled characters.

  14. Using the DefaultWidth option of SetFont has no effect on an output stamp.


  15. When merging two PDF documents, the text fields disappear.

  16. Although I specified the "Arial" font with the FieldInfo property FontName, "ArialMT" is used instead.

  17. When attempting to read an output PDF created from an Excel file, I get this error: "There was a problem reading this document."

  18. When using the StitchPDF method to stitch a PDF with populated fields, the data in the fields is missing in the output file.


The stitching process does not transfer form fields.


When stitching a PDF with populated fields, flatten the form fields by setting Flag -998 when using SetFormFieldData, and call FlattenRemainingFormFields before calling StitchPDF.
Note: After stitching, any form fields that are not flattened are removed and do not display in the output PDF.



  1. After encrypting a file using EncryptPDF set to AES 256 bit, the file does not open in Adobe Reader 8 and 9.


Acrobat Reader versions 8 and 9 do not support AES 256-bit encryption. Use Acrobat Reader 10, 11, or higher to open the file. Or choose a lower encryption level.



  1. After calling AddField, and then calling SetFormFieldData and setting its -997 flag to flatten the field, the field is not flattened.


After calling AddField, close and reopen the PDF, then call SetFormFieldData and set the -997 flag to flatten the field.



  1. When using the OpenInputFile and CopyForm calls on PDFs with linked rather than embedded fonts, the process may use over 1GB of memory, because Windows font files are large.


Before calling CopyForm, call the DisableFontCache property and set it to true.



  1. After setting PrintMultiline Text to the Full justified (3) alignment parameter, the output text is left justified.


At this time, justification only works with fonts using these encodings:



  • WinAnsiEncoding

  • PDFDocEncoding

  • MacRomanEncoding


If you are using multi-byte fonts or fonts that do not use any of the listed encodings, you can add an encoding parameter:


Example:


aPDF.PrintMultilineText "Calibri|encoding=WinAnsiEncoding",
16, 300, 600, 100, 500, stringText, 3, 0


Note: At this time, only proportional fonts can be set to full justified. Non-proportional (monospaced; fixed-width) fonts should be left or right justified.
(Monospaced type is often used so characters line up evenly. Full-justification adds white space between characters, which prevents an even lineup.)



  1. Toolkit ignores encryption on a PDF if a password was not set.


Provide an password when encrypting a file.


When using the SetInputPasswords or a DecryptFile encryption method, if no passwords are set on the input file, Toolkit assumes a BLANK password.



  1. After setting the font to Arial, Japanese characters do not display in form fields as expected.


When you set up a form using AddField, choose Arial Unicode MS for the FontName.


Note: There are several font families that have "Arial" in their name. Arial Unicode MS has built-in support for Japanese characters, Arial does not.



  1. Field calculations do not seem to work after using SetFormFieldData.


Acrobat Reader does not automatically run field-level JavaScript calculations when the PDF is opened.


When you select in Preferences (under Preferences->Form) : Automatically Calculate Field Values, calculations are performed when the user enters them, not when the PDF opens.


To perform calculations when the PDF opens, you can add document- level JavaScript:



  1. In Acrobat X, select "View->Tools->JavaScript" and select "Document JavaScript"

  2. Enter a name for the script (for instance, Init)

  3. Click on Add...

  4. Delete everything in the window (the function Init() {...})

  5. Enter:
    calculateNow();

  6. Click OK.

  7. Save the PDF.


The form now auto calculates when the PDF is opened.



  1. After using Barcode BorderStyle, the setting is ignored.


The Barcode BorderStyle is deprecated, and is no longer in use.


There is no equivalent property at this time.



  1. Characters within form fields display differently when the form field is no longer in focus.


When form fields will be used for future editing and a TrueType font is used, the encoding needs to be explicitly set to one that contains the desired character set.


Example of FontName syntax with an encoding parameter included:


FIO.FontName "Helvetica|encoding=WinAnsiEncoding", 12


Note: If no encoding is set, Toolkit uses the default Identity-H encoding, which may result in resulting in missing or replaced characters when editing the form.



  1. Toolkit outputs a bad PDF when encoding is explicitly set for a font loaded from disk.


Toolkit only supports setting the font with the built in encodings (e.g. Adobe-GB1-UCS2) using the built-in fonts, unless the font is already specified in the file.


Toolkit WILL support the built-in encoding for a font loaded from disk IF the font is already specified in the file (even if it is not embedded).



  1. After calling:SetOutputRotation(90) the output pages were not rotated.


In many cases with this issue, the input file was already rotated at 90 degrees, so calling: SetOutputRotation(90) has no effect on the output file, since it is already set at 90 degrees.


To rotate the PDF a further 90 degrees, call: SetOutputRotation(180)


Certain PDF producers (including print drivers and scanners) use PDF page rotation to set the page orientation (e.g. portrait versus landscape) and then orient the text accordingly. A PDF that visually appears to be portrait (with text that flows horizontally across a page taller than it is wide) may have an internal page rotation of 90 degrees.


Toolkit provides a GetInputPageRotation call which, combined with Toolkit's Bounding Box calls, can be used to predetermine a page's current orientation and then adjust accordingly.


For an example of using these calls, see: Auto Rotate Text example



  1. When the DisableForntCache was enabled, the resulting PDF file had garbled characters.


When stitching, Toolkit uses the font cache.


Before using StichPDF, do not disable the font cache. Make sure DisableFontCache is turned off.



  1. Using the DefaultWidth option of SetFont has no effect on an output stamp.


DefaultWidth has no effect on standard single-byte, proportional-width font. The DefaultWidth option is included for use with the double-byte encoding that many fixed-width Chinese, Japanese and Korean fonts use. If the double-byte font is missing the width metric, DefaultWidth can be used to substitute the metric.



  1. When merging two PDF documents, the text fields disappear.


To preserve the form fields when using MergeFile, call ReadOnlyOnMerge after calling OpenOutputFile. Otherwise, use CopyForm.



  1. Although I specified the "Arial" font with the FieldInfo property FontName, "ArialMT" is used instead.


Following PDF specifications, Toolkit determines the PostScript name for the value of BaseFont in one of two ways:



  • If the TrueType font program's name table contains a PostScript name, it shall be used.

  • In the absence of such an entry in the name table, a PostScript name shall be derived from the name by which the font is known in the host operating system. On a Windows system, the name shall be based on the lfFaceName field in a LOGFONT structure; in the Mac OS, it shall be based on the name of the FOND resource. If the name contains any SPACEs, the SPACEs shall be removed.


As a result, when Toolkit loads Arial from the disk, the Postscript name Arial MT is selected. You can override this behavior if you add the FontFaceName argument (separated with a bar symbol) when setting the font:
"Arial|fontfacename=Arial"
In this case, the Arial font will be selected instead of Arial MT.



  1. When attempting to read an output PDF created from an Excel file, I get this error: "There was a problem reading this document."


Try calling the StripStructure property in the Toolkit object.



  • StripStructure removes the StructTreeRoot entry in the internal PDF catalog. This structure contains information about links between different parts of PDF file. For example, a PDF created from an Excel file contains information about each cell and the links between them. This information adds significantly to the size of a PDF file, and can create errors.

  • Removing StructTreeRoot entry does not impact the display or the reading of the output file in a PDF reader.