- for (auto pg: pages)
- {
- page_out out;
- out.resources = QPDFObjectHandle::newDictionary();
- // FIXME: What if the source page requires a broader ProcSet?
- out.resources.replaceKey("/ProcSet", QPDFObjectHandle::parse("[/PDF /Text]"));
- out.xobjects = QPDFObjectHandle::newDictionary();
- out.resources.replaceKey("/XObject", out.xobjects);
- pg->render(&out, pdf_matrix());
-
- QPDFObjectHandle contents = QPDFObjectHandle::newStream(&out_pdf, out.contents);
-
- // Create the page object
- QPDFObjectHandle out_page = out_pdf.makeIndirectObject(QPDFObjectHandle::newDictionary());
- out_page.replaceKey("/Type", QPDFObjectHandle::newName("/Page"));
- out_page.replaceKey("/MediaBox", BBox(pg->width, pg->height).to_array());
- out_page.replaceKey("/Contents", contents);
- out_page.replaceKey("/Resources", out.resources);
- out_pdf.addPage(out_page, false);
- }