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.

Function ExtractPagesMem(InputStream As Variant,
                         From As Long,
                         To As Long) As Variant

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

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


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);