[PATCH] Adds a test application to test full rewrite functionnality.
Julien Rebetez
julien at fhtagn.net
Fri Oct 26 07:03:00 PDT 2007
---
test/Makefile.am | 11 ++++++++++-
test/pdf-fullrewrite.cc | 44 ++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 54 insertions(+), 1 deletions(-)
create mode 100644 test/pdf-fullrewrite.cc
diff --git a/test/Makefile.am b/test/Makefile.am
index df1809a..d46b988 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -33,6 +33,9 @@ perf_test = \
endif
+pdf_fullrewrite = \
+ pdf-fullrewrite
+
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/poppler \
@@ -42,7 +45,7 @@ INCLUDES = \
$(GTK_TEST_CFLAGS) \
$(FONTCONFIG_CFLAGS)
-noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test) $(pdf_inspector) $(perf_test)
+noinst_PROGRAMS = $(gtk_splash_test) $(gtk_cairo_test) $(pdf_inspector) $(perf_test) $(pdf_fullrewrite)
gtk_splash_test_SOURCES = \
gtk-splash-test.cc
@@ -79,5 +82,11 @@ perf_test_LDADD = \
$(top_builddir)/poppler/libpoppler.la \
$(FREETYPE_LIBS)
+pdf_fullrewrite_SOURCES = \
+ pdf-fullrewrite.cc
+
+pdf_fullrewrite_LDADD = \
+ $(top_builddir)/poppler/libpoppler.la
+
EXTRA_DIST = \
pdf-operators.c
diff --git a/test/pdf-fullrewrite.cc b/test/pdf-fullrewrite.cc
new file mode 100644
index 0000000..b782bc4
--- /dev/null
+++ b/test/pdf-fullrewrite.cc
@@ -0,0 +1,44 @@
+//========================================================================
+//
+// 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;
+ }
+
+
+ doc->saveAs(outputName, writeForceRewrite);
+
+ delete doc;
+ delete globalParams;
+}
--
1.5.2.5
--------------030500050101040903030608--
More information about the poppler
mailing list