Merge PDFs together with C# and .NET Core

November 18th, 2018 / by api2pdf /


In this article we are going to cover how to merge PDFs together with C# and .NET Core with just a few lines of code using the Api2Pdf dotnet client library. Api2Pdf is a REST API that makes it super easy to generate and combine PDFs. You can view the full documentation of the dotnet client library on Github here, but here we will only focus on merging PDFs together.

Step 1 – Installation

Run the nuget command

Install-Package Api2Pdf

Step 2 – Grab an API Key

In order to use the Api2Pdf merge endpoints, you must first acquire an API key. Register at to get your API key. It only takes a minute.

Step 3 – Write your code

Replace “YOUR-API-KEY” with the key you acquired from Step 2. Grab some URLs to existing PDFs and place them in the list, using the sample code below. If you do not have any links to PDFs handy, you can use the two below:

var a2pClient = new Api2Pdf("YOUR-API-KEY");
var links_to_pdfs = new List() {"https://LINK-TO-PDF", "https://LINK-TO-PDF"};
var apiResponse = a2pClient.Merge(links_to_pdfs);

Print your apiResponse to see the result. The url to your PDF will be in the Pdf attribute of the response object.

That’s it! Merging PDFs together only took a few minutes and required no complicated tools.

Tags: , , , , , , , , , , , , ,

Comments are closed.