Duplicate PDF Page C# API
Make a copy of one or more pages in a PDF document using our C# PDF page duplication API.
Flexible page duplication
Select specific pages or page ranges to duplicate and insert them wherever needed in a document. Great for duplicating signature pages, instructions, or templates.
Streamline complex workflows
Automate duplication tasks in large PDFs without manual editing. Perfect for applications like contracts, reports, or forms with repeatable content.
Simple and transparent pricing
Select a package that suits your needs according to the number of credits you wish to spend. Each API tool and action has a specific credit cost.
Nutrient is used by
Try it out
This example duplicates the first and last pages of a document.
Use Your Free API Calls
Sign up and receive 100 credits for free, or log in to automatically add your API key to sample code. If you are not sure how credits are consumed read more in our pricing documentation , or check out this guide on calculating credit usage.
Add a File
Add a PDF named document.pdf
to your project folder. You can also use our sample file.
The file name is case sensitive. Make sure the file name matches the file name in the sample code.
Run the Code
Copy the code and run it from the same folder you added the files to. For more information, see our language-specific getting started guides.
View the Results
Open
result.pdf
in your project folder to view the results.
using System;
using System.IO;
using System.Net;
using RestSharp;
namespace PspdfkitApiDemo
{
class Program
{
static void Main(string[] args)
{
var client = new RestClient("https://api.nutrient.io/build");
var request = new RestRequest(Method.POST)
.AddHeader("Authorization", "Bearer your_api_key_here")
.AddFile("document", "document.pdf")
.AddParameter("instructions", new JsonObject
{
["parts"] = new JsonArray
{
new JsonObject
{
["file"] = "document",
["pages"] = new JsonObject
{
["start"] = 0,
["end"] = 0
}
},
new JsonObject
{
["file"] = "document"
},
new JsonObject
{
["file"] = "document",
["pages"] = new JsonObject
{
["start"] = -1,
["end"] = -1
}
}
}
}.ToString());
request.AdvancedResponseWriter = (responseStream, response) =>
{
if (response.StatusCode == HttpStatusCode.OK)
{
using (responseStream)
{
using var outputFileWriter = File.OpenWrite("result.pdf");
responseStream.CopyTo(outputFileWriter);
}
}
else
{
var responseStreamReader = new StreamReader(responseStream);
Console.Write(responseStreamReader.ReadToEnd());
}
};
client.Execute(request);
}
}
}
Your API key
Get access to your API key when you create an account. Once your account has been created, you’ll get 100 credits for free.
Your API key has automatically been inserted into the API example code. Run the sample code in your terminal to execute the API call.
Security is our top priority
No document storage
No input or resulting documents are stored on our infrastructure. All files are deleted as soon as a request finishes. Alternatively, check out our self-hosted product.
HTTPS encryption
All communication between your application and Nutrient is done via HTTPS to ensure your data is encrypted when it’s sent to us.
Safe payment processing
All payments are handled by Paddle. Nutrient DWS Processor API never has direct access to any of your payment data.