Free Support Forum - aspose.com

SplitTobulks

Hi there

This is the example vb code from the help file for the SplitToBulks method:

Dim inFile1 As String = "example1.pdf"
Dim pdfEditor As PdfFileEditor = New PdfFileEditor()
Dim fileNum As Integer = 1
Dim numberofpage(6,2) As Integer
numberofpage(0,0)=10
numberofpage(0,1)=20
numberofpage(1,0)=15
numberofpage(1,1)=25
numberofpage(2,0)=30
numberofpage(2,1)=40
numberofpage(3,0)=35
numberofpage(3,1)=45
numberofpage(4,0)=50
numberofpage(4,1)=60
Dim outBuffer() As MemoryStream = pdfEditor.SplitToBulks(inFile1,numberofpage)
Dim aStream As MemoryStream
For Each aStream In outBuffer
Dim outStream As FileStream = New FileStream("oneByone" + fileNum.ToString() + ".pdf",FileMode.Create)
aStream.WriteTo(outStream)
outStream.Close()
fileNum = fileNum + 1
Next

It doesn't compile so have you got an example of something that will ?

Thanks

Hi,

Sorry for the inconvenience. Please use the following code:

Dim inFile1 As String = "example1.pdf"

Dim pdfEditor As PdfFileEditor = New PdfFileEditor()

Dim fileNum As Integer = 1

Dim numberofpage()() As Integer = {New Integer() {10, 20}, New Integer() {15, 25}, New Integer() {30, 40}, New Integer() {35, 45}, New Integer() {50, 60}}

Dim outBuffer() As MemoryStream = pdfEditor.SplitToBulks(inFile1, numberofpage)

Dim aStream As MemoryStream

For Each aStream In outBuffer

Dim outStream As FileStream = New FileStream("oneByone" + fileNum.ToString() + ".pdf", FileMode.Create)

aStream.WriteTo(outStream)

outStream.Close()

fileNum = fileNum + 1

Next

Thanks.