Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Import
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
7
#include "
ImportCroppingUtilPdf.h
"
8
#include "poppler-qt6.h"
9
#include <QApplication>
10
11
using namespace
Poppler
;
12
13
ImportCroppingUtilPdf::ImportCroppingUtilPdf
()
14
{
15
}
16
17
bool
ImportCroppingUtilPdf::applyImportCropping
(
bool
isErrorReportRegressionTest,
18
const
QString &fileName,
19
ImportCropping
importCropping,
20
std::unique_ptr<Document> &document)
const
21
{
22
document.reset();
23
bool
cropping =
false
;
24
25
if
(!isErrorReportRegressionTest) {
26
27
// Simple check to prevent complaints from poppler code
28
if
(fileName.right (4).toLower () ==
".pdf"
) {
29
30
// Try to read the file
31
QApplication::setOverrideCursor (Qt::BusyCursor);
// Since load could take a while
32
document = Document::load (fileName);
33
QApplication::restoreOverrideCursor();
34
if
(document !=
nullptr
) {
35
if
(!document->isLocked ()) {
36
37
cropping = (importCropping ==
IMPORT_CROPPING_ALWAYS
||
38
(importCropping ==
IMPORT_CROPPING_MULTIPAGE_PDFS
&& document->numPages () > 1));
39
}
40
}
41
}
42
}
43
44
return
cropping;
45
}
ImportCroppingUtilPdf.h
ImportCropping
ImportCropping
Definition
ImportCropping.h:11
IMPORT_CROPPING_MULTIPAGE_PDFS
@ IMPORT_CROPPING_MULTIPAGE_PDFS
Definition
ImportCropping.h:13
IMPORT_CROPPING_ALWAYS
@ IMPORT_CROPPING_ALWAYS
Definition
ImportCropping.h:14
ImportCroppingUtilPdf::applyImportCropping
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 ...
Definition
ImportCroppingUtilPdf.cpp:17
ImportCroppingUtilPdf::ImportCroppingUtilPdf
ImportCroppingUtilPdf()
Single constructor.
Definition
ImportCroppingUtilPdf.cpp:13
Poppler
Definition
DlgImportCroppingPdf.h:14
Generated on
for Engauge Digitizer by
1.17.0