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
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.
Dim oProcessor As PDFProcessor = New PDFProcessor
Dim inMem() As Byte = File.ReadAllBytes("C:\input.pdf")
Dim outMem() As Byte = oProcessor.ExtractPagesMem(inMem, 0, 4)
File.WriteAllBytes("C:\output.pdf", outMem)
PDFProcessor oProcessor = new PDFProcessor();
byte[] inMem = File.ReadAllBytes(@"c:\input.pdf");
byte[] outMem = (byte[])oProcessor.ExtractPagesMem(inMem, 0, 4);
File.WriteAllBytes(@"c:\output.pdf", outMem);