Insert page for exist pdf file

Hi,

I am using pdf.form to create my barcode lable(please see attachment, the label is ) from my online form. user are now able to choose the number of label they would like to print and the location they would like to start by:

Dim Label As Form = New Form(“C:\Inetpub\wwwroot\BarCodePrint.pdf”, “c:\inetpub\wwwroot\BarCodeOutput” & TicketNumber.Text & “.pdf”)

Do

page = page + 1

pageLbl = page & " of " & LabelNo.Text

i = i + 1

Label.FillField(“ShipDate” & i, ShipDate.Text)

Label.FillField(“Shipper” & i, Shipper.Text)

Label.FillField(“ShipperAdd” & i, ShipperAdd.Text)

Label.FillField(“ShipperCity” & i, ShipperCity.Text)

Label.FillField(“ShipperProv” & i, ShipperProv.Text)

Label.FillField(“ShipperPostal” & i, ShipperPostal.Text)

Label.FillField(“Consignee” & i, Consignee.Text)

Label.FillField(“ConCity” & i, ConCity.Text)

Label.FillField(“ConAddr” & i, ConAddr.Text)

Label.FillField(“ConProv” & i, ConProv.Text)

Label.FillField(“ConPhone” & i, ConPhone.Text)

Label.FillField(“TotalW” & i, TotalW.Text)

Label.FillField(“TotalP” & i, TotalP.Text)

Label.FillField(“ProNumber” & i, ProNumber.Text)

Label.FillField(“ChkNo” & i, ChkNo.Text)

Label.FillField(“PickUpDate” & i, “Pick Up Date:”)

Label.FillField(“Pieces” & i, "Pieces: ")

Label.FillField(“Weight” & i, "Weight: ")

Label.FillField(“To” & i, "TO: ")

Label.FillField(“Phone” & i, "Phone: ")

Label.FillField(“Page” & i, pageLbl)

Label.FillField(“Vitran” & i, “Vitran Express Canada”)

Label.FillField(“Web” & i, “[www.vitran.com](http://www.vitran.com/)”)

Label.FillField(“Tel” & i, “800-263-0791”)

Label.FillImageField(“BarCode” & i, memStream)

Label.FillImageField(“logo” & i, “c:\inetpub\wwwroot\vitran_logo.gif”)

'if Label number is more than one page, print on 2nd page

Loop While i <= ilblEnd

Label.FlattenAllFields()

Label.Save()

However, I have problem if the user would like to print more than 1 page. on my pdf file, all my fields are defined from 1-6, such as shipper1 - 6, ShipperAdd 1 - 6… (according to the lable template). if the user want more than 6 label. I will need to generate 2nd, 3rd…page from the original template. which pdf.form cannot do it unless I duplicate same page. Any suggestion?

Dear jyuen,

Thanks for considering Aspose.Pdf.Kit.
1) You could create a template with a form in more than one page. It means that many fields can be located in many pages, not just one page.
2) If you want to repeat the form with its content, you could merge many pdf into one with the help of "Concatenate functionality" as given in: Merge PDF files

Best regards.

Dear Ken, I understand what you mean, that’s what I m trying to do now. I create a 3 page template with 18 labels (please see attached pdf file). however when user request <12 labels, the 3rd page will be blank. Also if I do this, it will restrict user to print max 18 labels in my case. Hope you understand what I mean. thx

Dear jyuen,

You can extract the first two pages as a new file, the empty page doesn’t exist in the new file, the reference of the function is here.

One thing you should concern is the orignal file doesn’t contain any unflattened fields, because the unflattened fields will be lost by calling the function.

Best regards.