Saltar al pie de página
USANDO IRONPDF

Cómo Unir Archivos PDF en VB.NET

This tutorial demonstrates how to merge PDF files in VB.NET.

IronPDF Features

IronPDF 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.

  • The IronPDF library allows users to create PDFs from a variety of inputs, including image files, HTML, HTML5, ASPX, and Razor/MVC View.
  • Tools that can be used to work with interactive PDFs include filling out and submitting interactive forms.
  • Merge and divide PDFs, extract text and pictures from PDF files, search text in PDF files, rasterize PDFs to images, change font size and convert PDF files.
  • The library also offers the usage of user agents, proxies, cookies, HTTP headers, and form variables for authentication behind HTML login forms, as well as links as the foundation for PDF publications.
  • Password-protected PDF files can be accessed with IronPDF in exchange for usernames and passwords.
  • Using the IronPDF API, existing PDF files may be read and edited.
  • The library can extract images from PDF files in addition to adding text, graphics, bookmarks, watermarks, headers, and footers to PDF files.
  • Users can split and combine pages in a new or old PDF document. Without having an Acrobat Reader, IronPDF can also create PDF objects from text.
  • From CSS files and CSS media files, PDF documents can be produced.

To know more about the Merge PDF files using IronPDF, refer to the merge PDF files example.

Creating a .NET Core 6 Project

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".

How to Merge PDF Files in VB.NET, Figure 1: Create a new project in Visual Studio 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.

How to Merge PDF Files in VB.NET, Figure 2: Configure your new project 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.

How to Merge PDF Files in VB.NET, Figure 3: .NET Framework selection .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.

How to Merge PDF Files in VB.NET, Figure 4: Search for IronPDF in NuGet Package Manager UI 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.

Merge PDF files

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
VB .NET

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.

How to Merge PDF Files in VB.NET, Figure 5: The content of two PDF files The content of two PDF files

The above image shows the two input PDF files. The output PDF file will be linked below.

OUTPUT PDF FILE

How to Merge PDF Files in VB.NET, Figure 6: The output file 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.

Conclusion

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 $799 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.

Preguntas Frecuentes

¿Cómo fusiono archivos PDF en VB.NET?

Puedes fusionar archivos PDF en VB.NET usando IronPDF cargando los PDFs con objetos PdfDocument, aplicando el método Merge y guardando el resultado con el método SaveAs.

¿Cuál es la ventaja de usar IronPDF para fusionar PDFs?

IronPDF simplifica el proceso de fusión con unas pocas líneas de código y asegura que el formato se preserve. También admite varias entradas como HTML, imágenes y más, mejorando la calidad visual de los PDFs.

¿Cómo puedo cargar archivos PDF existentes en VB.NET para fusionarlos?

En VB.NET, puedes cargar archivos PDF existentes para fusionarlos usando la clase PdfDocument de IronPDF para abrir y manipular los archivos antes de fusionarlos con el método Merge.

¿Puede IronPDF procesar archivos PDF protegidos con contraseña?

Sí, IronPDF puede manejar archivos PDF protegidos con contraseña permitiéndote proporcionar las credenciales requeridas para el acceso durante el procesamiento.

¿Es IronPDF compatible con .NET Core?

Sí, IronPDF es compatible con .NET Core así como con otras plataformas como Xamarin, Blazor y Windows Forms, lo que lo hace versátil para diferentes entornos de desarrollo.

¿Cómo guardo un documento PDF fusionado en VB.NET?

Una vez que has fusionado los archivos PDF usando IronPDF, puedes guardar el documento combinado en una ubicación deseada usando el método SaveAs, especificando la ruta del archivo.

¿Necesito recursos externos para usar IronPDF?

No, IronPDF opera como una biblioteca independiente con su propio motor de conversión de PDF, lo que significa que no depende de ningún recurso externo o paquetes.

¿Qué tipo de opciones de licencia ofrece IronPDF?

IronPDF ofrece una variedad de opciones de licencia incluyendo una licencia gratuita y licencias de pago que ofrecen características adicionales como uso perpetuo y soporte de software.

¿IronPDF es totalmente compatible con .NET 10 al fusionar archivos PDF en VB.NET?

Sí, IronPDF es totalmente compatible con .NET 10. Admite la fusión de documentos PDF en proyectos .NET 10, igual que en versiones anteriores. Puede usar los mismos métodos, como PdfDocument.Merge y SaveAs en VB.NET sin necesidad de realizar cambios especiales. (Actualizado: 22 de junio de 2025)

¿Qué soporte de plataforma proporciona IronPDF para las aplicaciones .NET 10?

IronPDF admite aplicaciones .NET 10 en escritorios (Windows Forms, WPF), web (ASP.NET Core, Blazor) y escenarios multiplataforma sin necesidad de realizar ajustes específicos de la plataforma; la API funciona de manera consistente en VB.NET al igual que en versiones anteriores de .NET.

Curtis Chau
Escritor Técnico

Curtis Chau tiene una licenciatura en Ciencias de la Computación (Carleton University) y se especializa en el desarrollo front-end con experiencia en Node.js, TypeScript, JavaScript y React. Apasionado por crear interfaces de usuario intuitivas y estéticamente agradables, disfruta trabajando con frameworks modernos y creando manuales bien ...

Leer más