Accusoft.PdfXpress7.Net
Save PDF to Memory

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 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)
            {
            }
            finally
            {
                if (null != pdfx)
                {
                    pdfx.Dispose();
                }
            }
C# Example
Copy Code
            // This code demonstrates saving a PDF to Global Memory
            PdfXpress pdfx = null;
            SaveOptions so = null;
            IntPtr globalHandle = IntPtr.Zero;
            try
            {
                pdfx = new PdfXpress();
                pdfx.Initialize(null, null);
                so = new SaveOptions();
                pdfx.Documents.Add("C:\\test.pdf");
                globalHandle = pdfx.Documents[0].SaveToHandle(so);
            }
            catch (System.Exception)
            {
            }
            finally
            {
                GlobalFree(globalHandle);
                if (null != pdfx)
                {
                    pdfx.Dispose();
                }
            }
See Also

 

 


©2018. Accusoft Corporation. All Rights Reserved.

Send Feedback