PDF to Image HTTP API Examples
These examples demonstrate common PDF to Image API workflows via HTTP API.
You can run the examples below with the displayed API credentials. Update the input URLs and filenames as needed.
Basic examples
Convert a PDF file to PNG images
Upload invoice.pdf and save its PNG page images in invoice.zip.
curl -f -s -S \ -u 'demo:demo' \ -o invoice.zip \ -F file=@invoice.pdf \ -F input_format=pdf \ -F output_format=png \ -F force_zip=true \ https://api.pdfcrowd.com/convert/24.04/
Convert a PDF URL to PNG images
Fetch the PDF from its URL and save its PNG page images in invoice.zip.
curl -f -s -S \ -u 'demo:demo' \ -o invoice.zip \ -F url=https://your-server.com/invoice.pdf \ -F input_format=pdf \ -F output_format=png \ -F force_zip=true \ https://api.pdfcrowd.com/convert/24.04/
Customize page images
These examples use report.pdf, a three-page document with text, a chart, and vector graphics. The CropBox variant uses cropbox.pdf, a page with a predefined crop boundary.
Create page previews
Render page 1 of report.pdf directly as a PNG. Use 72 DPI for a compact preview or 300 DPI for more detail at higher pixel dimensions and file size. Selecting one page produces an image file without ZIP packaging.
Compact preview at 72 DPI:
curl -f -s -S \ -u 'demo:demo' \ -o preview.png \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=png \ -F dpi=72 \ -F print_page_range=1 \ https://api.pdfcrowd.com/convert/24.04/
High-resolution image at 300 DPI:
curl -f -s -S \ -u 'demo:demo' \ -o page-300dpi.png \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=png \ -F dpi=300 \ -F print_page_range=1 \ https://api.pdfcrowd.com/convert/24.04/
Render selected pages
Render pages 1 and 3 of report.pdf as PNG images in selected-pages.zip. Force ZIP packaging so the result stays an archive even if you later select just one page.
curl -f -s -S \ -u 'demo:demo' \ -o selected-pages.zip \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=png \ -F force_zip=true \ -F print_page_range=1,3 \ https://api.pdfcrowd.com/convert/24.04/
Export a JPEG
Convert page 1 of report.pdf into page.jpg for applications that need JPEG input. JPEG is lossy and is not always smaller than PNG, especially for pages dominated by text and flat graphics.
curl -f -s -S \ -u 'demo:demo' \ -o page.jpg \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=jpg \ -F print_page_range=1 \ https://api.pdfcrowd.com/convert/24.04/
Crop page images
Extract the chart from page 1 of report.pdf into chart.png, or honor the predefined CropBox in cropbox.pdf to remove its production margins.
The chart example fixes 144 DPI and uses pixel coordinates from the rendered page's top-left corner: X = 96, Y = 370, width = 1024, height = 384. Adjust the coordinates when changing the page layout or DPI. The CropBox variant uses the boundary already stored in the PDF.
Extract a chart region:
curl -f -s -S \ -u 'demo:demo' \ -o chart.png \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=png \ -F crop_area_height=384 \ -F crop_area_width=1024 \ -F crop_area_x=96 \ -F crop_area_y=370 \ -F dpi=144 \ -F print_page_range=1 \ https://api.pdfcrowd.com/convert/24.04/
Use the PDF's CropBox:
curl -f -s -S \ -u 'demo:demo' \ -o cropped-page.png \ -F file=@cropbox.pdf \ -F input_format=pdf \ -F output_format=png \ -F print_page_range=1 \ -F use_cropbox=true \ https://api.pdfcrowd.com/convert/24.04/
Create a grayscale image
Render page 1 of report.pdf into grayscale.png, replacing colors with shades of gray while preserving the page dimensions.
curl -f -s -S \ -u 'demo:demo' \ -o grayscale.png \ -F file=@report.pdf \ -F input_format=pdf \ -F output_format=png \ -F print_page_range=1 \ -F use_grayscale=true \ https://api.pdfcrowd.com/convert/24.04/