Skip to content

Commit 98341c4

Browse files
authored
Merge pull request #33 from aspose-pdf-cloud/holub
feat: PDF pages (add templates: Stamps, Pages)
2 parents b6e3530 + 46b4adc commit 98341c4

File tree

10 files changed

+1470
-73
lines changed

10 files changed

+1470
-73
lines changed

pdf/nodejs/header/image/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ lastmod: "2025-02-20"
66
---
77

88
{{< blocks/products/pf/main-wrap-class isAutogenPage="true">}}
9-
{{< blocks/products/pf/upper-banner h1="Add Image in Header of PDF via Node.js Cloud API" h2="API for working with Image Hesder in PDF documents using Cloud Node.js SDK" logoImageSrc="https://products.aspose.cloud/headers/aspose_pdf-for-node.svg" sourceAdditionalConversionTag="" additionalConversionTag="PDF" pfName="" subTitlepfName="" downloadUrl="" fileiconsmall1="HTML" fileiconsmall2="JPG" fileiconsmall3="PDF" fileiconsmall4="XML" fileiconsmall5="DOCX" >}}
9+
{{< blocks/products/pf/upper-banner h1="Add Image in Header of PDF via Node.js Cloud API" h2="API for working with Image Header in PDF documents using Cloud Node.js SDK" logoImageSrc="https://products.aspose.cloud/headers/aspose_pdf-for-node.svg" sourceAdditionalConversionTag="" additionalConversionTag="PDF" pfName="" subTitlepfName="" downloadUrl="" fileiconsmall1="HTML" fileiconsmall2="JPG" fileiconsmall3="PDF" fileiconsmall4="XML" fileiconsmall5="DOCX" >}}
1010

