Skip to content

Commit 4b36ed0

Browse files
Update appendDocumentStamps.js
1 parent 0518c8f commit 4b36ed0

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

UsesCases/Stamps/add/appendDocumentStamps.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
// 1. Load your Application Secret and Key from the JSON file or set credentials in another way
2-
// 2. Create an object to connect to the Pdf.Cloud API
3-
// 3. Upload your document file
4-
// 4. Create a new Link Annotation with the required properties
5-
// 5. Append new Link Annotation to the document using postPageLinkAnnotations() function
6-
// 6. Perform some action after successful addition
7-
// All values of variables starting with "YOUR_****" should be replaced by real user values
8-
9-
import credentials from "./credentials.json" with { type: "json" };
1+
import credentials from "../../../../Credentials/credentials.json" with { type: "json" };
102
import fs from 'node:fs/promises';
113
import path from 'node:path';
12-
import { PdfApi } from "asposepdfcloud";
13-
import { Stamp } from "asposepdfcloud/src/models/stamp.js";
4+
import { PdfApi } from "../../../src/api/api.js";
5+
import { Stamp } from "../../../src/models/stamp.js";
6+
import { StampType } from "../../../src/models/stampType.js";
7+
import { HorizontalAlignment } from "../../../src/models/horizontalAlignment.js";
148

159
const configParams = {
1610
LOCAL_FOLDER: "C:\\Samples\\",
@@ -32,6 +26,7 @@ const pdfStamps = {
3226
const fileNamePath = path.join(configParams.LOCAL_FOLDER, fileName);
3327
const pdfFileData = await fs.readFile(fileNamePath);
3428
await pdfApi.uploadFile(fileName, pdfFileData);
29+
console.log("File '" + fileName + "' successfully uploaded!");
3530
},
3631

3732
async downloadResult () {
@@ -54,11 +49,9 @@ const pdfStamps = {
5449
textStamp.value = configParams.TEXT_STAMP_VALUE;
5550

5651
const imageStamp = new Stamp();
57-
imageStamp.type = StampType.Image;
52+
imageStamp.type =StampType.Image;
5853
imageStamp.background = true;
5954
imageStamp.horizontalAlignment = HorizontalAlignment.Center;
60-
imageStamp.textAlignment = HorizontalAlignment.Center;
61-
imageStamp.value = configParams.IMAGE_TEXT_STAMP_VALUE;
6255
imageStamp.fileName = configParams.IMAGE_STAMP_FILE;
6356
imageStamp.yIndent = configParams.IMAGE_STAMP_LLY;
6457
imageStamp.width = configParams.IMAGE_STAMP_WIDTH;

0 commit comments

Comments
 (0)