Can I load and save compressed PDF to a stream?

Q: Please advise whether PDFTron PDFNet supports the following
features:

  • 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://
www.pdftron.com/pdfnet/html/classpdftron_1_1PDF_1_1Image.html#c98b19bbffd54c4870a9df1e47697568).

PDFNet can also be used to optimize existing PDF documents (as shown
in JBIG2 sample or in http://pdfnet-sdk.googlegroups.com/web/FlateCompressTest.zip.doc,
etc).

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.