Convert images to PDF
Welcome to the Convert Images to PDF guide. This guide will teach you how to convert one or more images to PDF easily.
Remember that all Tool Guides takes into account that you have previous knowledge about the Basics to process a PDF with our REST API. We strongly recommend you to read the related guide before start with this one.
Basic Convert images to PDF
You can easily convert JPG, PNG and TIFF images to a PDF files like this:
You will have as a result two PDF files with a single page with your image on it.
Advanced Convert images to PDF
You can customize some options of your JPG converted to PDF files with the following functions:
Change PDF orientation
With setOrientation('orientation') you can change your final PDF file from portrait to landscape and vice versa. This may be useful depending on the size ratio of your converted images. But remember, this function will change the orientation of your final PDF file, if you wish to rotate your images before convert them to PDF you must use setRotation() function to every uploaded file as we have seen in previous guides.
There are four rotation orientations to choose:
Set page margin
setMargin() allows you to set a margin between the PDF page and its contained image. If you don’t set any margin, your final PDF will be as big as the original image.
Set page size
One way to assure that your final PDF have a document size is to force it with with setPageSize(). You have three standard size to choose:
- setPageSize('A4'). Your final document will have an A4 standard size and your image will fit in that size.
- setPageSize('letter'). Your final document will have Letter standard size and your image will fit in that size.
- setPageSize('fit'). Your final document will have the same size as the original image. This is the default option.
Merge all images in a single PDF
mergeAfter(true) will serve all converted images in a single PDF. Note that this, combined with setPageSize(), will have different results.
That is all you can do with Image to PDF converting.