- for (auto pg: pages)
- {
- out_context out;
- out.resources = QPDFObjectHandle::newDictionary();
- out.resources.replaceKey("/ProcSet", QPDFObjectHandle::parse("[/PDF]"));
- 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("/CropBox", pg->bbox.to_array());
- out_page.replaceKey("/Contents", contents);
- out_page.replaceKey("/Resources", out.resources);
- out_pdf.addPage(out_page, false);
- }
+static void usage()
+{
+ printf("Usage: paperjam [<options>] <commands> <in> <out>\n\
+\n\
+Options:\n\
+-b, --bbox Recalculate bounding boxes\n\
+-d, --debug Show debugging messages\n\
+ --no-auto Disable automatic rotation of pages\n\
+\n\
+<command> = <name>(<args>, <named-arg>[=<value>], ...) [<pipeline>]\n\
+<pipeline> = { <stage>, <stage>, ... }\n\
+<stage> = <page> <page> ... [: <commands>]\n\
+\n\
+Example:\n\
+paperjam 'book nup(2, paper=a4)' input.pdf output.pdf\n\
+\n\
+Commands:\n\
+");
+ parser_help();
+}