source: trunk/poppler/mypoppler/test.cpp @ 56

Last change on this file since 56 was 2, checked in by Eugene Romanenko, 16 years ago

First import

File size: 1.4 KB
Line 
1#include <stdio.h>
2#include "config.h"
3
4#include <goo/gmem.h>
5#include <splash/SplashTypes.h>
6#include <splash/SplashBitmap.h>
7#include "Object.h"
8#include "SplashOutputDev.h"
9#include "GfxState.h"
10#include "PDFDoc.h"
11#include "GlobalParams.h"
12#include "ErrorCodes.h"
13
14//------------------------------------------------------------------------
15
16#define xOutMaxRGBCube 6        // max size of RGB color cube
17
18//------------------------------------------------------------------------
19// Constants and macros
20//------------------------------------------------------------------------
21
22#define xoutRound(x) ((int)(x + 0.5))
23
24
25static int view_load( const char *filename )
26{
27  PDFDoc *newDoc;
28  int err;
29  GooString *filename_g;
30  int w, h;
31
32  filename_g = new GooString (filename);
33
34  // open the PDF file
35  newDoc = new PDFDoc(filename_g, 0, 0);
36
37  delete filename_g;
38 
39  if (!newDoc->isOk())
40    {
41      err = newDoc->getErrorCode();
42      delete newDoc;
43      return err;
44    }
45
46  printf("pages: %d\n", newDoc->getNumPages() );
47   
48  newDoc->saveAs( new GooString("my.pdf") );
49
50  return errNone;
51}
52
53
54int main()
55{
56 
57  globalParams = new GlobalParams("/etc/xpdfrc");
58 
59      int err = view_load("test.pdf");
60
61      if (err != errNone)
62        printf("Error loading document!\n");
63     
64  delete globalParams;
65 
66  return 0;
67}
Note: See TracBrowser for help on using the repository browser.