Changes to Memory Handling in Toolkit R2 and Later

This topic provides details regarding important changes to the way Toolkit 2011 R2 and later handle memory.


Probable Cause

Review both methods of handling memory, New and Alternative (Old), and determine which method is appropriate for your needs.


NOTE: Failure to use one of these methods when using CopyForm can conclude in an unpredictable result in the output PDF.


Due to an update implemented in Toolkit 2011 R2 to allow faster opening of files and to bypass reading fonts, calls that previously emulated a call to OpenInputFile (e.g. NumPages, GetBoundingBox, etc), should no longer be used in this capacity.


The affected calls are: GetBoundingBox, GetPDFInfo, and NumPages.


Resolution


New Method of Memory Handling

Calling one of these functions now results in the currently open input file to be closed. Therefore, if you wish to use these calls and have a valid open input file, you must do the following in order:

  1. Call OpenInputFile.
  2. Call the appropriate function, passing a blank file name.


Example:

R = TK.OpenInputFile(“myfile.pdf”)

R = TK.NumPages(“”)