Back to Articles List

How do I reduce the time taken to add background images to every page of large documents?


How do I reduce the time taken to add background images to every page of large documents?

Please note that a user asked this question in the Tracker Software forum. They were creating a PDF file in excess of 300 pages. Each page contained a background image that covered the entire page, and they were using text structs to add string values. These factors meant that 300 calls to AddPage, AddImage, and DrawText were required, which meant the process took over two minutes. They wanted to know if there was a way to reduce the length of time required.


Yes, there are ways to reduce the time taken to add background images. It depends on the specifics of the case:

If the image is the same for all pages then it can be added one time and then placed into all pages. This will result in the decoding/encoding process taking place only once, instead of 300 times, and an image comparison will not be performed. (The pxclib40.dll compares each image added to documents and remove duplicates in order to save on file/disc space).

If the image is different for each page then reducing the size in pixels is an effective method to make conversion faster, although some quality will be lost. Additionally, vector images (or .emf/wmf) can be used instead of raster images in order to save on file size.

Please note that adding images to documents is the most time-consuming operation in document creation. This is because it is necessary for all images to be decoded and converted into a format that the PDF standard supports, especially in the case of raster images.

Was this article helpful?
Yes No Somewhat