[poppler] qt5/src qt6/src
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 20 09:19:34 UTC 2021
qt5/src/poppler-pdf-converter.cc | 5 +++--
qt6/src/poppler-pdf-converter.cc | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
New commits:
commit d672fbe5c1f22c69e30824d7cb896e6b8fb560eb
Author: Albert Astals Cid <albert.astals.cid at kdab.com>
Date: Tue Apr 13 13:59:47 2021 +0200
qt: Make sure new signatures are always properly oriented
With the old code if it the page we were adding a signature was
landscape and then rotated 90 degrees to look like portrait (relatively
common on scanned documents) the text would appear wrongly oriented
diff --git a/qt5/src/poppler-pdf-converter.cc b/qt5/src/poppler-pdf-converter.cc
index fa3f797d..32910725 100644
--- a/qt5/src/poppler-pdf-converter.cc
+++ b/qt5/src/poppler-pdf-converter.cc
@@ -3,6 +3,7 @@
* Copyright (C) 2008, 2009, 2020, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2020, Thorsten Behrens <Thorsten.Behrens at CIB.de>
* Copyright (C) 2020, Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by Technische Universität Dresden
+ * Copyright (C) 2021, Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -129,7 +130,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
::Page *destPage = doc->getPage(data.page() + 1);
const DefaultAppearance da { { objName, "SigFont" }, data.fontSize(), std::unique_ptr<AnnotColor> { convertQColor(data.fontColor()) } };
- const PDFRectangle rect = boundaryToPdfRectangle(destPage, data.boundingRectangle(), 0 /* no flags */);
+ const PDFRectangle rect = boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation);
Object annotObj = Object(new Dict(doc->getXRef()));
annotObj.dictSet("Type", Object(objName, "Annot"));
@@ -157,7 +158,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
Object refObj(ref);
AnnotWidget *signatureAnnot = new AnnotWidget(doc, &annotObj, &refObj, field.get());
- signatureAnnot->setFlags(signatureAnnot->getFlags() | Annot::flagPrint | Annot::flagLocked);
+ signatureAnnot->setFlags(signatureAnnot->getFlags() | Annot::flagPrint | Annot::flagLocked | Annot::flagNoRotate);
Dict dummy(doc->getXRef());
auto appearCharacs = std::make_unique<AnnotAppearanceCharacs>(&dummy);
appearCharacs->setBorderColor(std::unique_ptr<AnnotColor> { convertQColor(data.borderColor()) });
diff --git a/qt6/src/poppler-pdf-converter.cc b/qt6/src/poppler-pdf-converter.cc
index 91705f6e..3783e9ed 100644
--- a/qt6/src/poppler-pdf-converter.cc
+++ b/qt6/src/poppler-pdf-converter.cc
@@ -3,6 +3,7 @@
* Copyright (C) 2008, 2009, 2020, Albert Astals Cid <aacid at kde.org>
* Copyright (C) 2020, Thorsten Behrens <Thorsten.Behrens at CIB.de>
* Copyright (C) 2020, Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>. Work sponsored by Technische Universität Dresden
+ * Copyright (C) 2021, Klarälvdalens Datakonsult AB, a KDAB Group company, <info at kdab.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -129,7 +130,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
::Page *destPage = doc->getPage(data.page() + 1);
const DefaultAppearance da { { objName, "SigFont" }, data.fontSize(), std::unique_ptr<AnnotColor> { convertQColor(data.fontColor()) } };
- const PDFRectangle rect = boundaryToPdfRectangle(destPage, data.boundingRectangle(), 0 /* no flags */);
+ const PDFRectangle rect = boundaryToPdfRectangle(destPage, data.boundingRectangle(), Annotation::FixedRotation);
Object annotObj = Object(new Dict(doc->getXRef()));
annotObj.dictSet("Type", Object(objName, "Annot"));
@@ -157,7 +158,7 @@ bool PDFConverter::sign(const NewSignatureData &data)
Object refObj(ref);
AnnotWidget *signatureAnnot = new AnnotWidget(doc, &annotObj, &refObj, field.get());
- signatureAnnot->setFlags(signatureAnnot->getFlags() | Annot::flagPrint | Annot::flagLocked);
+ signatureAnnot->setFlags(signatureAnnot->getFlags() | Annot::flagPrint | Annot::flagLocked | Annot::flagNoRotate);
Dict dummy(doc->getXRef());
auto appearCharacs = std::make_unique<AnnotAppearanceCharacs>(&dummy);
appearCharacs->setBorderColor(std::unique_ptr<AnnotColor> { convertQColor(data.borderColor()) });
More information about the poppler
mailing list