Can I load and save compressed PDF to a stream?

Q: Please advise whether PDFTron PDFNet supports the following

  • Load PDF From Stream
  • Imbed Images Into PDF
  • Save PDF To Stream
  • Compress PDF

A: For an example of how to load/write PDF to and from a memory buffer
please take a look at PDFDocMemory sample:

For an example of how to add an image to PDF please see AddImage
sample project:

Regarding the compression PDFNet automatically compresses all image
and content streams so it is usually not necessary to do anything
special. In some cases you may want to control the image compression
mathod with different compression paramaters using the optional
‘encoder hints’ paramater in ‘pdftron.PDF.Image.Create’ (http://

PDFNet can also be used to optimize existing PDF documents (as shown
in JBIG2 sample or in,

The next PDFNet update will contain a utility class called
‘pdftron.PDF.Optimizer’ that can be used to shrink and optimize
existing PDF files. The optimizer will include options such as image
resampling, recompression, duplicate object removal etc.