aboutsummaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-18 00:28:50 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-20 15:16:25 +0200
commit56f1b411feeb58b55e92ee77daffaa49c51b7dad (patch)
tree4337c0ada5ccc979f89af9aecf0873c087329c05 /examples
parent7e7a9c437982b7ede2af9cd0b12b3e47b4bc3a3d (diff)
downloadqpdf-56f1b411feeb58b55e92ee77daffaa49c51b7dad.tar.zst
Back out fluent QPDFObjectHandle methods. Keep the andGet methods.
I decided these were confusing and inconsistent with how JSON works. They muddle the API rather than improving it.
Diffstat (limited to 'examples')
-rw-r--r--examples/pdf-attach-file.cc8
-rw-r--r--examples/pdf-create.cc15
2 files changed, 12 insertions, 11 deletions
diff --git a/examples/pdf-attach-file.cc b/examples/pdf-attach-file.cc
index 0d15122f..eb12a002 100644
--- a/examples/pdf-attach-file.cc
+++ b/examples/pdf-attach-file.cc
@@ -106,10 +106,10 @@ process(
// apdict.replaceKey("/Type", QPDFObjectHandle::newName("/XObject"));
// apdict.replaceKey("/Subtype", QPDFObjectHandle::newName("/Form"));
// apdict.replaceKey("/BBox", QPDFObjectHandle::parse("[ 0 0 20 20 ]"));
- apdict.replaceKey("/Resources", "<< >>"_qpdf)
- .replaceKey("/Type", "/XObject"_qpdf)
- .replaceKey("/Subtype", "/Form"_qpdf)
- .replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf);
+ apdict.replaceKey("/Resources", "<< >>"_qpdf);
+ apdict.replaceKey("/Type", "/XObject"_qpdf);
+ apdict.replaceKey("/Subtype", "/Form"_qpdf);
+ apdict.replaceKey("/BBox", "[ 0 0 20 20 ]"_qpdf);
auto annot = q.makeIndirectObject(QPDFObjectHandle::parse(
&q,
("<<"
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index 493b0d3d..5e9e4239 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -181,9 +181,9 @@ add_page(
" /Subtype /Image"
" /BitsPerComponent 8"
">>"_qpdf;
- image_dict.replaceKey("/ColorSpace", newName(color_space))
- .replaceKey("/Width", newInteger(width))
- .replaceKey("/Height", newInteger(height));
+ image_dict.replaceKey("/ColorSpace", newName(color_space));
+ image_dict.replaceKey("/Width", newInteger(width));
+ image_dict.replaceKey("/Height", newInteger(height));
image.replaceDict(image_dict);
// Provide the stream data.
@@ -200,9 +200,9 @@ add_page(
xobject.replaceKey("/Im1", image);
QPDFObjectHandle resources = QPDFObjectHandle::newDictionary();
- resources.replaceKey("/ProcSet", procset)
- .replaceKey("/Font", rfont)
- .replaceKey("/XObject", xobject);
+ resources.replaceKey("/ProcSet", procset);
+ resources.replaceKey("/Font", rfont);
+ resources.replaceKey("/XObject", xobject);
// Create the page content stream
QPDFObjectHandle contents =
@@ -213,7 +213,8 @@ add_page(
" /Type /Page"
" /MediaBox [0 0 612 392]"
">>"_qpdf);
- page.replaceKey("/Contents", contents).replaceKey("/Resources", resources);
+ page.replaceKey("/Contents", contents);
+ page.replaceKey("/Resources", resources);
// Add the page to the PDF file
dh.addPage(page, false);