Skip to main content

Convert Images to PDFs

Convert images to PDF using the pdf endpoint.

The pdf endpoint makes converting images to PDF a breeze. Supported image types include the following nine common image types: JPEG, PNG, BMP, EMF, WMF, EXIF, JPEG2000, GIF, and TIFF.

The following examples illustrate converting a TIFF and a PNG image to a combined PDF.


You can also add an image to a PDF you create from scratch or add to an existing PDF.


Check out Getting Started and Task Roadmap if you are new to The DynamicPDF API.


See the image input type documentation for more information.

Calling Endpoint Directly

The following JSON instructions document illustrates converting two different images to a combined PDF.

"author": "CeteSoftware",
"creator": "DynamicPDF Cloud Api",
"inputs": [
"type": "image",
"pageWidth": 612,
"align": "center",
"vAlign": "center"
"type": "image",
"pageWidth": 1008,
"align": "center",
"vAlign": "center"

Run In Postman

curl --location ''
--header 'Authorization: Bearer DP.BKMFqqItEDZb9iBeSAJvzZAgqhH6oyY9SBiKezfyw+rTRosKxx0oD9f9'
--form 'Instructions=@C:/temp/solutions/image-conversion/instructions.json'
--form 'Resource=@C:/temp/solutions/image-conversion/testimage.tif'
--form 'Resource=@C:/temp/solutions/image-conversion/dynamicpdfLogo.png'

Calling Endpoint Using Client Library

The following examples illustrate converting two images to a combined PDF using the six different client libraries.

public static void Run(string apiKey, string basePath, string outputPath)
Pdf pdf = new Pdf();
pdf.ApiKey = apiKey;

ImageResource imageResource = new ImageResource(basePath + "testimage.tif");
ImageInput imageInput = pdf.AddImage(imageResource);
imageInput.Align = Align.Center;
imageInput.VAlign = VAlign.Center;
imageInput.ExpandToFit = false;
imageInput.PageHeight = 1008;
imageInput.PageWidth = 612;

ImageResource imageResourceTwo = new ImageResource(basePath + "dynamicpdfLogo.png");
ImageInput imageInputTwo = pdf.AddImage(imageResourceTwo);

imageInputTwo.Align = Align.Center;
imageInputTwo.VAlign = VAlign.Center;
imageInputTwo.ExpandToFit = true;
imageInputTwo.PageHeight = 612;
imageInputTwo.PageWidth = 1008;

PdfResponse pdfResponse = pdf.Process();

if (pdfResponse.IsSuccessful)
File.WriteAllBytes(outputPath + "/convert-img-to-pdf-output.pdf", pdfResponse.Content);
Source: ImageConversion.cs

The pdf endpoint takes a JSON instructions document that provides instructions for creating, transforming, merging, and formatting inputs into a combined PDF. Refer to documentation on the instructions schema for information on how to use the pdf endpoint.