aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qpdf.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-21 22:06:58 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-21 23:13:09 +0100
commita9ae8cadc66daf631f6cbfe7fc3c7c602ac665d8 (patch)
tree0b38abc0fb2fbdcb64d2a3c959a9b9b6ec92a11f /qpdf/qpdf.cc
parenta76decd2d59f8d23791013d822e65b4363d450cd (diff)
downloadqpdf-a9ae8cadc66daf631f6cbfe7fc3c7c602ac665d8.tar.zst
Add transformAnnotations and fix flattenRotations to use it
Diffstat (limited to 'qpdf/qpdf.cc')
-rw-r--r--qpdf/qpdf.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 2f910f22..725a1742 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -5362,6 +5362,13 @@ static void copy_attachments(QPDF& pdf, Options& o, int& exit_code)
static void handle_transformations(QPDF& pdf, Options& o, int& exit_code)
{
QPDFPageDocumentHelper dh(pdf);
+ PointerHolder<QPDFAcroFormDocumentHelper> afdh;
+ auto make_afdh = [&]() {
+ if (! afdh.getPointer())
+ {
+ afdh = new QPDFAcroFormDocumentHelper(pdf);
+ }
+ };
if (o.externalize_inline_images)
{
std::vector<QPDFPageObjectHelper> pages = dh.getAllPages();
@@ -5408,8 +5415,8 @@ static void handle_transformations(QPDF& pdf, Options& o, int& exit_code)
}
if (o.generate_appearances)
{
- QPDFAcroFormDocumentHelper afdh(pdf);
- afdh.generateAppearancesIfNeeded();
+ make_afdh();
+ afdh->generateAppearancesIfNeeded();
}
if (o.flatten_annotations)
{
@@ -5427,9 +5434,10 @@ static void handle_transformations(QPDF& pdf, Options& o, int& exit_code)
}
if (o.flatten_rotation)
{
+ make_afdh();
for (auto& page: dh.getAllPages())
{
- page.flattenRotation();
+ page.flattenRotation(afdh.getPointer());
}
}
if (o.remove_page_labels)