Skip to content

Commit c3e8820

Browse files
Update appendDocumentStamps.js
1 parent 4dbf1b1 commit c3e8820

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

UsesCases/Stamps/add/appendDocumentStamps.js

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ const configParams = {
1818
IMAGE_STAMP_FILE: "sample.png",
1919
LOCAL_RESULT_DOCUMENT_NAME: "output_sample.pdf",
2020
PAGE_NUMBER: 2, // Your document page number...
21+
TEXT_STAMP_VALUE: "NEW TEXT STAMP",
22+
IMAGE_TEXT_STAMP_VALUE: "NEW IMAGE STAMP",
2123
IMAGE_STAMP_LLY: 800,
2224
IMAGE_STAMP_WIDTH: 24,
2325
IMAGE_STAMP_HEIGHT: 24,
@@ -45,22 +47,22 @@ const pdfStamps = {
4547

4648
async addStamps () {
4749
const textStamp = new Stamp();
48-
textStamp.type = "Text";
50+
textStamp.type = StampType.Text;
4951
textStamp.background = true;
50-
textStamp.horizontalAlignment = "Center";
51-
textStamp.textAlignment = "Center";
52-
textStamp.value = "NEW TEXT STAMP";
52+
textStamp.horizontalAlignment = HorizontalAlignment.Center;
53+
textStamp.textAlignment = HorizontalAlignment.Center;
54+
textStamp.value = configParams.TEXT_STAMP_VALUE;
5355

5456
const imageStamp = new Stamp();
55-
imageStamp.type = "Image";
56-
imageStamp.background = true;
57-
imageStamp.horizontalAlignment = "Center";
58-
imageStamp.textAlignment = "Center";
59-
imageStamp.value = "NEW IMAGE STAMP";
60-
imageStamp.fileName = configParams.IMAGE_STAMP_FILE;
61-
imageStamp.yIndent = configParams.IMAGE_STAMP_LLY;
62-
imageStamp.width = configParams.IMAGE_STAMP_WIDTH;
63-
imageStamp.height = configParams.IMAGE_STAMP_HEIGHT;
57+
imageStamp.type =StampType.Image;
58+
imageStamp.background = true;
59+
imageStamp.horizontalAlignment = HorizontalAlignment.Center;
60+
imageStamp.textAlignment = HorizontalAlignment.Center;
61+
imageStamp.value = configParams.IMAGE_TEXT_STAMP_VALUE;
62+
imageStamp.fileName = configParams.IMAGE_STAMP_FILE;
63+
imageStamp.yIndent = configParams.IMAGE_STAMP_LLY;
64+
imageStamp.width = configParams.IMAGE_STAMP_WIDTH;
65+
imageStamp.height = configParams.IMAGE_STAMP_HEIGHT;
6466

6567
const addResult = await pdfApi.postDocumentTextStamps(configParams.PDF_DOCUMENT_NAME, [ textStamp ])
6668
.then(async () => {

0 commit comments

Comments
 (0)