- Qt 6.9
- Qt PDF
- Qt 6.9.0 Reference Documentation

# Qt PDF

The Qt PDF module contains classes and functions for rendering PDF documents. The QPdfDocument class loads a PDF document and renders pages from it according to the options provided by the QPdfDocumentRenderOptions class. The QPdfPageRenderer class manages a queue that collects all render requests. The QPdfPageNavigator class handles the navigation through a PDF document. The QPdfSearchModel class searches for a string and holds the search results. The QPdfBookmarkModel class holds the table of contents, if present. The QPdfLinkModel holds information about hyperlinks on a page. The QPdfView widget is a complete PDF viewer, and the PDF Viewer Widget Example shows how to use it.

For Qt Quick applications, three kinds of full-featured viewer components are provided. PdfMultiPageView should be your first choice for the most common user experience: flicking through the pages in the entire document. PdfScrollablePageView shows one page at a time, with scrolling; and PdfPageView shows one full page at a time, without scrolling.

The full-featured viewer components are composed of lower-level QML components that can be used separately if you need to write a more customized PDF viewing application: PdfDocument, PdfPageImage, PdfPageNavigator, PdfSelection, PdfSearchModel, PdfLinkModel, and PdfBookmarkModel.

If you only need to render page images, without features such as text selection, search and navigation, this module includes a QImageIOHandler plugin that treats PDF as a scalable image format, similar to SVG. You can simply use Image, and set the currentFrame property to the page index that you wish to display. If the PDF file does not render its own background, the image has a transparent background.

## Using the Module

Using a Qt module requires linking against the module library, either directly or through other dependencies. Several build tools have dedicated support for this, including CMake and qmake.

### Building with CMake

Use the `find_package()` command to locate the needed module components in the `Qt6` package:

     find_package(Qt6 REQUIRED COMPONENTS Pdf)
     target_link_libraries(mytarget Qt6::Pdf)

See also the Build with CMake overview.

### Building with qmake

To link against the module, add this line to your qmake project file:

     QT += pdf

## Examples

- Qt PDF Examples

## API Reference

- Qt PDF C++ Classes
- Qt Quick PDF QML Types

## Articles and Guides

- Platform Notes

## Licenses and Attributions

Qt PDF is available under commercial licenses from The Qt Company. In addition, it is available under the GNU Lesser General Public License, version 3, or the GNU General Public License, version 2. See Qt PDF Licensing for further details about this module.