The image-to-PDF API enables you to convert supported image formats (JPG, PNG, GIF, TIFF, and more) to PDF documents.

Converting a single image to PDF

Convert a single image to a PDF by placing a page1.jpg file in the same folder as your code. You can use any image or use our provided sample page.

Run the code to generate a result.pdf file with your image converted to PDF:

Terminal window
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer your_api_key_here" \
-o result.pdf \
--fail \
-F page1.jpg=@/path/to/page1.jpg \
-F instructions='{
"parts": [
{
"file": "page1.jpg"
}
]
}'

Combining multiple images into a PDF

To combine multiple images (for example, from a scanned document) into a single PDF, pass multiple images in your request — one for each page. Nutrient DWS API merges them into a single PDF.

Add more files in the same folder as your code and run the updated code. You can duplicate and rename your existing file, or add other images:

Terminal window
curl -X POST https://api.nutrient.io/build \
-H "Authorization: Bearer your_api_key_here" \
-o result.pdf \
--fail \
-F page1.jpg=@/path/to/page1.jpg \
-F page2.jpg=@/path/to/page2.jpg \
-F page3.jpg=@/path/to/page3.jpg \
-F page4.jpg=@/path/to/page4.jpg \
-F instructions='{
"parts": [
{
"file": "page1.jpg"
},
{
"file": "page2.jpg"
},
{
"file": "page3.jpg"
},
{
"file": "page4.jpg"
}
]
}'