summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorHib Eris <hib@hiberis.nl>2010-04-05 14:36:09 +0200
committerAlbert Astals Cid <aacid@kde.org>2010-04-05 15:56:05 +0100
commit46aee9e4d225b88a3dfd4afbe57259f337bb15d3 (patch)
treedcbf40b3045e584606aaf2b2ac4a740019ec0b79 /utils
parentd487a90688c4431075c9e4db040b3b02625e208f (diff)
Use PDFDocFactory in utils
Diffstat (limited to 'utils')
-rw-r--r--utils/pdffonts.cc16
-rw-r--r--utils/pdfimages.cc11
-rw-r--r--utils/pdfinfo.cc31
-rw-r--r--utils/pdftoabw.cc10
-rw-r--r--utils/pdftohtml.cc10
-rw-r--r--utils/pdftoppm.cc17
-rw-r--r--utils/pdftops.cc9
-rw-r--r--utils/pdftotext.cc14
8 files changed, 69 insertions, 49 deletions
diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc
index 752fa15e..4849f5f8 100644
--- a/utils/pdffonts.cc
+++ b/utils/pdffonts.cc
@@ -15,6 +15,7 @@
//
// Copyright (C) 2006 Dominic Lachowicz <cinamod@hotmail.com>
// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -38,6 +39,7 @@
#include "GfxFont.h"
#include "Annot.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
static char *fontTypeNames[] = {
"unknown",
@@ -131,16 +133,14 @@ int main(int argc, char *argv[]) {
} else {
userPW = NULL;
}
-
- if(fileName->cmp("-") != 0) {
- doc = new PDFDoc(fileName, ownerPW, userPW);
- } else {
- Object obj;
-
- obj.initNull();
- doc = new PDFDoc(new FileStream(stdin, 0, gFalse, 0, &obj), ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
}
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+ delete fileName;
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdfimages.cc b/utils/pdfimages.cc
index b821c799..60766b77 100644
--- a/utils/pdfimages.cc
+++ b/utils/pdfimages.cc
@@ -16,6 +16,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -40,6 +41,7 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "ImageOutputDev.h"
#include "Error.h"
@@ -120,7 +122,14 @@ int main(int argc, char *argv[]) {
} else {
userPW = NULL;
}
- doc = new PDFDoc(fileName, ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
+ }
+
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+ delete fileName;
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index 48504d2c..9644e9d0 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -43,15 +43,12 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "CharTypes.h"
#include "UnicodeMap.h"
#include "PDFDocEncoding.h"
#include "Error.h"
#include "DateInfo.h"
-#include "StdinCachedFile.h"
-#if ENABLE_LIBCURL
-#include "CurlCachedFile.h"
-#endif
static void printInfoString(Dict *infoDict, char *key, char *text,
UnicodeMap *uMap);
@@ -163,28 +160,14 @@ int main(int argc, char *argv[]) {
userPW = NULL;
}
-#if ENABLE_LIBCURL
- if (fileName->cmpN("http://", 7) == 0 ||
- fileName->cmpN("https://", 8) == 0) {
- Object obj;
-
- obj.initNull();
- CachedFile *cachedFile = new CachedFile(new CurlCachedFileLoader(), fileName);
- doc = new PDFDoc(new CachedFileStream(cachedFile, 0, gFalse, 0, &obj),
- ownerPW, userPW);
- } else
-#endif
- if (fileName->cmp("-") != 0) {
- doc = new PDFDoc(fileName, ownerPW, userPW);
- } else {
- Object obj;
-
- obj.initNull();
- CachedFile *cachedFile = new CachedFile(new StdinCacheLoader(), NULL);
- doc = new PDFDoc(new CachedFileStream(cachedFile, 0, gFalse, 0, &obj),
- ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
}
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+ delete fileName;
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdftoabw.cc b/utils/pdftoabw.cc
index 9c71c766..5cb651c8 100644
--- a/utils/pdftoabw.cc
+++ b/utils/pdftoabw.cc
@@ -4,6 +4,7 @@
* Copyright (C) 2007 Kouhei Sutou <kou@cozmixng.org>
* Copyright (C) 2009 Jakub Wilk <ubanus@users.sf.net>
* Copyright (C) 2009 Albert Astals Cid <aacid@kde.org>
+ * Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -41,6 +42,7 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "ABWOutputDev.h"
#include "PSOutputDev.h"
#include "GlobalParams.h"
@@ -136,7 +138,13 @@ int main(int argc, char *argv[]) {
userPW = NULL;
}
- doc = new PDFDoc(fileName, ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
+ }
+
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+ delete fileName;
if (userPW) {
delete userPW;
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 41312de2..7e2ac920 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -14,6 +14,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org>
+// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -41,6 +42,7 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "HtmlOutputDev.h"
#include "PSOutputDev.h"
#include "GlobalParams.h"
@@ -187,7 +189,13 @@ int main(int argc, char *argv[]) {
fileName = new GooString(argv[1]);
- doc = new PDFDoc(fileName, ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
+ }
+
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index 7d1e3bf0..72d2a5d6 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -20,6 +20,7 @@
// Copyright (C) 2009 Stefan Thomas <thomas@eload24.com>
// Copyright (C) 2009, 2010 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2010 Adrian Johnson <ajohnson@redneon.com>
+// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -36,6 +37,7 @@
#include "GlobalParams.h"
#include "Object.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "splash/SplashBitmap.h"
#include "splash/Splash.h"
#include "SplashOutputDev.h"
@@ -256,14 +258,17 @@ int main(int argc, char *argv[]) {
} else {
userPW = NULL;
}
- if(fileName != NULL && fileName->cmp("-") != 0) {
- doc = new PDFDoc(fileName, ownerPW, userPW);
- } else {
- Object obj;
- obj.initNull();
- doc = new PDFDoc(new FileStream(stdin, 0, gFalse, 0, &obj), ownerPW, userPW);
+ if (fileName == NULL) {
+ fileName = new GooString("fd://0");
+ }
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
}
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+ delete fileName;
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index 69d5c329..c549b4a1 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -44,6 +44,7 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "PSOutputDev.h"
#include "Error.h"
@@ -299,7 +300,13 @@ int main(int argc, char *argv[]) {
} else {
userPW = NULL;
}
- doc = new PDFDoc(fileName, ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
+ }
+
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+
if (userPW) {
delete userPW;
}
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 4ebda19b..143e754b 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -18,6 +18,7 @@
// Copyright (C) 2006 Dominic Lachowicz <cinamod@hotmail.com>
// Copyright (C) 2007-2008 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2009 Jan Jockusch <jan@jockusch.de>
+// Copyright (C) 2010 Hib Eris <hib@hiberis.nl>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -43,6 +44,7 @@
#include "Catalog.h"
#include "Page.h"
#include "PDFDoc.h"
+#include "PDFDocFactory.h"
#include "TextOutputDev.h"
#include "CharTypes.h"
#include "UnicodeMap.h"
@@ -192,15 +194,13 @@ int main(int argc, char *argv[]) {
userPW = NULL;
}
- if(fileName->cmp("-") != 0) {
- doc = new PDFDoc(fileName, ownerPW, userPW);
- } else {
- Object obj;
-
- obj.initNull();
- doc = new PDFDoc(new FileStream(stdin, 0, gFalse, 0, &obj), ownerPW, userPW);
+ if (fileName->cmp("-") == 0) {
+ delete fileName;
+ fileName = new GooString("fd://0");
}
+ doc = PDFDocFactory().createPDFDoc(fileName, ownerPW, userPW);
+
if (userPW) {
delete userPW;
}