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" } ;
10
2
import fs from 'node:fs/promises' ;
11
3
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" ;
14
8
15
9
const configParams = {
16
10
LOCAL_FOLDER : "C:\\Samples\\" ,
@@ -32,6 +26,7 @@ const pdfStamps = {
32
26
const fileNamePath = path . join ( configParams . LOCAL_FOLDER , fileName ) ;
33
27
const pdfFileData = await fs . readFile ( fileNamePath ) ;
34
28
await pdfApi . uploadFile ( fileName , pdfFileData ) ;
29
+ console . log ( "File '" + fileName + "' successfully uploaded!" ) ;
35
30
} ,
36
31
37
32
async downloadResult ( ) {
@@ -54,11 +49,9 @@ const pdfStamps = {
54
49
textStamp . value = configParams . TEXT_STAMP_VALUE ;
55
50
56
51
const imageStamp = new Stamp ( ) ;
57
- imageStamp . type = StampType . Image ;
52
+ imageStamp . type = StampType . Image ;
58
53
imageStamp . background = true ;
59
54
imageStamp . horizontalAlignment = HorizontalAlignment . Center ;
60
- imageStamp . textAlignment = HorizontalAlignment . Center ;
61
- imageStamp . value = configParams . IMAGE_TEXT_STAMP_VALUE ;
62
55
imageStamp . fileName = configParams . IMAGE_STAMP_FILE ;
63
56
imageStamp . yIndent = configParams . IMAGE_STAMP_LLY ;
64
57
imageStamp . width = configParams . IMAGE_STAMP_WIDTH ;
0 commit comments