Engauge Digitizer 2
Loading...
Searching...
No Matches
ImportCroppingUtilPdf.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2016 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
8#include "poppler-qt5.h"
9#include <QApplication>
10
11using namespace Poppler;
12
16
18 const QString &fileName,
19 ImportCropping importCropping,
20 Document *&document) const
21{
22 document = nullptr;
23
24 bool cropping = false;
25
27
28 // Simple check to prevent complaints from poppler code
29 if (fileName.right (4).toLower () == ".pdf") {
30
31 // Try to read the file
32 QApplication::setOverrideCursor (Qt::BusyCursor); // Since load could take a while
33 document = Document::load (fileName);
34 QApplication::restoreOverrideCursor();
35 if (document != nullptr) {
36 if (!document->isLocked ()) {
37
38 cropping = (importCropping == IMPORT_CROPPING_ALWAYS ||
39 (importCropping == IMPORT_CROPPING_MULTIPAGE_PDFS && document->numPages () > 1));
40 }
41 }
42 }
43 }
44
45 return cropping;
46}
const int INNER_RADIUS_MIN
ImportCropping
@ IMPORT_CROPPING_MULTIPAGE_PDFS
@ IMPORT_CROPPING_ALWAYS
Storage of one imported image and the data attached to that image.
Definition Document.h:42
bool applyImportCropping(bool isRegression, const QString &fileName, ImportCropping importCropping, Poppler::Document *&document) const
For pdf files, skip cropping dialog during regression testing, otherwise crop if it is always turned ...
ImportCroppingUtilPdf()
Single constructor.