Test in production without watermarks.
Works wherever you need it to.
Get 30 days of fully functional product.
Have it up and running in minutes.
Full access to our support engineering team during your product trial
This tutorial demonstrates how to merge PDF files in VB.NET.
Merge
method to combine the PDFsSaveAs
method in VB.NETIronPDF is a powerful PDF SDK foundation for PDF processing, making it simple for developers to produce, read, and edit PDF documents quickly. The IronPDF library converts HTML to PDF by using the Chrome engine. Xamarin, Blazor, Unity, HoloLens applications, Windows Forms, HTML, ASPX, Razor HTML, .NET Core, ASP.NET, and WPF are just a few of the many web components that the library supports. Both conventional Windows Applications and ASP.NET Web Applications can make use of Microsoft .NET and .NET Core programming.
IronPDF allows you to build PDFs that are visually appealing and contain a title and footer by utilizing HTML5, JavaScript, CSS, and pictures. Along with a powerful HTML-to-PDF converter that works with PDF files, the API library also has a standalone PDF conversion engine that is not dependent on any external resources.
To know more about the Merge PDF files using IronPDF, refer to the merge PDF files example.
The examples in the parts that follow in this newsletter show how simple the IronPDF library is to use.
Creating a new project to merge PDF files is the first step.
Choose "New Project" from the "File" menu when Visual Studio is open.
Select the "Console App" template in the ensuing dialogue box, then click "Next".
Create a new project in Visual Studio
Enter any project name you pick in the Project name box, and the new project's location in the Location field. To continue, click the Next button.
Configure your new project
From the Framework drop-down menu, pick a .NET Framework. In this case, we're utilizing the long-supported version of .NET, 6.0. Next, click on Create.
.NET Framework selection
Next, download the solution's necessary IronPDF library. Use the following code on the package manager to accomplish this:
Install-Package IronPdf
As an alternative, the NuGet Package Manager can be used to look for the IronPdf
package.
Search for IronPDF in NuGet Package Manager UI
A "Save As" dialogue box that enables saving the created IronPDF to the chosen location has been added to this application.
You can utilize IronPDF to deal effectively with numerous or huge PDF files. When processing the documents, you can use less RAM thanks to the characteristics of lazy loading and incremental update built-in features. It is possible to merge multiple PDF documents into a single PDF file with a few lines of code.
Below is the sample code to merge multiple PDF files.
Imports System
Imports IronPdf
Module Program
Sub Main(args As String())
' Declare PdfDocument objects for the PDF files to be merged
Dim firstPDF, secondPDF, MergedPDF As PdfDocument
' Load existing PDF files into PdfDocument objects
firstPDF = PdfDocument.FromFile("A.pdf")
secondPDF = PdfDocument.FromFile("B.pdf")
' Merge the loaded PDF documents into a single PdfDocument
MergedPDF = PdfDocument.Merge(firstPDF, secondPDF)
' Save the merged PDF document to the specified file path
MergedPDF.SaveAs("MergeDoc.pdf")
End Sub
End Module
Imports System
Imports IronPdf
Module Program
Sub Main(args As String())
' Declare PdfDocument objects for the PDF files to be merged
Dim firstPDF, secondPDF, MergedPDF As PdfDocument
' Load existing PDF files into PdfDocument objects
firstPDF = PdfDocument.FromFile("A.pdf")
secondPDF = PdfDocument.FromFile("B.pdf")
' Merge the loaded PDF documents into a single PdfDocument
MergedPDF = PdfDocument.Merge(firstPDF, secondPDF)
' Save the merged PDF document to the specified file path
MergedPDF.SaveAs("MergeDoc.pdf")
End Sub
End Module
The above code snippet shows how to merge PDF documents using IronPDF. First, load two PDF files A.pdf
and B.pdf
to create a local variable for the PdfDocument
object by using the FromFile
function. IronPDF provides a separate function called Merge
which helps to pass multiple PDF document objects as parameters to merge PDFs. After passing all the objects into the merge function, another function called SaveAs
is used to save the combined PDF files into one PDF file.
The content of two PDF files
The above image shows the two input PDF files. The output PDF file will be linked below.
The output file
The above images show that the function combines the first and second PDF files that are saved into a PDF file. Likewise, it can merge multiple PDF files. IronPDF can perform this process in a few milliseconds with few lines of code.
IronPDF is straightforward to use, and with just a few lines of code, it can produce PDF files. It is appropriate for beginners, and using this application requires only rudimentary expertise. There is no reliance between IronPDF and any other package. For instance, it is solely a single-package library.
In addition to the free license that is offered, developers have the option of purchasing a range of licenses to meet their needs. All library features, such as a perpetual license, a 30-day money-back guarantee, a year of software support, upgrades, and potential for SaaS and OEM redistribution, are not included in the $749 Lite edition.
It also does not include ongoing costs. These licenses are one-time investments that can be used for production, staging, and development. Additionally, IronPDF offers time-limited, non-distributable free licenses. For complete pricing and licensing information about IronPDF, kindly go to the licensing page.
IronPDF is a powerful PDF SDK that allows developers to produce, read, and edit PDF documents quickly. It supports a variety of inputs, including HTML, images, and more, to create visually appealing PDFs.
You can merge PDF files in VB.NET using the IronPDF library by loading the PDF files into PdfDocument objects, using the Merge method to combine them, and then saving the merged document with the SaveAs method.
To integrate IronPDF into a VB.NET project, download the IronPDF library from NuGet, create a new project in Visual Studio, choose the Console App template, and then add IronPDF to your project using the Package Manager.
IronPDF allows you to merge multiple PDF documents efficiently with a few lines of code, offering features like lazy loading and incremental updates to optimize memory usage.
IronPDF supports a wide range of platforms including Xamarin, Blazor, Unity, HoloLens, Windows Forms, ASP.NET, .NET Core, and WPF, among others.
No, IronPDF has a standalone PDF conversion engine and does not rely on external resources. It operates independently as a single-package library.
Yes, IronPDF can access password-protected PDF files by providing the necessary usernames and passwords for authentication.
IronPDF offers a range of licensing options, including a free license and paid licenses that provide additional features like perpetual use, software support, and potential for SaaS and OEM redistribution.
After merging PDF files using the Merge method in IronPDF, you can save the merged document to a specified file path using the SaveAs method.