Use PDFNet saving APIs from
PDFDoc class to save PDF documents on local storage.
To save a PDF document to path use:
For example, to save for optimized file streaming, use:
There are a few ways to save a PDF document on permanent storage such as save with remove unused objects, save incrementally, save in linearized format, etc.
This mode saves disk storage space by rearranging the PDF document and removing unused objects. As a result, the output file can be significantly smaller. However, the saving process itself may take longer compared to incremental mode.
Use the incremental mode if you are particularly concerned about the time it takes to save the file. If you use this mode, any changes to the document, even the deletion of annotations, will be appended to the end of the PDF file. Note that it is not possible to incrementally save the document if the underlying file has an XRef table that had to be repaired when the file was opened (see http://www.pdftron.com/kbcorruptxref).
This mode is to be preferentially used in file streaming situations, such as when you want to upload a PDF document. It will rearrange the PDF document and remove unused objects. However, the saving process itself may take longer compared to other modes.