Some test text!
Welcome to PDFTron. To get started, choose your preferred platform from the tabs below.
This guide will help you run PDFTron samples and integrate a free trial of the PDFTron SDK into Node.js projects on Windows. Your free trial includes unlimited trial usage and support from solution engineers.
Install the npm package:
npm install @pdftron/pdfnet-node
If your OS or Node.js version is not supported, the installation will fail.
samples
foldersh runall.sh
You can also enter any individual sample folder to run them separately. For example, here's how to run the AddImageTest
sample:
cd AddImageTest
sh RunTest.sh
PDFTron SDK for Node.js requires a shared library in the lib
folder. There are 2 ways to do this.
DYLD_FALLBACK_LIBRARY_PATH
environment variable to include the lib
folder for the dynamic loader. To set this in a persistent manner, it can be added to ~/.bash_profile
, ortherwise it will be set in the current terminal only.export DYLD_FALLBACK_LIBRARY_PATH=<path to node_modules>/@pdftron/pdfnet-node/lib
libPDFNetC.dylib
from a pre-defined folder for shared libraries. Note that this operation will need to be performed again when upgrading to a newer version of PDFTron SDK for Node.js, otherwise the Node.js version would get out of sync with the native library.ln -s -f <path to node_modules>/@pdftron/pdfnet-node/lib/PDFNetC.dylib /usr/local/lib/PDFNetC.dylib
You can now import the PDFTron 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() => {
try {
const doc = await PDFNet.PDFDoc.create();
let page = await doc.pageCreate();
doc.pagePushBack(page);
doc.save('blank.pdf', PDFNet.SDFDoc.SaveOptions.e_linearized);
} catch (err) {
console.log(err);
}
};
PDFNet.runWithCleanup(main, 0).then(function(){PDFNet.shutdown();});
Get the answers you need: Support
Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.
Select a platform to get started with your free trial.
Web
Android
iOS
Windows
Linux
Unlimited usage. No email address required.