diff options
author | Jay Berkenbilt <ejb@ql.org> | 2021-02-22 22:09:02 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2021-02-23 00:42:06 +0100 |
commit | f02aa74bf5387c30e4ff6082beeb4b0d078b6294 (patch) | |
tree | 51cbcd2192a8207081dd09ca296099411e1bb7da /examples/pdf-overlay-page.cc | |
parent | 8e8c0d8290409358488b2a04af81771989944552 (diff) | |
download | qpdf-f02aa74bf5387c30e4ff6082beeb4b0d078b6294.tar.zst |
Update pdf-overlay-page example to copy annotations
Diffstat (limited to 'examples/pdf-overlay-page.cc')
-rw-r--r-- | examples/pdf-overlay-page.cc | 8 |
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); |