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. Retrieve required Link Annotation from the document using getPageLinkAnnotation() function
5
- // 6. Perform some action after successful retrieving the Link Annotation from document
6
- // All values of variables starting with "YOUR_****" should be replaced by real user values
7
-
8
- import credentials from "./credentials.json" with { type : "json" } ;
1
+ import credentials from "../../../../Credentials/credentials.json" with { type : "json" } ;
9
2
import fs from 'node:fs/promises' ;
10
3
import path from 'node:path' ;
11
- import { PdfApi } from "asposepdfcloud " ;
4
+ import { PdfApi } from "../../../src/api/api.js " ;
12
5
13
6
const configParams = {
14
7
LOCAL_FOLDER : "C:\\Samples\\" ,
15
8
PDF_DOCUMENT_NAME : "sample.pdf" ,
16
- LOCAL_RESULT_DOCUMENT_NAME : "output_sample.pdf" ,
17
- PAGE_NUMBER : 2 , // Your document page number...
18
- TABLE_ID : "GE5TCOZSGAYCYNRQGUWDINZVFQ3DGMA" ,
9
+ PAGE_NUMBER : 2 , // Your document page number...
10
+ TABLE_ID : "GE5TCOZSGAYCYNRQGUWDINZVFQ3DGMA" , // Your table id...
19
11
} ;
20
12
21
13
const pdfApi = new PdfApi ( credentials . id , credentials . key ) ;
@@ -34,7 +26,7 @@ const pdfTables = {
34
26
if ( ! Array . isArray ( resultTabs . body . tables . list ) || resultTabs . body . tables . list . length === 0 ) {
35
27
throw new Error ( "Unexpected error : tables is null or empty!!!" ) ;
36
28
}
37
- this . showLTablesInfo ( resultTabs . body . tables . list , "All tables" ) ;
29
+ this . showTablesInfo ( resultTabs . body . tables . list , "All tables" ) ;
38
30
return resultTabs . body . tables . list ;
39
31
}
40
32
else
@@ -45,14 +37,14 @@ const pdfTables = {
45
37
const resultTabs = await pdfApi . getTable ( configParams . PDF_DOCUMENT_NAME , configParams . TABLE_ID ) ;
46
38
47
39
if ( resultTabs . body . code == 200 && resultTabs . body . table ) {
48
- this . showLTablesInfo ( [ resultTabs . body . table ] , "Table by Id" ) ;
40
+ this . showTablesInfo ( [ resultTabs . body . table ] , "Table by Id" ) ;
49
41
return resultTabs . body . table ;
50
42
}
51
43
else
52
44
console . error ( "Unexpected error : can't get links!!!" ) ;
53
45
} ,
54
46
55
- showLTablesInfo ( tables , prefix ) {
47
+ showTablesInfo ( tables , prefix ) {
56
48
if ( Array . isArray ( tables ) && tables . length > 0 )
57
49
{
58
50
tables . forEach ( function ( table ) {
0 commit comments