remove pdf pages

Remove PDF Pages using .NET REST API.

For optimal information delivery, a carefully crafted PDF file serves as an epitome of precision and relevance. However, the need to remove specific pages from a PDF often arises due to a multitude of reasons. Perhaps you need to eliminate redundant information, correct errors, or create a more concise version of a document. Maybe you received a comprehensive report, but only a portion of it is pertinent to your needs. In such cases, the ability to surgically remove pages from a PDF document is not just a convenience but a necessity. This article explores the various compelling reasons behind the need and presents you with efficient methods to achieve it using .NET REST API.

REST API to Remove PDF Pages

Removing pages from a PDF document is a stmlined process with the Aspose.PDF Cloud SDK for .NET. Whether you need to eliminate redundant pages or trim down a document to its most relevant sections, this SDK simplifies the task. The precision of the SDK ensures that only the intended pages are eliminated, leaving you with a more refined and focused PDF document.

Now, the first step is to add the SDK reference in our project and for that purpose, please search Aspose.PDF-Cloud in NuGet packages manager inside Visual Studio IDE and click the Add Package button. You also need to obtain your client credentials from cloud dashboard. In case you do not have an existing account, simply create a free account by following the instructions specified over quick start.

Eliminate PDF Pages using C# .NET

Removing of pages from a PDF document is made seamless with the Aspose.PDF Cloud SDK for .NET. Let’s explore the code snippet to eliminate PDF pages using C# .NET.

eliminate PDF pages

Preview of delete PDF page operation.

Given below are quick details regarding above stated code snippet.

PdfApi pdfApi = new PdfApi(clientSecret, clientID);

Firstly, create an object of PdfApi class while passing client credentials as input arguments.

var response = pdfApi.DeletePage("Converted-PDF_A.pdf", 1);

Now, call the API to remove the page at first index and save the output to cloud storage.

Delete Pages from PDF using cURL Commands

Eliminating specific pages from a PDF document using Aspose.PDF Cloud and cURL commands is a straightforward and efficient process. With Aspose.PDF Cloud’s RESTful API, you can easily send HTTP requests to remove particular pages from a PDF. By utilizing the DELETE method on the specific page or range of pages, the unwanted content can be surgically removed.

The first step in this approach is the generation of a JWT access token. So, please execute the following command:

curl -v "" \
 -X POST \
 -d "grant_type=client_credentials&client_id=163c02a1-fcaa-4f79-be54-33012487e783&client_secret=c71cfe618cc6c0944f8f96bdef9813ac" \
 -H "Content-Type: application/x-www-form-urlencoded" \
 -H "Accept: application/json"

Once a JWT token is generated, please execute the following command to delete the pages from PDF document. After successful completion, the updated document is stored in cloud storage.

curl -v "{sourcePDF}/pages/1" \
-H  "accept: application/json" \
-H  "authorization: Bearer {accessToken}"
-d {}

Replace sourcePDF with the name of an input PDF document available in cloud storage, and accessToken with JWT access token generated above.


In conclusion, the need to remove pages from PDF documents is a critical aspect of document refinement and customization. Both approaches, utilizing the Aspose.PDF Cloud SDK for .NET and leveraging Aspose.PDF Cloud with cURL commands, present efficient solutions to achieve this. The SDK offers a comprehensive and developer-friendly toolkit, enabling precise control and seamless integration for removing specific pages programmatically. On the other hand, using Aspose.PDF Cloud with cURL commands provides a flexible, platform-independent method to initiate page removal through simple HTTP requests.

We highly recommend visiting the following blogs: