aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-attach-file.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-05 15:18:58 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-05 17:29:25 +0100
commit7fb22740e131d997fb68bc113b8d9b4472e2c908 (patch)
tree93da9a3babdf591fa1cc286f71fb3d6f2277fa30 /examples/pdf-attach-file.cc
parentb48a0ff0e8e1861884b2dac62d98d39f8e194086 (diff)
downloadqpdf-7fb22740e131d997fb68bc113b8d9b4472e2c908.tar.zst
Add operator ""_qpdf for creating QPDFObjectHandle literals
Diffstat (limited to 'examples/pdf-attach-file.cc')
-rw-r--r--examples/pdf-attach-file.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/examples/pdf-attach-file.cc b/examples/pdf-attach-file.cc
index 0c046000..decc742f 100644
--- a/examples/pdf-attach-file.cc
+++ b/examples/pdf-attach-file.cc
@@ -36,16 +36,16 @@ static void process(char const* infilename, char const* password,
QPDF q;
q.processFile(infilename, password);
- // Create an indirect object for the built-in Helvetica font.
+ // Create an indirect object for the built-in Helvetica font. This
+ // uses the qpdf literal syntax introduced in qpdf 10.6.
auto f1 = q.makeIndirectObject(
- QPDFObjectHandle::parse(
- "<<"
- " /Type /Font"
- " /Subtype /Type1"
- " /Name /F1"
- " /BaseFont /Helvetica"
- " /Encoding /WinAnsiEncoding"
- ">>"));
+ "<<"
+ " /Type /Font"
+ " /Subtype /Type1"
+ " /Name /F1"
+ " /BaseFont /Helvetica"
+ " /Encoding /WinAnsiEncoding"
+ ">>"_qpdf);
// Create a resources dictionary with fonts. This uses the new
// parse introduced in qpdf 10.2 that takes a QPDF* and allows
@@ -93,7 +93,7 @@ static void process(char const* infilename, char const* password,
apdict.replaceKey("/Resources", QPDFObjectHandle::newDictionary());
apdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
apdict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
- apdict.replaceKey("/BBox", QPDFObjectHandle::parse("[ 0 0 20 20 ]"));
+ apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf);
auto annot = q.makeIndirectObject(
QPDFObjectHandle::parse(
&q,