easyPDF SDK Usermanual
PDF Creator Programming API  |  Download Free Trial  |  Contact Us to Purchase

ExtractPagesMem Method

Extracts one or more pages from an in-memory PDF file without using the file system.

byte[] ExtractPagesMem(byte[] InputStream, int From, int To)

Function ExtractPagesMem(InputStream As Byte(), _
                         From As Integer, _
                         To As Integer) As Byte()

def ExtractPagesMem(self, InputStream, From, To)

byte[] ExtractPagesMem(byte[] InputStream,
                       int From,
                       int To) throws PDFProcessorException

function ExtractPagesMem($InputStream, $From, $To) 

BclPrcResult ExtractPagesMem(const BclPDFProcessorSettings* pSettings,
                             const unsigned char* InputStream,
                             unsigned InputStreamSize,
                             int From,
                             int To,
                             unsigned char** poutOutputStream,
                             unsigned* poutOutputStreamSize);
Function ExtractPagesMem(InputStream As Variant, _
                         From As Long, _
                         To As Long) As Variant


Return Values

The extracted PDF as a byte array in (VT_ARRAY | VT_UI1) format.


The page number uses zero-based index, meaning that page number starts from 0.

Example Usage in VB.NET

Dim oProcessor As PDFProcessor = New PDFProcessor

Dim inMem() As Byte = File.ReadAllBytes("C:\test\input.pdf")
Dim outMem() As Byte = oProcessor.ExtractPagesMem(inMem, 0, 4)
File.WriteAllBytes("C:\test\output.pdf", outMem)

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();

byte[] inMem = File.ReadAllBytes(@"c:\test\input.pdf");
byte[] outMem = (byte[])oProcessor.ExtractPagesMem(inMem, 0, 4);
File.WriteAllBytes(@"c:\test\output.pdf", outMem);