PdfMultiPageView QML Type
A complete PDF viewer component for scrolling through multiple pages. More...
Import Statement: | import QtQuick.Pdf |
Inherits: |
Properties
- backEnabled : bool
- currentPage : int
- currentPageRenderingStatus : int
- document : PdfDocument
- forwardEnabled : bool
- pageRotation : real
- renderScale : real
- searchModel : PdfSearchModel
- searchString : string
- selectedText : string
Methods
- void back()
- void copySelectionToClipboard()
- void forward()
- void goToLocation(int page, point location, real zoom)
- void goToPage(int page)
- void resetScale()
- void scaleToPage(real width, real height)
- void scaleToWidth(real width, real height)
- void searchBack()
- void searchForward()
- void selectAll()
Detailed Description
PdfMultiPageView provides a PDF viewer component that offers a user experience similar to many common PDF viewer applications. It supports flicking through the pages in the entire document, with narrow gaps between the page images.
PdfMultiPageView also supports selecting text and copying it to the clipboard, zooming in and out, clicking an internal link to jump to another section in the document, rotating the view, and searching for text. The PDF Multipage Viewer Example demonstrates how to use these features in an application.
The implementation is a QML assembly of smaller building blocks that are available separately. In case you want to make changes in your own version of this component, you can copy the QML, which is installed into the QtQuick/Pdf/qml
module directory, and modify it as needed.
See also PdfPageView, PdfScrollablePageView, and PdfStyle.
Property Documentation
backEnabled : bool |
This property indicates if it is possible to go back in the navigation history to a previous-viewed page.
See also PdfPageNavigator::backAvailable and back().
currentPage : int |
This property holds the zero-based page number of the page visible in the scrollable view. If there is no current page, it holds -1.
This property is read-only, and is typically used in a binding (or onCurrentPageChanged
script) to update the part of the user interface that shows the current page number, such as a SpinBox.
See also PdfPageNavigator::currentPage.
currentPageRenderingStatus : int |
This property holds the rendering status of the current page.
document : PdfDocument |
A PdfDocument object with a valid source
URL is required:
import QtQuick import QtQuick.Pdf PdfMultiPageView { document: PdfDocument { source: "my.pdf" } }
forwardEnabled : bool |
This property indicates if it is possible to go to next location in the navigation history.
See also PdfPageNavigator::forwardAvailable and forward().
pageRotation : real |
This property holds the clockwise rotation of the pages.
The default value is 0
degrees (that is, no rotation relative to the orientation of the pages as stored in the PDF file).
renderScale : real |
This property holds the ratio of pixels to points. The default is 1
, meaning one point (1/72 of an inch) equals 1 logical pixel.
searchModel : PdfSearchModel |
This property holds a PdfSearchModel containing the list of search results for a given searchString.
See also PdfSearchModel.
searchString : string |
This property holds the search string that the user may choose to search for. It is typically used in a binding to the text
property of a TextField.
See also searchModel.
selectedText : string |
The selected text.
Method Documentation
void back() |
Scrolls the view back to the previous page that the user visited most recently; or does nothing if there is no previous location on the navigation stack.
See also PdfPageNavigator::back(), currentPage, and backEnabled.
void copySelectionToClipboard() |
Copies the selected text (if any) to the system clipboard.
See also selectAll().
void forward() |
Scrolls the view to the page that the user was viewing when the back() method was called; or does nothing if there is no "next" location on the navigation stack.
See also PdfPageNavigator::forward() and currentPage.
void goToLocation(int page, point location, real zoom) |
Scrolls the view to the location on the page, if possible, and sets the zoom level.
See also PdfPageNavigator::jump() and currentPage.
void goToPage(int page) |
Scrolls the view to the given page number, if possible.
See also PdfPageNavigator::jump() and currentPage.
void resetScale() |
Sets renderScale back to its default value of 1
.
void scaleToPage(real width, real height) |
Sets renderScale such that the whole first page will fit into a viewport with the given width and height. The resulting renderScale depends on pageRotation: the page will fit into the viewport at a larger size if it is first rotated to have a matching aspect ratio.
void scaleToWidth(real width, real height) |
Sets renderScale such that the width of the first page will fit into a viewport with the given width and height. If the page is not rotated, it will be scaled so that its width fits width. If it is rotated +/- 90 degrees, it will be scaled so that its width fits height.
void searchBack() |
Decrements the searchModel's current result so that the view will jump to the previous search result.
void searchForward() |
Increments the searchModel's current result so that the view will jump to the next search result.
void selectAll() |
Selects all the text on the current page, and makes it available as the system selection on systems that support that feature.
See also copySelectionToClipboard().
© 2024 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.