Skip to content

Commit 5ad4f2f

Browse files
Update getTablesAndShow.js
1 parent f5eb1e2 commit 5ad4f2f

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

UsesCases/Tables/get/getTablesAndShow.js

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
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" };
92
import fs from 'node:fs/promises';
103
import path from 'node:path';
11-
import { PdfApi } from "asposepdfcloud";
4+
import { PdfApi } from "../../../src/api/api.js";
125

136
const configParams = {
147
LOCAL_FOLDER: "C:\\Samples\\",
158
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...
1911
};
2012

2113
const pdfApi = new PdfApi(credentials.id, credentials.key);
@@ -34,7 +26,7 @@ const pdfTables = {
3426
if (!Array.isArray(resultTabs.body.tables.list) || resultTabs.body.tables.list.length === 0) {
3527
throw new Error("Unexpected error : tables is null or empty!!!");
3628
}
37-
this.showLTablesInfo(resultTabs.body.tables.list, "All tables");
29+
this.showTablesInfo(resultTabs.body.tables.list, "All tables");
3830
return resultTabs.body.tables.list;
3931
}
4032
else
@@ -45,14 +37,14 @@ const pdfTables = {
4537
const resultTabs = await pdfApi.getTable(configParams.PDF_DOCUMENT_NAME, configParams.TABLE_ID);
4638

4739
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");
4941
return resultTabs.body.table;
5042
}
5143
else
5244
console.error("Unexpected error : can't get links!!!");
5345
},
5446

55-
showLTablesInfo(tables, prefix) {
47+
showTablesInfo(tables, prefix) {
5648
if (Array.isArray(tables) && tables.length > 0)
5749
{
5850
tables.forEach(function(table) {

0 commit comments

Comments
 (0)