Some test text!
Nodejs / Guides
Platform
Documentation
To get started with Node.js, choose your preferred platform from the tabs below.
This guide will help you run Apryse samples and integrate a free trial of the Apryse SDK into Node.js projects on Linux or help you set up Apryse SDK serverless AWS Lambda functions. Your free trial includes unlimited trial usage and support from solution engineers.
Node.js
AWS Lambda Functions
npm i @pdftron/pdfnet-node
If your OS or Node.js version is not supported, the installation will fail.
npm i @pdftron/pdfnet-node-samples
node_modules/@pdftron/pdfnet-node-samples
foldernpm run test
You can also enter any individual sample folder to run them separately. For example, here's how to run the AddImageTest
sample:
cd ./samples/AddImageTest
node AddImageTest.js
Import the Apryse SDK by using the following in your Node.js code:
const { PDFNet } = require('@pdftron/pdfnet-node');
At the end of your code, don't forget to call PDFNet.shutdown()
, otherwise your Node.js program will keep hanging.
Here is an example for creating a blank pdf page:
const { PDFNet } = require('@pdftron/pdfnet-node'); // you may need to set up NODE_PATH environment variable to make this work.
const main = async() => {
const doc = await PDFNet.PDFDoc.create();
const page = await doc.pageCreate();
doc.pagePushBack(page);
doc.save('blank.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
};
// add your own license key as the second parameter, e.g. in place of 'YOUR_LICENSE_KEY'.
PDFNet.runWithCleanup(main, 'YOUR_LICENSE_KEY').catch(function(error) {
console.log('Error: ' + JSON.stringify(error));
}).then(function(){ PDFNet.shutdown(); });
Get the answers you need: Support