Skip to content

Commit 430068e

Browse files
Update appendTextFooter.js
1 parent 74312e0 commit 430068e

File tree

1 file changed

+9
-14
lines changed

1 file changed

+9
-14
lines changed

UsesCases/HeaderFooter/appendTextFooter.js

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@
88
// 8. Perform some action after successful addition
99
// All values of variables starting with "YOUR_****" should be replaced by real user values
1010

11-
import credentials from "../../../Credentials/credentials.json" with { type: "json" };
11+
import credentials from "./credentials.json" with { type: "json" };
1212
import fs from 'node:fs/promises';
1313
import path from 'node:path';
14-
import { PdfApi } from "../../src/api/api.js";
15-
import { TextHeader } from "../../src/models/textHeader.js";
16-
import { TextFooter } from "../../src/models/textFooter.js";
17-
18-
import { HorizontalAlignment } from "../../src/models/horizontalAlignment.js";
14+
import { PdfApi } from "asposepdfcloud";
15+
import { TextFooter } from "asposepdfcloud/src/models/textFooter.js";
16+
import { HorizontalAlignment } from "asposepdfcloud/src/models/horizontalAlignment.js";
1917

2018
const configParams = {
2119
LOCAL_FOLDER: "C:\\Samples\\",
@@ -27,9 +25,10 @@ const configParams = {
2725
const pdfApi = new PdfApi(credentials.id, credentials.key);
2826

2927
const pdfHederFooter = {
30-
async uploadFile (fileName) {
31-
const pdfFileData = await fs.readFile(configParams.LOCAL_FOLDER + fileName);
32-
await pdfApi.uploadFile(fileName, pdfFileData);
28+
async uploadDocument() {
29+
const pdfFilePath = path.join(configParams.LOCAL_FOLDER, configParams.PDF_DOCUMENT_NAME);
30+
const pdfFileData = await fs.readFile(pdfFilePath);
31+
await pdfApi.uploadFile(configParams.PDF_DOCUMENT_NAME, pdfFileData);
3332
},
3433

3534
async downloadResult() {
@@ -39,10 +38,6 @@ const pdfHederFooter = {
3938
console.log("Downloaded: " + filePath);
4039
},
4140

42-
async uploadDocument () {
43-
await pdfHederFooter.uploadFile(configParams.PDF_DOCUMENT_NAME);
44-
},
45-
4641
async adddTextFooter () {
4742
const textFooter = new TextFooter();
4843
textFooter.background = true;
@@ -63,4 +58,4 @@ async function main() {
6358
}
6459
}
6560

66-
main();
61+
main();

0 commit comments

Comments
 (0)