How to increase performance for programs using Foxit Quick PDF Library
The performance of PDF generation depends on both the volume of data being processed (i.e., source input) and the specific code used.
Using Foxit Quick PDF Library, PDF generation is done entirely in memory. This means that, when working with longer files, performance can often be increased by breaking up the generation process. This involves saving parts of the PDF to disk by, for example, processing one page at a time using the NewDocument and RemoveDocument functions. This reduces the load on system resources and can significantly improve performance. The separate pages can then be merged to form a single file in a separate step.
If you are looking to process content that is complex rather than, or as well as, being long, the answer is similar in principle. One type of content that can be extremely complex is Vector graphics. With vector graphics, producing a single image can involve many separate drawing instructions.
While each instruction may be simple, these are then combined into long strings for processing, which takes a large amount of memory. When looking to optimize generation performance with this type of content, it can be helpful to group the individual instructions into smaller chunks by periodically using the NewContentStream function. This effectively executes the drawing instructions, removing them from memory before moving onto the next set.
This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.
Updated on May 16, 2022