aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-create.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-30 02:39:54 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-30 02:39:54 +0200
commitab9d557cb051b3568add22790cc58143c823e8df (patch)
treee594455ab528c90ceb95b05ecda17ea1495cd247 /examples/pdf-create.cc
parentd8fdf632a979a7adb4a6423fd55ef1971fb06afd (diff)
downloadqpdf-ab9d557cb051b3568add22790cc58143c823e8df.tar.zst
Use fluent replaceKey
Diffstat (limited to 'examples/pdf-create.cc')
-rw-r--r--examples/pdf-create.cc15
1 files changed, 7 insertions, 8 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index b5adb01a..ea315a49 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -183,9 +183,9 @@ add_page(
" /Subtype /Image"
" /BitsPerComponent 8"
">>"_qpdf;
- image_dict.replaceKey("/ColorSpace", newName(color_space));
- image_dict.replaceKey("/Width", newInteger(width));
- image_dict.replaceKey("/Height", newInteger(height));
+ image_dict.replaceKey("/ColorSpace", newName(color_space))
+ .replaceKey("/Width", newInteger(width))
+ .replaceKey("/Height", newInteger(height));
image.replaceDict(image_dict);
// Provide the stream data.
@@ -202,9 +202,9 @@ add_page(
xobject.replaceKey("/Im1", image);
QPDFObjectHandle resources = QPDFObjectHandle::newDictionary();
- resources.replaceKey("/ProcSet", procset);
- resources.replaceKey("/Font", rfont);
- resources.replaceKey("/XObject", xobject);
+ resources.replaceKey("/ProcSet", procset)
+ .replaceKey("/Font", rfont)
+ .replaceKey("/XObject", xobject);
// Create the page content stream
QPDFObjectHandle contents =
@@ -215,8 +215,7 @@ add_page(
" /Type /Page"
" /MediaBox [0 0 612 392]"
">>"_qpdf);
- page.replaceKey("/Contents", contents);
- page.replaceKey("/Resources", resources);
+ page.replaceKey("/Contents", contents).replaceKey("/Resources", resources);
// Add the page to the PDF file
dh.addPage(page, false);