Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.4.0
-
None
Description
Please check the following code, the scaleToWidth gives wrong renderScale.
import QtQuick import QtQuick.Controls import QtQuick.Pdf Page { id: root property url source: Qt.resolvedUrl("<file:///PATH/TO/LOCAL/PDF/FILE>") function fitWidth() { print("view width:", view.width, ", height:", view.height); print("doc width:", doc.maxPageWidth, ", height:", doc.maxPageHeight); //view.scaleToWidth(view.width, view.height); view.renderScale = view.width / doc.maxPageWidth; print("renderScale:", view.renderScale); } width: 1000 height: 600 PdfDocument { id: doc source: root.source onStatusChanged: { if (status === PdfDocument.Error) print("failed to open pdf file:", root.source); if (status === PdfDocument.Ready) print("loading pdf file:", root.source, "success"); } } PdfMultiPageView { id: view anchors.fill: parent document: doc clip: true onWidthChanged: { root.fitWidth(); } } Component.onCompleted: { root.fitWidth(); } }