Skip to main content

Creating PDF documents

The PDF generator takes an image storage and converts the contained images into a PDF. A page is generated for each image. The generated pages can be set to standard sizes such as DIN A4, US Letter, or a custom size. Since the images are embedded without scaling, the resolution for each page corresponds to the resolution of the original image.

PDFs can be encrypted using built-in encryption tools or custom-written encryption classes. The PDF data is encrypted in memory before being written to disk. To decrypt the PDF, appropriate decryption must be implemented on the backend or client side.

Note: The encryption process does not lock the PDF with a password but rather encrypts the entire file, providing a high level of protection. To decrypt the PDF file, you can use a provided encryption key or generate the key yourself using a combination of salt, password, and iterations.

For further information on page sizing, refer to the relevant documentation.

The completion handlers for these operations are executed on the main thread.

Example code for creating a standard PDF from a document

Create PDF from Document
loading...

Example code for creating a standard PDF from an image file

Create PDF from Image File
loading...

You can omit the PdfConfig parameter to use the default PDF settings. In this case PdfConfig.DefaultConfig() will be used. It has empty PdfAttributes, PageSize.Custom as page size and PageDirection.Auto as the default page orientation.

The details of PdfConfig can be found in API reference.

Want to scan longer than one minute?

Generate a free trial license to test the Scanbot SDK thoroughly.

Get your free Trial License

What do you think of this documentation?