PdfDocument QML Type
PDF 文档的表示。更多
Import Statement: | import QtQuick.Pdf |
属性
- 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
信号
方法
- size pagePointSize(int page)
详细描述
PdfDocument 提供对 PDF 文档元信息的访问。渲染时不需要使用该属性,因为只需使用来源设置为 PDF URL 的图像即可。
文档属性
author : string |
该属性包含创建文档者的姓名。
creationDate : date |
该属性包含文档创建的日期和时间。
creator : string |
如果文档是从其他格式转换成 PDF 的,该属性将显示创建原始文档的软件名称。
keywords : string |
该属性包含与文档相关的关键字。
maxPageHeight : real |
该属性用于保存文档中最高页面的高度(单位:点)。
maxPageWidth : real |
该属性用于保存文档中最宽页面的宽度(单位:点)。
modificationDate : date |
该属性包含文档最近修改的日期和时间。
pageCount : int |
该属性用于保存 PDF 文档的页数。
password : string |
该属性用于保存文档密码。如果发出passwordRequired() 信号,用户界面应提示用户,然后设置该属性,以便继续打开文档。
producer : string |
如果文档是从其他格式转换为 PDF 的,则该属性包含将其转换为 PDF 的软件名称。
source : url |
该属性包含指向要加载的 PDF 文件的 URL。
注意: 目前只支持本地文件系统和资源URL。不过,source
属性是一个URL ,而不仅仅是一个文件系统路径。PdfDocument 通过QQmlContext::resolvedUrl() 进行解析。通常情况下,您应确保 URL 以file://
方案开头,除非您打算从资源中加载 PDF 文件,或者该 URL 来自某个预先解析该 URL 的组件(如 FileDialog)。
status : enum |
该属性显示文档的当前状态。可能的值有
常量 | 说明 |
---|---|
PdfDocument.Null | 文档创建或关闭后的初始状态。 |
PdfDocument.Loading | 调用 load() 后、文档完全加载前的状态。 |
PdfDocument.Ready | 文档完全加载并可访问其数据时的状态。 |
PdfDocument.Unloading | 在打开的文档上调用 close() 后的状态。此时文档仍然有效,所有数据都可以访问。 |
PdfDocument.Error | 加载失败后的状态。 |
subject : string |
该属性包含文档的主题。
title : string |
该属性包含文档标题。典型的查看器用户界面可将其绑定到Window.title
属性。
信号文档
passwordRequired() |
该信号在 PDF 需要密码才能打开时发出。典型 PDF 阅读器的用户界面应提示用户输入密码,并在用户输入密码后设置密码属性。
注: 相应的处理程序是onPasswordRequired
。
方法文档
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.