This short tutorial shows how PDF Java developers can add a new page to a PDF document using the Aspose.PDF Cloud REST API. You will learn to insert an empty page online, then download and save the resulting file to disk. For more information about the PDF format, see the PDF file format guide.
Prerequisite
- Create an account API credentials
- Download the Aspose.PDF Cloud SDK for Java
- Set up a Java project with the above SDK for adding a page
Steps to Insert New Page in PDF with Java-based API
- Configure the client ID and secret in the PdfApi for adding a page.
- Upload the source PDF file where an empty page is to be added.
- Call the PutAddNewPage() method with the uploaded PDF file name in the cloud storage.
- Download the modified PDF file that has an empty page at the end and save it on the disk.
These steps define the process to add an extra page in a PDF with the Java RESTful service. Initialize the PdfApi object, upload the target PDF file to Aspose Cloud storage, and invoke PutAddNewPage() to append an empty page. Finally, download the output PDF stream and store it locally.
Code to Insert New Page Into PDF with Java RESTful Service
The code above demonstrates how to add another page to a PDF using the Java‑based API. You can add as many pages as required by calling PutAddNewPage() multiple times. Use the same file name when downloading the output PDF that you used for uploading the source file via UploadFile().
If you need to append one PDF to another, see the related article: Append PDF with Java REST API.
Keywords: add new page to pdf with Java Low Code API; add new page in pdf with Java REST API; add new pages to pdf with Java REST Interface; add a new page in pdf with Java Low Code API; add another page in pdf with Java-based API; add extra page in pdf with Java RESTful Service.