| PDF Xpress for .NET - User Guide > How To > Save PDF to Memory |
PDF Xpress™ supports saving a PDF document to memory.
To save an open PDF document to memory:
![]() |
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();
}
}
|
|