Accusoft.PdfXpress5.Net
Save PDF to Memory
See Also Send Feedback
PDF Xpress 5 for .NET - User Guide > How To > Save PDF to Memory

Glossary Item Box

PDF Xpress™ supports saving a PDF document to memory.

To save an open PDF document to memory:

  1. Create a new SaveOptions object.
  2. Configure the SaveOptions object.
  3. Invoke the SaveToBuffer method and specify SaveOptions to write the PDF file to a local byte array.
  4. 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( );
}

See Also

©2012. Accusoft Corporation. All Rights Reserved.