Skip to Content

Can I determine the size of a PDF document before writing it?

Estimated Reading Time: 1 Minutes

Adobe PDF Library cannot provide a way to estimate the final size of an output PDF document before an application actually writes that PDF document to a disk. Also, any document using subset fonts would require some undetermined amount of extra storage in the output file for those fonts, and the subsets cannot be created until the document is created.

If you really want to have an idea of how large a PDF output document will be before you generate it, you can have your application write the file to memory first, rather than to a disk, and then read the size of the memory buffer to estimate the final file size. For example, you could call the dlpdfdocwritepdf() method into a memory file. But this is not a very practical approach, as it requires a lot of memory to complete and may compromise your system performance.

Can I determine the size of a PDF document before writing it?
  • COMMENT