
How to convert PDF to JPEG Image using Node.js.
The Portable Document Format (PDF) is widely used for secure document sharing and printing. However, when you need to preview content or extract visuals, converting PDF to raster image formats like JPG, PNG, or BMP becomes helpful.
In this article, we’ll walk you through how to convert PDF to JPG using Aspose.PDF Cloud SDK for Node.js.
PDF to JPG Conversion API
Aspose.PDF Cloud is a RESTful API that allows you to create, manipulate, and convert PDF documents in the cloud. No desktop installation is required — it’s accessible on any platform (Linux, Windows, macOS) and compatible with web, mobile, or server-side apps. You may further considering exploring the features of REST API in API documentation page.
Installing Aspose.PDF SDK for Node.js
To get started, install the official Node.js SDK via npm:
> npm i asposepdfcloud
Create a free account on Aspose.Cloud dashboard and obtain your Client ID and Client Secret for authentication.
How to Convert PDF to JPG in Node.js
Follow the steps below to convert PDF pages to JPG in Node.js:
- Initialize the
PdfApi
with your credentials.- Define the source PDF file and output settings.
- Call the PutPageConvertToJpeg(…) API routine to convert the PDF page to JPG image.

Image:- A preview of PDF to JPG conversion.
PDF to JPG via cURL Command
Our Cloud APIs are built on REST architecture, so you may consider accessing them via cURL commands. Our APIs provide a powerful cloud-based solution with a range of benefits for PDF file processing in the cloud. By using the cURL commands, you can effortlessly initiate the PDF to JPG conversions routine. So, first we need to generate a JSON Web Token (JWT) based on ClientID and ClientSecret details retrieved from Aspose.Cloud dashboard. Please execute the following command in the terminal to generate the JWT token.
curl -v "https://api.aspose.cloud/connect/token" \
-X POST \
-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \
-H "Content-Type: application/x-www-form-urlencoded" \
-H "Accept: application/json"
Now that we have a JWT token, please execute the following cURL command to perform PDF to JPG conversion online. The resultant JPG is returned in response object. However, in order to save the resultant JPG to local drive, please try using the -o
argument.
curl -X GET "https://api.aspose.cloud/v3.0/pdf/converted.pdf/pages/1/convert/jpeg?width=800&height=800" \
-H "accept: multipart/form-data" \
-H "authorization: Bearer <JWT Token>" \
-o myResultant.jpg
Free PDF to JPG Converter App
To experience the amazing capabilities of Aspose.PDF Cloud API, you may consider using our free PDF to JPG converter. It’s a lightweight solution and is built as per Cloud REST API.

Free PDF to JPG converter App.
Useful Links
Conclusion
In this article, you learned how to convert PDF to JPG using Node.js with just a few lines of code. With Aspose.PDF Cloud, no additional software like Adobe Acrobat is required. You can also achieve the same with a simple cURL command — perfect for automation or server-side workflows.
Related Art1icles
You may consider visiting following links to learn more about: