Append pages
Copy the cover page to a new PDF document and append 1-n detail pages. The cover page is added successfully, as is the first detail page but all subsequent detail pages do not display correctly in Acrobat. I believe this is because on each detail page the field names have the original names and so the pdf contains multiple fields with the same name. The result can be seen in the attachment FinalPDF(AppendPage)
- Code: Select all
My.Computer.FileSystem.CopyFile(
"E:\Development\PDF Booking Forms\Booking Form (Cover).pdf",
"E:\Development\PDF Booking Forms\FinalPDF.pdf", overwrite:=True)
Dim doc1 As PdfDocument = New Spire.Pdf.PdfDocument("E:\Development\PDF Booking Forms\Booking Form (Detail).pdf")
Dim FinalPDF As PdfDocument = New Spire.Pdf.PdfDocument("E:\Development\PDF Booking Forms\FinalPDF.pdf")
FinalPDF.AppendPage(doc1)
FinalPDF.AppendPage(doc1)
FinalPDF.AppendPage(doc1)
FinalPDF.SaveToFile("E:\Development\PDF Booking Forms\FinalPDF(AppendPage).pdf")
FinalPDF.Close()
Add pages
Create a new pdf document, add the cover page and 1-n detail pages. When opening the document in Acrobat the detais pages are displayed correctly except for the radio buttons. The first detail page retains the original field names and the subsequent pages have a suffix added which makes them unique within the document. Each detail page contains two pairs of radio buttons and only one of each pair is retaining the border. This can be seen in the attachment FinalPDF( AddPage).
- Code: Select all
Dim doc1 As PdfDocument = New Spire.Pdf.PdfDocument("E:\Development\PDF Booking Forms\Booking Form (Cover).pdf")
Dim doc2 As PdfDocument = New Spire.Pdf.PdfDocument("E:\Development\PDF Booking Forms\Booking Form (Detail).pdf")
Dim FinalPDF As PdfDocument = New Spire.Pdf.PdfDocument
FinalPDF.InsertPage(doc1, 0)
FinalPDF.InsertPage(doc2, 0)
FinalPDF.InsertPage(doc2, 0)
FinalPDF.InsertPage(doc2, 0)
FinalPDF.SaveToFile("E:\Development\PDF Booking Forms\FinalPDF(AddPage).pdf")
Each approach only produces a partial solution. The append page produces the correctly formatted radio button on the first detail page, but all subsequent detail pages do not display correctly. The add page produces the correct detail pages but one of the radio buttons is not correctly formatted.