How do I save my PDF to PDF 1.4 (no compressed objects and xrefs) with PDFNet SDK?


One of our customers complained that when a version 1.4 pdf is opened and saved using PDFDoc.Save() function, the new pdf version changes to 1.5 that uses compressed objects and xrefs. I guess their current system does not support these PDF features. Is there a way to force saving into a desired pdf version?


Yes, you can use

SDFDoc.SaveOptions.e_compatibility flag as an option to the PDFDoc.Save method to save as PDF 1.4. For example:

using (PDFDoc doc = new PDFDoc()) {
// process PDFDoc
// save PDFDoc to a file
doc.Save(@“C:\MyFile.pdf”, SDF.SDFDoc.SaveOptions.e_compatibility);

Is there a way to specify a specific version?

Currently it seems that when I save a document with the Java version of PDFNet library v6.1.2 it will always save to v1.5. I have users editing documents in Adobe Standard 8 (or 9, 10) to digitally sign. Adobe seems to save to v1.6 and then again after they are saved with PDFNet library they revert back to v1.5 and also looks like signatures are messed up at this point.

PDFNet library seems to significantly change the PDF as well when just a single form field is changed. Is it advisable to use e_incremental or e_compatibility on the save function call?

You can specify a PDF version by calling SDFDoc.Save instead of PDFDoc.Save. See for more details.

The e_compatibility flag saves the document in a manner that maximizes compatibility with older PDF consumers (e.g. the file will not use compressed object and xref streams).

The e_incremental flag will save the document in “incremental mode”, which should be faster. See for more details.