Commit ce740d987f1d129bc6b43071e95ee8f098caad05

Authored by Jay Berkenbilt
1 parent 2e4e25a9

Placeholder QPDFJob example

examples/build.mk
... ... @@ -8,6 +8,7 @@ BINS_examples = \
8 8 pdf-filter-tokens \
9 9 pdf-invert-images \
10 10 pdf-mod-info \
  11 + pdf-job \
11 12 pdf-name-number-tree \
12 13 pdf-npages \
13 14 pdf-overlay-page \
... ...
examples/pdf-job.cc 0 → 100644
  1 +#include <qpdf/QPDFJob.hh>
  2 +#include <qpdf/QUtil.hh>
  3 +
  4 +#include <iostream>
  5 +#include <cstring>
  6 +
  7 +// QXXXQ describe
  8 +
  9 +static char const* whoami = 0;
  10 +
  11 +#if 0 // QXXXQ
  12 +static void usage(std::string const& msg)
  13 +{
  14 + std::cerr << "Usage: " << whoami << " QXXXQ" << std::endl;
  15 + exit(2);
  16 +}
  17 +#endif
  18 +
  19 +int main(int argc, char* argv[])
  20 +{
  21 + whoami = QUtil::getWhoami(argv[0]);
  22 +
  23 + // For libtool's sake....
  24 + if (strncmp(whoami, "lt-", 3) == 0)
  25 + {
  26 + whoami += 3;
  27 + }
  28 +
  29 + try
  30 + {
  31 + QPDFJob j;
  32 + j.config()
  33 + ->inputFile("/tmp/1.pdf")
  34 + ->outputFile("/tmp/2.pdf")
  35 + ->pages()
  36 + ->pageSpec(".", "1-z")
  37 + ->endPages()
  38 + ->qdf();
  39 + j.run();
  40 + }
  41 + catch (std::exception& e)
  42 + {
  43 + // QXXXQ catch usage, configerror, whatever we end up with separately
  44 + std::cerr << "exception: " << e.what() << std::endl;
  45 + return 2;
  46 + }
  47 + return 0;
  48 +}
... ...