1111
{{< blocks/products/pf/main-container pfName="Aspose.PDF Cloud" subTitlepfName="Node.js SDK" >}}
1212
{{< blocks/products/pf/sub-menu logoImageSrc="https://products.aspose.cloud/sdk/aspose_pdf-for-node.svg"

pdf/nodejs/pages/add/_index.md

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
---
2+
title: Add Pages to PDF via Cloud Node.js SDK
3+
url: /nodejs/pages/add/
4+
description: Aspose.PDF Cloud allows you to Add Pages to PDF Document. Check the Node.js source code to add Pages into PDF file.
5+
lastmod: "2025-02-20"
6+
---
7+
8+
{{< blocks/products/pf/main-wrap-class isAutogenPage="true">}}
9+
{{< blocks/products/pf/upper-banner h1="Add Pages to PDF via Node.js Cloud API" h2="API for working with Pages in PDF documents using Cloud Node.js SDK" logoImageSrc="https://products.aspose.cloud/headers/aspose_pdf-for-node.svg" sourceAdditionalConversionTag="" additionalConversionTag="PDF" pfName="" subTitlepfName="" downloadUrl="" fileiconsmall1="HTML" fileiconsmall2="JPG" fileiconsmall3="PDF" fileiconsmall4="XML" fileiconsmall5="DOCX" >}}
10+
11+
{{< blocks/products/pf/main-container pfName="Aspose.PDF Cloud" subTitlepfName="Node.js SDK" >}}
12+
{{< blocks/products/pf/sub-menu logoImageSrc="https://products.aspose.cloud/sdk/aspose_pdf-for-node.svg"
13+
autoGeneratedVersion="true"
14+
liveDemosLink="https://products.aspose.app/pdf/family/" PricingLink="https://purchase.aspose.cloud/pricing" buyLink="" docsLink="https://docs.aspose.cloud/pdf" directDownloadLink="https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-node.js" >}}
15+
16+
{{% blocks/products/pf/agp/content h2="How to add Pages via Node.js SDK" %}}
17+
18+
In order to add Pages to PDF, we'll use
19+
[Aspose.PDF Cloud Node.js SDK](https://products.aspose.cloud/pdf/nodejs/). 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. Simply create an account at [Aspose for Cloud](https://dashboard.aspose.cloud/#/apps) and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Node.js SDK.
20+
21+
{{% blocks/products/pf/agp/code-block title="Package Manager Console Command" offSpacer="true" %}}
22+
23+
```bash
24+
25+
 
26+
npm install asposepdfcloud --save
27+
 
28+
 
29+
30+
```
31+
32+
{{% /blocks/products/pf/agp/code-block %}}
33+
34+
{{% /blocks/products/pf/agp/content %}}
35+
36+
{{< blocks/products/pf/agp/feature-section isGrey="true" >}}
37+
38+
{{% blocks/products/pf/agp/feature-section-col title="Steps to add Pages via Cloud Node.js" %}}
39+
40+
{{% blocks/products/pf/agp/text %}}
41+
42+
Aspose.PDF Cloud developers can easily add Pages to PDF in just a few lines of code.
43+
44+
{{% /blocks/products/pf/agp/text %}}
45+
46+
1. Create an object to connect to the Pdf.Cloud API
47+
1. Upload your document file
48+
1. Adding a new page to PDF
49+
1. Download the result if needed it
50+
51+
{{% /blocks/products/pf/agp/feature-section-col %}}
52+
53+
{{% blocks/products/pf/agp/feature-section-col title="System Requirements" %}}
54+
55+
{{% blocks/products/pf/agp/text %}}
56+
57+
It is easy to get started with Aspose.PDF Cloud Node.js SDK and there is nothing to install. Simply create an account at Aspose for Cloud and get your application information. Once you have the App SID & key, you are ready to give the Aspose.PDF Cloud Node.js SDK.
58+
59+
* CPU: 1GHz
60+
* RAM: 512Mb
61+
* Free space on disk: 20Mb
62+
* Any OS Microsoft Windows, Mac OS, Linux x32/x64
63+
* node.js v4.8 or higher
64+
65+
{{% /blocks/products/pf/agp/text %}}
66+
67+
{{% /blocks/products/pf/agp/feature-section-col %}}
68+
69+
{{% blocks/products/pf/agp/code-block title="This sample code shows adding Pages - Node.js" offSpacer="" %}}
70+
71+
```js
72+
73+
import credentials from "./credentials.json" with { type: "json" };
74+
import fs from 'node:fs/promises';
75+
import path from 'node:path';
76+
import { PdfApi } from "asposepdfcloud";
77+
78+
const configParams = {
79+
LOCAL_FOLDER: "C:\\Samples\\",
80+
PDF_DOCUMENT_NAME: "sample.pdf",
81+
LOCAL_RESULT_DOCUMENT_NAME: "output_sample.pdf"
82+
};
83+
84+
const pdfApi = new PdfApi(credentials.id, credentials.key);
85+
86+
const pdfPages = {
87+
async uploadDocument () {
88+
const fileNamePath = path.join(configParams.LOCAL_FOLDER, configParams.PDF_DOCUMENT_NAME);
89+
const pdfFileData = await fs.readFile(fileNamePath);
90+
await pdfApi.uploadFile(configParams.PDF_DOCUMENT_NAME, pdfFileData);
91+
},
92+
93+
async downloadResult () {
94+
const changedPdfData = await pdfApi.downloadFile(configParams.PDF_DOCUMENT_NAME);
95+
const filePath = path.join(configParams.LOCAL_FOLDER, configParams.LOCAL_RESULT_DOCUMENT_NAME);
96+
await fs.writeFile(filePath, changedPdfData.body);
97+
console.log("Downloaded: " + filePath);
98+
},
99+
100+
async addPage () {
101+
const resultPages = await pdfApi.putAddNewPage(configParams.PDF_DOCUMENT_NAME);
102+
103+
if (resultPages.body.code == 200 && resultPages.body.pages) {
104+
this.showPages( [ resultPages.body.pages.list[resultPages.body.pages.list.length - 1] ], "new page");
105+
return resultPages.body.pages.list[resultPages.body.pages.list.length - 1];
106+
}
107+
else
108+
console.error("Unexpected error : can't get pages!!!");
109+
},
110+
111+
showPages (pages, prefix) {
112+
if (Array.isArray(pages) && pages.length > 0)
113+
{
114+
pages.forEach(function(page) {
115+
console.log(prefix +" => id: '" + page.id + "', lLx: '" + page.rectangle.lLX + "', lLY: '" + page.rectangle.lLY + "', uRX: '" + page.rectangle.uRX + "', uRY: '" + page.rectangle.uRY + "'");
116+
});
117+
}
118+
else
119+
console.error("showPages() error: array of pages is empty!")
120+
},
121+
}
122+
123+
async function main() {
124+
try {
125+
await pdfPages.uploadDocument();
126+
await pdfPages.addPage();
127+
await pdfPages.downloadResult();
128+
} catch (error) {
129+
console.error("Error:", error.message);
130+
}
131+
}
132+
```
133+
134+
{{% /blocks/products/pf/agp/code-block %}}
135+
136+
{{% blocks/products/pf/agp/content h2="Work with the Pages via Node.js SDK" %}}
137+
138+
​Adding pages to a PDF document is a common task that serves various purposes, enhancing the document's functionality, organization, and comprehensiveness. Often, it's necessary to include extra content such as appendices, references, or updated data that wasn't available during the original document creation. Adding new pages allows for the seamless integration of this supplementary information, ensuring the document remains current and comprehensive. Adding pages to a PDF is a versatile practice that addresses multiple needs, from enhancing content and structure to ensuring compliance and facilitating collaboration. By understanding the specific requirements and utilizing appropriate tools, users can effectively manage and modify their PDF documents to suit various purposes.
139+
Add the Pages to PDF documents with [Aspose.PDF Cloud Node.js SDK](https://products.aspose.cloud/pdf/nodejs/).
140+
141+
**With our Node.js library you can**
142+
143+
+ Add PDF document's header & footer in text or image format.
144+
+ Add tables & stamps (text or image) to PDF documents.
145+
+ Append multiple PDF documents to an existing file.
146+
+ Work with PDF attachments, annotations, & form fields.
147+
+ Apply encryption or decryption to PDF documents & set a password.
148+
+ Delete all stamps & tables from a page or entire PDF document.
149+
+ Delete a specific stamp or table from the PDF document by its ID.
150+
+ Replace single or multiple instances of text on a PDF page or from the entire document.
151+
+ Extensive support for converting PDF documents to various other file formats.
152+
+ Extract various elements of PDF files & make PDF documents optimized.
153+
+ You can try out our [free Apps](https://products.aspose.app/pdf/family/) to test the functionality online.
154+
155+
{{% /blocks/products/pf/agp/content %}}
156+
157+
{{< /blocks/products/pf/agp/feature-section >}}
158+
159+
<!-- aboutfile Starts -->
160+
161+
{{% blocks/products/pf/agp/content h2="About Aspose.PDF Cloud Node.js SDK" %}}
162+
163+
[Aspose.PDF Cloud](https://products.aspose.cloud/pdf) is a true REST API that enables you to perform a wide range of document processing operations including creation, manipulation, conversion and rendering of PDF documents in the cloud.
164+
165+
Our Cloud SDKs are wrappers around REST API in various programming languages, allowing you to process documents in language of your choice quickly and easily, gaining all benefits of strong types and IDE highlights. This repository contains new generation SDKs for Aspose.PDF Cloud and examples.
166+
167+
These SDKs are now fully supported. If you have any questions, see any bugs or have enhancement request, feel free to reach out to us at Free [Support Forums](https://forum.aspose.cloud/c/pdf).
168+
169+
{{% /blocks/products/pf/agp/content %}}
170+
171+
{{< blocks/products/pf/agp/about-file-section >}}
172+
173+
{{< blocks/products/pf/agp/demobox sectionTitle="Aspose.PDF No Code Online App" sectionDescription="For testing our functionality visit the [Live Demos website](https://products.aspose.app/pdf/family/). The live demo has the following benefits" >}}
174+
175+
{{< blocks/products/pf/agp/democard icon="fa-cogs" text=" No need to download or setup anything" >}}
176+
{{< blocks/products/pf/agp/democard icon="fa-edit" text=" No need to write any code" >}}
177+
{{< blocks/products/pf/agp/democard icon="fa-file-text" text="Click button. Your PDF files will be uploaded and will be converted to format." >}}
178+
{{< blocks/products/pf/agp/democard icon="fa-download" text=" Instantly get the download link for the resultant file" >}}
179+
180+
{{< blocks/products/pf/agp/about-file-text fileFormat="PDF" readMoreLink="https://docs.fileformat.com/view/pdf/" >}}
181+
Portable Document Format (PDF) is a type of document created by Adobe back in 1990s. The purpose of this file format was to introduce a standard for representation of documents and other reference material in a format that is independent of application software, hardware as well as Operating System. PDF files can be opened in Adobe Acrobat Reader/Writer as well in most modern browsers like Chrome, Safari, Firefox via extensions/plug-ins. Most of the commercially available software suites also offer conversion of their documents to PDF file format without the requirement of any additional software component. Thus, PDF file format has full capability to contain information like text, images, hyperlinks, form-fields, rich media, digital signatures, attachments, metadata, Geospatial features and 3D objects in it that can become as part of source document.
182+
183+
{{< /blocks/products/pf/agp/about-file-text >}}
184+
185+
{{< /blocks/products/pf/agp/about-file-section >}}
186+
187+
{{< /blocks/products/pf/agp/demobox >}}
188+
189+
{{< blocks/products/pf/support-learning-resources >}}
190+
{{< blocks/products/pf/slr-tab tabTitle="Learning Resources" tabId="resources" >}}
191+
{{< blocks/products/pf/slr-element name="Documentation" href="https://docs.aspose.cloud/pdf" >}}
192+
{{< blocks/products/pf/slr-element name="Source Code" href="https://github.com/aspose-pdf-cloud/aspose-pdf-cloud-nodejs" >}}
193+
{{< blocks/products/pf/slr-element name="API References" href="https://reference.aspose.cloud/pdf/" >}}
194+
{{< /blocks/products/pf/slr-tab >}}
195+
196+
{{< blocks/products/pf/slr-tab tabTitle="Product Support" tabId="support" >}}
197+
{{< blocks/products/pf/slr-element name="Free Support" href="https://forum.aspose.cloud/c/pdf/13" >}}
198+
{{< blocks/products/pf/slr-element name="Paid Support" href="https://helpdesk.aspose.cloud" >}}
199+
{{< blocks/products/pf/slr-element name="Blog" href="https://blog.aspose.cloud/categories/aspose.pdf-cloud-product-family/" >}}
200+
{{< /blocks/products/pf/slr-tab >}}
201+
202+
{{< blocks/products/pf/slr-tab tabTitle="Why Aspose.PDF Cloud for Node.js?" tabId="success-stories" >}}
203+
{{< blocks/products/pf/slr-element name="Customers List" href="https://company.aspose.cloud/customers" >}}
204+
{{< blocks/products/pf/slr-element name="Security" href="https://company.aspose.cloud/legal/security" >}}
205+
{{< /blocks/products/pf/slr-tab >}}
206+
207+
{{< /blocks/products/pf/support-learning-resources >}}
208+
209+
<!-- aboutfile Ends -->
210+
211+
{{< /blocks/products/pf/main-container >}}
212+
213+
{{< /blocks/products/pf/main-wrap-class >}}
214+
215+

0 commit comments

Comments
 (0)