Skip to main content
Version: 9.0

Graphic formats

webPDF can convert a large number of graphic formats (images), such as JPEG, TIFF, PNG into PDF documents. Thereby the quality of the graphics (raster/pixel graphics) in the PDF documents can be influenced differently, depending on the source format. Depending on the graphics format, different restrictions also apply or certain parameters (such as page sizes or margins) may or may not be applicable.

When converting images into a PDF, the images are stored as separate objects (so-called "XObjects") in the PDF. These are the raw binary data for the image. However, the images are not stored (embedded) in the PDF in a concrete format, such as TIF, GIF, PNG. So it is usually not an image in the sense of a TIF or JPEG image, but it is the binary data for the pixels, the color space used for the image, and other information about the image.

tip

For more information on graphics (images), the definition in PDF format and "XObject", please also refer to the PDF specification "PDF 32000-1:2008" in chapter "9. Images".

The actual pixel data can be compressed. One of the compression formats is the same as in a JPEG (JPX is the same as Jpeg2000), which often mistakenly equates saving images in PDF document with JPEG format. When you save this data, it can be opened as a JPEG file, but it may need to be modified to include the color space data, i.e. the format must be "completed" again.

Image quality

The quality of the image can therefore basically not be better than the pixel data of the original format already provides. The quality of the image in the PDF can therefore ideally be "lossless" compared to the original or can be reduced if this is set via the corresponding jpegQuality parameter.

If graphic formats are to be saved unchanged (in their original format) in a PDF, then they must be saved as an attachment in the PDF ("Toolbox" web service) and must not be converted ("Converter" web service).

In addition to the quality of the image at the pixel level, the DPI (dots per inch) with which an image is displayed on a corresponding output device (usually a printer) has an influence on the output quality. Some formats already provide this information via the metadata of the graphic format. This information, if available, is taken into account by webPDF for most formats. The (paper) size of the created PDF document is based on this specification and thus determined the size of the graphic in the PDF document.

This value can be adjusted during conversion via the dpi parameter (if reduceResolution is activated). Please note, however, that this does not improve the quality of the image (in terms of the information content of the pixels), but merely adjusts the number of pixels per unit (inch) used on the output device.

caution

It is generally recommended not to make any DPI changes to the image. Leave the reduceResolution value set to false.

If the DPI value is increased, then webPDF tries to increase the number of pixels in an image via interpolation. If the DPI value is reduced, then webPDF tries to scale down, i.e. reduce pixels, which leads to a loss of information (in the pixels). However, the output size in the PDF remains the same. Only the number of pixels per unit - i.e. "dots per inch" - used for the output increases. Visually, this can lead to a (perceived) improvement, but in terms of content, the quality of the image (in terms of the information content of the pixels) is not improved.

For some graphic formats, webPDF can obtain the DPI from the metadata and then calculates the page size in the PDF document. If this information is not available, then 72 DPI (default of the PDF format) is assumed.

Page size and margins

When converting graphics, the size of the page in the PDF document is calculated based on the DPI specifications of the image. If such information is available in the image metadata, it will be used to calculate the page size. If this information is missing, then 72 DPI (default of the PDF format) is assumed as default.

Example: An image with 100 x 100 pixels and a specification of 200 DPI results in a page size of 1.3 x 1.3 cm in the PDF document.

When converting graphics, no predefined page size and no margins are used as default setting (element page is not set in parameters) . However, you can force the page size for the output if you set a paper size during the conversion using page. For some formats you can also define the page margin.

If a page size is forced during conversion, then the graphic will be scaled to the page size (without preserving the proportions).

Specification of pages

When converting graphics, usually no specification of pages is needed and should therefore remain on the default or on *. However, there are file formats, such as TIFF or HEIC/HEIF, which can also contain several graphics. If you want to convert a specific graphic from these formats, you can select the corresponding graphic via pages.