- Qt 6.4
- Qt PDF
- QML Types
- PdfDocument
- Qt 6.4.3 Reference Documentation

# PdfDocument QML Type

A representation of a PDF document. More...

Import Statement: | import QtQuick.Pdf
Since: | Qt 5.15

- List of all members, including inherited members

## Properties

- author : string
- creationDate : date
- creator : string
- error : string
- keywords : string
- maxPageHeight : real
- maxPageWidth : real
- modificationDate : date
- pageCount : int
- password : string
- producer : string
- source : url
- status : enum
- subject : string
- title : string

## Signals

- passwordRequired()

## Methods

- size pagePointSize(int page)

## Detailed Description

PdfDocument provides access to PDF document meta-information. It is not necessary for rendering, as it is enough to use an Image with source set to the URL of the PDF.

## Property Documentation

author : string

This property holds the name of the person who created the document.

creationDate : date

This property holds the date and time the document was created.

creator : string

If the document was converted to PDF from another format, this property holds the name of the software that created the original document.

error : string

This property holds a translated string representation of the current error, if any.

See also status.

keywords : string

This property holds the keywords associated with the document.

maxPageHeight : real

This property holds the height of the tallest page in the document, in points.

maxPageWidth : real

This property holds the width of the widest page in the document, in points.

modificationDate : date

This property holds the date and time the document was most recently modified.

pageCount : int

This property holds the number of pages the PDF contains.

password : string

This property holds the document password. If the passwordRequired() signal is emitted, the UI should prompt the user and then set this property so that document opening can continue.

producer : string

If the document was converted to PDF from another format, this property holds the name of the software that converted it to PDF.

source : url

This property holds a URL pointing to the PDF file to be loaded.

Note: At this time, only local filesystem URLs are supported.

status : enum

This property tells the current status of the document. The possible values are:

Constant | Description
--- | ---
`PdfDocument.Null` | The initial status after the document has been created or after it has been closed.
`PdfDocument.Loading` | The status after load() has been called and before the document is fully loaded.
`PdfDocument.Ready` | The status when the document is fully loaded and its data can be accessed.
`PdfDocument.Unloading` | The status after close() has been called on an open document. At this point the document is still valid and all its data can be accessed.
`PdfDocument.Error` | The status after Loading, if loading has failed.

subject : string

This property holds the subject of the document.

title : string

This property holds the document's title. A typical viewer UI can bind this to the `Window.title` property.

## Signal Documentation

passwordRequired()

This signal is emitted when the PDF requires a password in order to open. The UI in a typical PDF viewer should prompt the user for the password and then set the password property when the user has provided it.

Note: The corresponding handler is `onPasswordRequired`.

## Method Documentation

size pagePointSize(int page)

Returns the size of the given page in points.