From 5377df1b8f8f1c9ef4557c3bb46790132f9f97db Mon Sep 17 00:00:00 2001 From: Oleksandr Andriienko Date: Fri, 11 Oct 2024 14:46:35 +0200 Subject: [PATCH] Aspose.PDF for Node.js via C++: AsposePdfAddWatermark, AsposePdfDeleteWatermarks --- english/nodejs-cpp/_index.md | 2 + english/nodejs-cpp/organize/_index.md | 2 + .../organize/asposepdfaddwatermark/_index.md | 71 +++++++++++++++++++ .../asposepdfdeletewatermarks/_index.md | 51 +++++++++++++ 4 files changed, 126 insertions(+) create mode 100644 english/nodejs-cpp/organize/asposepdfaddwatermark/_index.md create mode 100644 english/nodejs-cpp/organize/asposepdfdeletewatermarks/_index.md diff --git a/english/nodejs-cpp/_index.md b/english/nodejs-cpp/_index.md index 3ba06a3494..d657a7bc0b 100644 --- a/english/nodejs-cpp/_index.md +++ b/english/nodejs-cpp/_index.md @@ -81,6 +81,8 @@ is_root: true | [AsposePdfValidatePDFA](./organize/asposepdfvalidatepdfa/) | Validate PDF/A compatibility a PDF-file. | | [AsposePdfFindHiddenText](./organize/asposepdffindhiddentext/) | Find hidden text in a PDF-file. | | [AsposePdfDeleteHiddenText](./organize/asposepdfdeletehiddentext/) | Delete hidden text from a PDF-file. | +| [AsposePdfAddWatermark](./organize/asposepdfaddwatermark/) | Add watermark to a PDF-file. | +| [AsposePdfDeleteWatermarks](./organize/asposepdfdeletewatermarks/) | Delete watermarks from a PDF-file. | ## Metadata PDF functions diff --git a/english/nodejs-cpp/organize/_index.md b/english/nodejs-cpp/organize/_index.md index 577bc3bbd4..c11fe99f3f 100644 --- a/english/nodejs-cpp/organize/_index.md +++ b/english/nodejs-cpp/organize/_index.md @@ -36,6 +36,8 @@ url: /nodejs-cpp/organize/ | [AsposePdfValidatePDFA](./asposepdfvalidatepdfa/) | Validate PDF/A compatibility a PDF-file. | | [AsposePdfFindHiddenText](./asposepdffindhiddentext/) | Find hidden text in a PDF-file. | | [AsposePdfDeleteHiddenText](./asposepdfdeletehiddentext/) | Delete hidden text from a PDF-file. | +| [AsposePdfAddWatermark](./asposepdfaddwatermark/) | Add watermark to a PDF-file. | +| [AsposePdfDeleteWatermarks](./asposepdfdeletewatermarks/) | Delete watermarks from a PDF-file. | ## Detailed Description diff --git a/english/nodejs-cpp/organize/asposepdfaddwatermark/_index.md b/english/nodejs-cpp/organize/asposepdfaddwatermark/_index.md new file mode 100644 index 0000000000..81e52492d3 --- /dev/null +++ b/english/nodejs-cpp/organize/asposepdfaddwatermark/_index.md @@ -0,0 +1,71 @@ +--- +title: "AsposePdfAddWatermark" +second_title: Aspose.PDF for Node.js via C++ +description: "Add watermark to a PDF-file." +type: docs +url: /nodejs-cpp/organize/asposepdfaddwatermark/ +--- + +_Add watermark to a PDF-file._ + +```js +function AsposePdfAddWatermark( + fileName, + text, + fontName, + fontSize, + foregroundColor, + xPosition, + yPosition, + rotation, + isBackground, + opacity, + fileNameResult +) +``` + +**Parameters**: + +* **fileName** file name +* **text** watermark text +* **fontName** font name +* **fontSize** font size +* **foregroundColor** text color (hexadecimal format "#RRGGBB", where RR-red, GG-green and BB-blue hexadecimal integers) +* **xPosition** x watermark position +* **yPosition** y watermark position +* **rotation** watermark rotation (0-360) +* **isBackground** background (1 or 0) +* **opacity** opacity (decimal) +* **fileNameResult** result file name + +**Return**: + +JSON object + +* **errorCode** - code error (0 no error) +* **errorText** - text error ("" no error) +* **fileNameResult** - result file name + + +**CommonJS**: + +```js +const AsposePdf = require('asposepdfnodejs'); +const pdf_file = 'Aspose.pdf'; +AsposePdf().then(AsposePdfModule => { + /*Add watermark to a PDF-file and save the "ResultWatermark.pdf"*/ + const json = AsposePdfModule.AsposePdfAddWatermark(pdf_file, "Aspose PDF", "Arial", 32, "#010101", 100, 100, 45, 1, 0.5, "ResultAddWatermark.pdf"); + console.log("AsposePdfAddWatermark => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText); +}); +``` + +**ECMAScript/ES6**: + +```js +import AsposePdf from 'asposepdfnodejs'; +const AsposePdfModule = await AsposePdf(); +const pdf_file = 'Aspose.pdf'; +/*Add watermark to a PDF-file and save the "ResultWatermark.pdf"*/ +const json = AsposePdfModule.AsposePdfAddWatermark(pdf_file, "Aspose PDF", "Arial", 32, "#010101", 100, 100, 45, 1, 0.5, "ResultAddWatermark.pdf"); +console.log("AsposePdfAddWatermark => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText); +``` \ No newline at end of file diff --git a/english/nodejs-cpp/organize/asposepdfdeletewatermarks/_index.md b/english/nodejs-cpp/organize/asposepdfdeletewatermarks/_index.md new file mode 100644 index 0000000000..3dc7db9439 --- /dev/null +++ b/english/nodejs-cpp/organize/asposepdfdeletewatermarks/_index.md @@ -0,0 +1,51 @@ +--- +title: "AsposePdfDeleteWatermarks" +second_title: Aspose.PDF for Node.js via C++ +description: "Delete watermarks from a PDF-file." +type: docs +url: /nodejs-cpp/organize/asposepdfdeletewatermarks/ +--- + +_Delete watermarks from a PDF-file._ + +```js +function AsposePdfDeleteWatermarks( + fileName, + fileNameResult +) +``` + +**Parameters**: + +* **fileName** file name +* **fileNameResult** result file name + +**Return**: +JSON object + * **errorCode** - code error (0 no error) + * **errorText** - text error ("" no error) + * **fileNameResult** - result file name + + +**CommonJS**: + +```js +const AsposePdf = require('asposepdfnodejs'); +const pdf_file = 'Aspose.pdf'; +AsposePdf().then(AsposePdfModule => { + /*Delete watermarks from a PDF-file and save the "ResultPdfDeleteWatermarks.pdf"*/ + const json = AsposePdfModule.AsposePdfDeleteWatermarks(pdf_file, "ResultPdfDeleteWatermarks.pdf"); + console.log("AsposePdfDeleteWatermarks => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText); +}); +``` + +**ECMAScript/ES6**: + +```js +import AsposePdf from 'asposepdfnodejs'; +const AsposePdfModule = await AsposePdf(); +const pdf_file = 'Aspose.pdf'; +/*Delete watermarks from a PDF-file and save the "ResultPdfDeleteWatermarks.pdf"*/ +const json = AsposePdfModule.AsposePdfDeleteWatermarks(pdf_file, "ResultPdfDeleteWatermarks.pdf"); +console.log("AsposePdfDeleteWatermarks => %O", json.errorCode == 0 ? json.fileNameResult : json.errorText); +``` \ No newline at end of file