aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qpdf-job.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-02-01 13:18:23 +0100
committerJay Berkenbilt <ejb@ql.org>2022-02-01 15:04:55 +0100
commitcc5485dac1f224f856ce48781278b357f61f74bd (patch)
tree097a1b61d7371da9e15d71b6662d16af8f251dd9 /examples/qpdf-job.cc
parent5a7bb3474eb10ec9dea8409466a14f72ead73e60 (diff)
downloadqpdf-cc5485dac1f224f856ce48781278b357f61f74bd.tar.zst
QPDFJob: documentation
Diffstat (limited to 'examples/qpdf-job.cc')
-rw-r--r--examples/qpdf-job.cc49
1 files changed, 49 insertions, 0 deletions
diff --git a/examples/qpdf-job.cc b/examples/qpdf-job.cc
new file mode 100644
index 00000000..41ee8603
--- /dev/null
+++ b/examples/qpdf-job.cc
@@ -0,0 +1,49 @@
+#include <qpdf/QPDFJob.hh>
+#include <qpdf/QUtil.hh>
+
+#include <iostream>
+#include <cstring>
+
+// QXXXQ describe
+
+static char const* whoami = 0;
+
+#if 0 // QXXXQ
+static void usage(std::string const& msg)
+{
+ std::cerr << "Usage: " << whoami << " QXXXQ" << std::endl;
+ exit(2);
+}
+#endif
+
+int main(int argc, char* argv[])
+{
+ whoami = QUtil::getWhoami(argv[0]);
+
+ // For libtool's sake....
+ if (strncmp(whoami, "lt-", 3) == 0)
+ {
+ whoami += 3;
+ }
+
+ try
+ {
+ QPDFJob j;
+ j.config()
+ ->inputFile("/tmp/1.pdf")
+ ->outputFile("/tmp/2.pdf")
+ ->pages()
+ ->pageSpec(".", "1-z")
+ ->endPages()
+ ->qdf()
+ ->checkConfiguration();
+ j.run();
+ }
+ catch (std::exception& e)
+ {
+ // QXXXQ catch usage, configerror, whatever we end up with separately
+ std::cerr << "exception: " << e.what() << std::endl;
+ return 2;
+ }
+ return 0;
+}