summaryrefslogtreecommitdiff
path: root/Build/source/libs/poppler/poppler-0.12.4/test/pdf-fullrewrite.cc
blob: 9658e55a6dc04ceb45c97d249760e2b85bf0c381 (plain)
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
//========================================================================
//
// pdf-fullrewrite.cc
//
// Copyright 2007 Julien Rebetez
//
//========================================================================
#include "config.h"
#include <poppler-config.h>
#include "GlobalParams.h"
#include "Error.h"
#include "PDFDoc.h"
#include "goo/GooString.h"

int main (int argc, char *argv[])
{
  PDFDoc *doc;
  GooString *inputName, *outputName;

  // parse args
  if (argc < 3) {
    fprintf(stderr, "usage: %s INPUT-FILE OUTPUT-FILE\n", argv[0]);
    return 1;
  }

  inputName = new GooString(argv[1]);
  outputName = new GooString(argv[2]);

  globalParams = new GlobalParams();

  doc = new PDFDoc(inputName);

  if (!doc->isOk()) {
    delete doc;
    fprintf(stderr, "Error loading document !\n");
    return 1;
  }


  int res = doc->saveAs(outputName, writeForceRewrite);

  delete doc;
  delete globalParams;
  delete outputName;
  return res;
}