aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-overlay-page.cc
diff options
context:
space:
mode:
Diffstat (limited to 'examples/pdf-overlay-page.cc')
-rw-r--r--examples/pdf-overlay-page.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/examples/pdf-overlay-page.cc b/examples/pdf-overlay-page.cc
index 88722352..1e06c40c 100644
--- a/examples/pdf-overlay-page.cc
+++ b/examples/pdf-overlay-page.cc
@@ -56,9 +56,10 @@ static void stamp_page(char const* infile,
// Generate content to place the form XObject centered within
// destination page's trim box.
+ QPDFMatrix m;
std::string content =
ph.placeFormXObject(
- stamp_fo, name, ph.getTrimBox().getArrayAsRectangle());
+ stamp_fo, name, ph.getTrimBox().getArrayAsRectangle(), m);
if (! content.empty())
{
// Append the content to the page's content. Surround the
@@ -72,6 +73,11 @@ static void stamp_page(char const* infile,
ph.addPageContents(
QPDFObjectHandle::newStream(&inpdf, "\nQ\n" + content), false);
}
+ // Copy the annotations and form fields from the original page
+ // to the new page. For more efficiency when copying multiple
+ // pages, we can create a QPDFAcroFormDocumentHelper and pass
+ // it in. See comments in QPDFPageObjectHelper.hh for details.
+ ph.copyAnnotations(stamp_page_1, m);
}
QPDFWriter w(inpdf, outfile);