10#include "poppler-qt6.h"
11#include <QApplication>
29 bool isErrorReportRegressionTest)
const
31 std::unique_ptr<Document> document;
40 QApplication::setOverrideCursor(Qt::BusyCursor);
43 rtn = loadWithCropping (std::move(document),
49 rtn = loadWithoutCropping (fileName,
54 QApplication::restoreOverrideCursor();
59PdfReturn Pdf::loadWithCropping (std::unique_ptr<Document> document,
68 if (dlg.exec() == QDialog::Accepted) {
73 if (!image.isNull()) {
84PdfReturn Pdf::loadWithoutCropping (
const QString &fileName,
91 if (fileName.right (4).toLower () ==
".pdf") {
94 std::unique_ptr<Document> document = Document::load (fileName);
96 if (document !=
nullptr) {
97 if (!document->isLocked ()) {
100 if (page !=
nullptr) {
102 image = page->renderToImage (resolution,
109 if (!image.isNull()) {
const int FIRST_PAGE_1_BASED
PdfReturn
Return values from load operation.
Dialog for selecting a page and frame on that page when importing an image from a pdf file.
bool applyImportCropping(bool isRegression, const QString &fileName, ImportCropping importCropping, std::unique_ptr< Poppler::Document > &document) const
For pdf files, skip cropping dialog during regression testing, otherwise crop if it is always turned ...
PdfReturn load(const QString &fileName, QImage &image, int resolution, ImportCropping importCropping, bool isErrorReportRegressionTest) const
Try to load the specified file. Success is indicated in the function return value.