How to Rotate PDF via Node.js SDK
To rotate PDF, we’ll use Aspose.PDF Cloud Node.js SDK. This Cloud SDK assists Node.js programmers in developing cloud-based PDF creator, annotator, editor, and converter apps using Node.js programming language via Aspose.PDF REST API. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Node.js SDK.
Package Manager Console Command
npm install asposepdfcloud --save
Steps to rotate PDF via Cloud Node.js
Aspose.PDF Cloud developers can easily load & rotate PDF in just a few lines of code.
- Initialize the Aspose PDF API
- Upload original document
- Call Rotation Endpoint
- Evaluate Response
- Download resulting file if success
Rotate PDF using Node.js
import { PdfChangeLayoutHelper, pdfApi } from "./changeLayoutHelper.js";
export { PdfRotatePages };
const PdfRotatePages = {
async rotate(document, angle, pages, localFolder, tempFolder) {
if ( pdfApi) {
await PdfChangeLayoutHelper.uploadDocument(document, localFolder, tempFolder);
const response = await pdfApi.postDocumentPagesRotate(
document, angle, pages, null, tempFolder);
if (response.body.code == 200) {
console.log("rotatePages(): Page successfully rotated.");
await PdfChangeLayoutHelper.downloadResult(document, localFolder, tempFolder, "rotated_output_");
}
else
console.error("rotatePages(): Can't rotate pdf document pages!")
}
}
}
With our Node.js library you can
Rotate PDF documents with Aspose.PDF Cloud Node.js SDK.
- Add PDF document’s header & footer in text or image format.
- Add tables & stamps (text or image) to PDF documents.
- Append multiple PDF documents to an existing file.
- Work with PDF attachments, annotations, & form fields.
- Apply encryption or decryption to PDF documents & set a password.
- Delete all stamps & tables from a page or entire PDF document.
- Delete a specific stamp or table from the PDF document by its ID.
- Replace single or multiple instances of text on a PDF page or from the entire document.
- Extensive support for converting PDF documents to various other file formats.
- Extract various elements of PDF files & make PDF documents optimized.
- You can try out our free App to test the functionality.
- Learning Resources
- Documentation
- Source Code
- API References
- Product Support
- Free Support
- Paid Support
- Blog
- Why Aspose.PDF Cloud for Node.js?
- Customers List
- Security