VB.NET PDF: How to HTML5 PDF Viewer PDF Create PDF Export File & Page Process PDF Read PDF Write Form Process Document Protect Annotation & Drawing PDF Print WPF PDF Viewer Work with Other SDKs Barcode Read Barcode Create OCR Twain
Page: Insert PDF Pages
  |  
Home ›› XDoc.PDF ›› VB.NET PDF: Insert PDF Page

VB.NET PDF - How to Insert a New Page to PDF in VB.NET


Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document in VB.NET Program




Professional .NET PDF control for inserting PDF page in Visual Basic .NET class application


Able to add and insert one or multiple pages to existing adobe PDF document in VB.NET


Ability to create a blank PDF page with related by using following online VB.NET source code


Support .NET WinForms, ASP.NET MVC in IIS, ASP.NET Ajax, Azure cloud service, DNN (DotNetNuke), SharePoint


Create new page to PDF document in both ASP.NET web server-side application and .NET Windows Forms


Support adding PDF page number


Offer PDF page break inserting function


Free SDK library for Visual Studio .NET


Independent .NET PDF editor compatible with Windows operating system


RasterEdge XDoc.PDF SDK is compatible with Visual Studio 2005 or any greater version (2008/2010/2012) and it's able to be developed in Microsoft 2.0 or later Frameworks, like 3.0, 3.5, 4.0 and 4.5. It provides simple ways to create VB application to combine .NET Imaging Processing and PDF document libraries. And this page will give comprehensive VB example codes to create a new page to any designed location of the PDF file.


Within RasterEdge .NET Imaging Processing and PDF DLLs controls, programmers and end users are capable of adding and inserting a new blank page to the existing PDF document within a well developed VB.NET document imaging application. Using our PDF document manipulation APIs, users can easily customize and set the PDF page adding tool to freely choose the specific location of the new page. For example, you can insert the new PDF page before or after any existed PDF document page with the help of VB.NET sample code. If you want to read the tutorial of PDF page adding in C# class, we suggest you go to C# Imaging - how to insert a new empty page to PDF file.




DLLs for Adding Page into PDF Document in VB.NET Class



Add necessary references:


  RasterEdge.Imaging.Basic.dll


  RasterEdge.Imaging.Basic.Codec.dll


  RasterEdge.Imaging.Drawing.dll


  RasterEdge.Imaging.Font.dll


  RasterEdge.Imaging.Processing.dll


  RasterEdge.XDoc.Raster.dll


  RasterEdge.XDoc.Raster.Core.dll


  RasterEdge.XDoc.PDF.dll


Use corresponding namespaces;


  using RasterEdge.Imaging.Basic;


  using RasterEdge.XDoc.PDF;




Add and Insert a Page to PDF File Using VB



This demo will help you to insert a PDF page to a PDFDocument object at specified position in VB.NET program.




Dim inputFilePath1 As String = Program.RootPath + "\\" + "1.pdf"
Dim inputFilePath2 As String = Program.RootPath + "\\" + "2.pdf"
Dim outPutFilePath As String = Program.RootPath + "\\" + "Output.pdf"

Dim doc1 As PDFDocument = New PDFDocument(inputFilePath1)
Dim doc2 As PDFDocument = New PDFDocument(inputFilePath2)

' Get a page from the first document.
Dim page As PDFPage = doc1.GetPage(0)

' Specify a position for inserting the selected page.
Dim pageIndex As Integer = 2

' Insert the page to the second document at specified position.
doc2.InsertPage(page, pageIndex)

' Output the new document.
doc2.Save(outPutFilePath)





Add and Insert Multiple PDF Pages to PDF Document Using VB



Moreover, you may use the following VB.NET demo code to insert multiple pages of a PDF file to a PDFDocument object at user-defined position.




Dim inputFilePath1 As String = Program.RootPath + "\\" + "1.pdf"
Dim inputFilePath2 As String = Program.RootPath + "\\" + "2.pdf"
Dim outPutFilePath As String = Program.RootPath + "\\" + "Output.pdf"

Dim doc1 As PDFDocument = New PDFDocument(inputFilePath1)
Dim doc2 As PDFDocument = New PDFDocument(inputFilePath2)

' Get page 0, page 1 and page 2 from the first document.
Dim page0 As PDFPage = doc1.GetPage(0)
Dim page1 As PDFPage = doc1.GetPage(1)
Dim page2 As PDFPage = doc1.GetPage(2)
Dim pages = New PDFPage() {page0, page1, page2}

' Specify a position for inserting the selected pages.
Dim pageIndex As Integer = 1

' Insert the pages to the second document at specified position.
doc2.InsertPages(pages, pageIndex)

' Output the new document.
doc2.Save(outPutFilePath)





Add and Insert Blank Page to PDF File Using VB



This demo explains how to use VB to insert an empty page to a specific location of current PDF file .




Dim filepath As String = ""
Dim outPutFilePath As String = ""
Dim doc As PDFDocument = New PDFDocument(filepath)

' Insert empty page at 2 (previous to the third page).
doc.InsertPage(2)

' Save the file.
doc.Save(outPutFilePath)