PDF Xpress™ supports saving a PDF document to memory.
To save an open PDF document to memory:
- Create a new SaveOptions object.
- Configure the SaveOptions object.
- Invoke the SaveToBuffer method and specify SaveOptions to write the PDF file to a local byte array.
- Invoke the SaveToHandle method and specify SaveOptions to write the PDF file to a new Global Memory buffer.
PDF Xpress saves all documents in PDF version 1.6 if changes have been made to the document; if changes have not been made, then the version is unchanged. |
PDF Xpress does not directly support remote file communication protocols, such as HTTP and FTP, to load PDF files. |
C# Example | Copy Code |
---|---|
// This code demonstrates saving a PDF document to Local Memory PdfXpress pdfx = null; SaveOptions so =null; try { pdfx = new PdfXpress(); pdfx.Initialize(null, null); so = new SaveOptions(); pdfx.Documents.Add("C:\\test.pdf"); byte[] buffer = pdfx.Documents[0].SaveToBuffer(so); } catch (System.Exception ex) { } finally { if ( null != so) so.Dispose( ); if ( null != pdfx) pdfx.Dispose( ); } |
C# Example | Copy Code |
---|---|
// This code demonstrates saving a PDF to Global Memory PdfXpress pdfx = null; SaveOptions so = null; try { pdfx = new PdfXpress(); pdfx.Initialize(null, null); so = new SaveOptions(); pdfx.Documents.Add("C:\\test.pdf"); IntPtr globalHandle = pdfx.Documents[0].SaveToHandle(so); } catch (System.Exception ex) { } finally { GlobalFree(globalHandle); if ( null != pdfx ) pdfx.Dispose( ); } |