Merge PDF Files – C#, VB, and Java Code
source link: https://www.leadtools.com/blog/document-imaging/pdf/merge-pdf-files-vb-java-code/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Merge PDF Files – C#, VB, and Java Code
We have done several posts that uses the LEADTOOLS Document Converter to convert and merge multiple images and documents, including PDF. However, if all you need is to merge multiple PDF files into a single PDF file, LEADTOOLS has a PDFFile class that can combine PDF files with one-line of code.
The PDFFile class is available for .NET FX, .NET Core, and Java. In addition to PDF file merge, the PDFFile class provides much more including getting information about the file, getting PDF metadata, encrypting and decrypting PDFs, distilling PostScript to PDF, digital signing, bookmarking, annotating, and web optimizing.
Below are some C#, VB, and Java code snippets that can be used to combine PDF files into one PDF file.
Merge PDF Files C# Code
private static void Main(string[] args)
{
// Check to make sure number of args is correct, files exist, etc...
if (FailsPreFlight(args)) return;
try
{
MergePdfFiles(args.Skip(1).ToArray(), args[0]);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
private static void MergePdfFiles(string[] sourceFilePaths, string destinationFilePath)
{
// create the destination file
File.Copy(sourceFilePaths.First(), destinationFilePath, true);
new PDFFile(destinationFilePath).MergeWith(
sourceFilePaths.Skip(1).ToArray(),
destinationFilePath);
}
Merge PDF Files VB Code
New PDFFile(destinationFilePath).MergeWith( _
sourceFilePaths.Skip(1).ToArray(), destinationFilePath)
Merge PDF Files Java Code
new PDFFile(destinationFilePathString).mergeWith(
Arrays.copyOfRange(sourceFilePathStrings, 1, sourceFilePathStrings.length),
destinationFilePathString);
The LEADTOOLS PDFFile class makes merging PDF files quick work for applications that will be running on Windows, ASP.NET, macOS, iOS, Android, and Linux. The library provides complete control over the processfor times you need to do more than just merge.
See For Yourself – Free Evaluation
Download the LEADTOOLS SDK for free. It’s fully-functional for 60 days and comes with free chat and email support.
Stay Tuned For More Conversion Samples
Did you see our previous post, “Convert Multi-page TIFF to Searchable PDF in C#, Java, and C”? Stay tuned for more conversion examples to see how LEADTOOLS easily fits into any workflow converting PDF files into other document files or images and back again. Need help in the meantime? Contact our support team for free technical support! For pricing or licensing questions, you can contact our sales team via email or call us at +1-704-332-5532.
Leave a Reply Cancel reply
Your email address will not be published. Required fields are marked *
Comment
Name *
Email *
Website
Recommend
-
14
In our previous blog post, Top 10 Features of Syncfusion WPF PDF Viewer, you explored the top features of the WPF PDF Viewer. In this blog p...
-
5
How to Merge PDF Files2021-05-31Note164 words 1 min read 17 times readI have several PDF files that I want to merge to one file. Each page in the PDF i...
-
3
Convert TXT to PDF in C#, VB, and JavaWe recently posted “Convert PDF to TXT in C#, VB, and Java” that uses the
-
9
Secure PDF Files With a Password in C#, VB, and Java In the “Merge PDF Files – C#, VB, and Java Code” article, we described how...
-
8
Updated on July 13th, 2021 in #linux Using envsubst to Merge Environment Variables into Config Files
-
7
PowerShell Script: Merge PDF Files Several of my friends that do not consider themselves to be programmers have asked if I know of an easy way to merge multiple PDF files into one file. Of course, I instantly thought of usi...
-
5
How to merge 2 XML files with C # advertisements I have two XML files and I want to merge this two files to one. But how? I have tried a lot but no...
-
24
Instantly share code, notes, and snippets. Merge two zsh history files ...
-
6
Know someone who can answer? Share a link to this Before answeringYou should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more i...
-
7
Create and Modify PDF Files in Python Remove ads It’s really useful to know how to create...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK