Welcome to Apryse. Node.js for the Apryse SDK is supported on Windows, Linux and macOS. To get started, 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 Windows. Your free trial includes unlimited trial usage and support from solution engineers.
A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
Please note that all Apryse NodeJS libraries install native binaries and installing the package will install a system specific distribution.
If your OS or Node.js version is not supported, the installation will fail.
2. Get your Apryse trial key.
The Apryse SDK requires a license key. it's free to get a trial one.
Apryse collects some data regarding your usage of the SDK for product improvement.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
The samples are not included with the pdfnet-node package, and need to be downloaded separately.
Open a command line console, and run
Change the directory to the node_modules/@pdftron/pdfnet-node-samples
folder
The Apryse SDK requires a license key. Open the file LicenseKey.js, and paste the license key into it.
LicenseKey.js
While you can run samples individually, you can also run all of them together using a script that is in package.json.
If you want to run a sample individually, then navigate to its folder, then use node to run the JavaScript file. For example, here's how to run the AddImageTest
sample:
You can now import the Apryse SDK by using the following in your Node.js code:
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:
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.
A commercial license key is required for use in a production environment. Please fill out our licensing form if you do not have a valid license key.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
1. Install the npm package:
Please note that all Apryse NodeJS libraries install native binaries and installing the package will install a system specific distribution.
If using Alpine Linux you will have to include a target platform specifier to ensure you recieve the correct binaries.
If your OS or Node.js version is not supported, the installation will fail.
2. Get your Apryse trial key.
Apryse collects some data regarding your usage of the SDK for product improvement.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
The samples are not included with the pdfnet-node package, and need to be downloaded separately.
Open a command line console, and run
Change the directory to the node_modules/@pdftron/pdfnet-node-samples
folder
The Apryse SDK requires a license key. Open the file LicenseKey.js, and paste the license key into it.
While you can run samples individually, you can also run all of them together using a script that is in package.json.
If you want to run a sample individually, then navigate to its folder, then use node to run the JavaScript file. For example, here's how to run the AddImageTest
sample:
You can now import the Apryse SDK by using the following in your Node.js code:
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:
In this particular guide, we will demonstrate how to set up an AWS Lambda function to use the Apryse SDK with Node.js.
First, you will have to prepare a deployment package with the pdfnet-node
module and your Lambda function code (typically named index.js
) within it. From the command line:
Now, copy your lambda function code to YOUR_FUNCTION_FOLDER
.
It's at this point that it is important to note that the pdfnet-node
module must be installed using the same operating system that AWS Lambda will use for its runtime. This is dependent on on the version of Node.js you are using. To see which operating system is required, look here.
We recommend that you use a Docker container to simulate this runtime and have included a Dockerfile to do just that. Create a Dockerfile with the contents below.
Dockerfile
Next, run the following docker commands to generate a deployment package to upload to AWS Lambda. Replace YOUR_IMAGE_NAME_HERE
with the image name of your choice, as well as YOUR_NODE_VERSION_HERE
as the Node version of your choice. YOUR_NODE_VERSION_HERE
as the Node version of your choice. Note that this Dockerfile requires that your AWS Lambda function code file be named index.js
, and that it uses your project's package.json and package-lock.json to install dependencies such as the pdfnet-node
module you installed in the last step.
After running this Docker container, you should have your deployment package within the ./output directory and can now upload it to AWS Lambda.
Second, create a Lambda function in your AWS account and upload the deployment package:
YOUR_FUNCTION_NAME
] > Runtime (matching your Node version) > choose Create FunctionOnce you have followed the initial setup instructions, you can begin calling Apryse SDK APIs in your Lambda function code. For example:
You can update the Node.js script of your AWS Lambda function with the following code or download the source code from our GitHub repository. This snippet shows how to process a request sent from a client, convert an office document to a PDF, and send the output to client.
After you have uploaded your deployment package to AWS Lambda and set its API endpoint
in Configuration > Triggers, you can now do a simple test using a REST API.
In order to use the function to convert an office document to PDF, the client needs to POST
a REST API request to the server. The request must include JSON data structured as in the code below.
Upon receiving a client's request, a response will be sent back to the client including the base64 encoded PDF output using the same JSON structure. All the client needs to do now is decode the encoded data into a PDF. That's it!
Please review the sample python code. After cloning the repository and installing necessary packages, please refer to /client/README.txt
for detailed instructions. Navigate to the client
folder, run the following command, see the response to client's request in the console, and check the output in the output
folder:
The client will send a REST API request to convert /input/simple-word_2007.docx
to a PDF and the server will send back the encoded data, which will then be saved as PDF in the output
folder.
You can experiment with your own office document by putting it inside input
folder:
In this article, we have shown how to set up an AWS Lambda function using the Apryse SDK. You can now experiment making your own functions, URLs, and can fully utilize the Apryse SDK using AWS Lambda. If your have any questions, please don't hesitate to contact us!
This guide will help you run Apryse samples and integrate a free trial of the Apryse SDK into Node.js projects on macOS. Your free trial includes unlimited trial usage and support from solution engineers.
A commercial license key is required for use in a production environment. Please contact sales to purchase a commercial key or if you need any other license key assistance.
License keys are uniquely generated. Please make sure that it is not publicly available (e.g. in your public GitHub).
Please note that all Apryse NodeJS libraries install native binaries and installing the package will install a system specific distribution.
If your OS or Node.js version is not supported, the installation will fail.
2. Get your Apryse trial key.
The Apryse SDK requires a license key. it's free to get a trial one.
Apryse collects some data regarding your usage of the SDK for product improvement.
If you wish to continue without data collection, contact us and we will email you a no-tracking trial key for you to get started.
The samples are not included with the pdfnet-node package, and need to be downloaded separately.
Open a command line console, and run
Change the directory to the node_modules/@pdftron/pdfnet-node-samples
folder
The Apryse SDK requires a license key. Open the file LicenseKey.js, and paste the license key into it.
While you can run samples individually, you can also run all of them together using a script that is in package.json.
If you want to run a sample individually, then navigate to its folder, then use node to run the JavaScript file. For example, here's how to run the AddImageTest
sample:
You can now import the Apryse SDK by using the following in your Node.js code:
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:
Did you find this helpful?
Trial setup questions?
Ask experts on DiscordNeed other help?
Contact SupportPricing or product questions?
Contact Sales