Programmable Media

Create PDF files from images

Last updated: Jul-11-2024

You can create a PDF file from images stored in your Cloudinary storage. Identify the images you want to include in the PDF by applying the same tag to each of the images. In the resulting PDF, they are ordered alphabetically by public ID with a page per image.

Important

To reduce the chances of malware or other potentially harmful files being distributed via the Cloudinary domain, PDFs (and certain other file formats) are blocked for delivery by default for FREE accounts. To deliver PDFs, make sure the Allow delivery of PDF and ZIP files option is selected in the Security page of the Console Settings.

Tip

This page describes how to create a PDF from multiple files with a backend API call.

You can also generate and deliver a PDF file from a single image as an on-the-fly transformation by just changing the delivery URL file extension (or setting the format parameter) to pdf, along with any image transformations you might want to apply. For details, see Delivering images in a different format.

Create the PDF

Use the multi method of the Upload API to create the PDF file. PDF files can be created from a maximum of 500 images if processed asynchronously (async parameter = true) or a maximum of 100 if synchronously (async = false). If the limit is exceeded, only the first 500 (or 100) images will be included.

For example, to create a PDF file from a set of images that each have the tag "topic", use the multi method, specifying the format as pdf, and optionally add some transformations to each of the images that are added:

Deliver the PDF

To deliver the PDF, use the Cloudinary image delivery URL with type set to multi. For example, to deliver the PDF created from all images with the tag topic:

Learn more about the multi method in the Upload API reference.

Important
By combining multiple images in this way, the resulting PDF may exceed the maximum file size allowed in your plan, in which case you will see the error, "File size too large." Consider using a transformation on each of the images, using the transformation parameter, to reduce the size of the images so as to reduce the size of the resulting PDF file.

✔️ Feedback sent!

Rate this page: