aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qpdf-job.cc
blob: 41ee8603a29ccab52b7b63d648751549ecedd450 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
}