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

MergeBatchMem Method

Merges an array of in-memory PDF files without using the file system.

Function MergeBatchMem(InputStreamArray As Variant) As Variant

byte[] MergeBatchMem(byte[][] InputStreamArray)

byte[] MergeBatchMem(byte[][] InputStreamArray) throws PDFProcessorException


Return Values

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


Do not pass an array of byte arrays (i.e., byte[][]) to MergeBatchMem, as doing so will fail in the .NET-COM interop layer. You must pass an object array (i.e., object[]), where each individual element is a byte array (i.e., byte[]) casted to an object, as shown in the sample code below.

Example Usage in VB.NET

 Dim oProcessor As PDFProcessor = New PDFProcessor
 Dim inMem1() As Byte = File.ReadAllBytes("C:\test\input1.pdf")
 Dim inMem2() As Byte = File.ReadAllBytes("C:\test\input2.pdf")
 Dim inMem3() As Byte = File.ReadAllBytes("C:\test\input3.pdf")
 Dim inMemArr As Object() = {inMem1, inMem2, inMem3}
    Dim outMem() As Byte = oProcessor.MergeBatchMem(inMemArr)
 File.WriteAllBytes("C:\test\output.pdf", outMem)

Example Usage in C#

PDFProcessor oProcessor = new PDFProcessor();
byte[] inMem1 = File.ReadAllBytes(@"C:\test\input1.pdf");
byte[] inMem2 = File.ReadAllBytes(@"C:\test\input2.pdf");
byte[] inMem3 = File.ReadAllBytes(@"C:\test\input3.pdf");
object[] inMemArr = new object[3] {inMem1, inMem2, inMem3};
   byte[] outMem = (byte[])oProcessor.MergeBatchMem(inMemArr);
File.WriteAllBytes(@"C:\test\output.pdf", outMem);