Merge PDFs in C#
PSPDFKit GdPicture.NET Library enables you to merge several documents in different formats into a single PDF document. For more information, see the list of supported file formats.
To merge several documents into a single PDF, use the GdPictureDocumentConverter
class. You can also choose the PDF conformance level.
The code below converts a JPG image and a XLSX document into a single PDF of the 1.5 standard:
using GdPictureDocumentConverter gdpictureConverter = new GdPictureDocumentConverter(); IEnumerable<string> source = new List<string>(new string[] { @"C:\temp\source1.jpg", @"C:\temp\source2.xlsx" }); gdpictureConverter.CombineToPDF(source, @"C:\temp\output.pdf", PdfConformance.PDF1_5);
Using gdpictureConverter As GdPictureDocumentConverter = New GdPictureDocumentConverter() Dim source As IEnumerable(Of String) = New List(Of String)(New String() {"C:\temp\source1.jpg", "C:\temp\source2.xlsx"}) gdpictureConverter.CombineToPDF(source, "C:\temp\output.pdf", PdfConformance.PDF1_5) End Using