Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/pdftopbm.cc
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 20:32:18 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2002-09-18 20:32:18 (GMT)
commit7aac8dc8533347e21311b15186e0af82f1b22fd6 (patch)
tree02650bb02c8a1d8468c22f50ff151885d233016b /pdf/xpdf/pdftopbm.cc
parentd99fb4f4acd14fcdbda968abd907547dcc7af40c (diff)
Synched with Xpdf 0.92
this adds "decryption" support testing this code after six weeks immediately gives me segfaults (image drawing) :-O must have fixed that later without knowing :-O
Diffstat (limited to 'pdf/xpdf/pdftopbm.cc')
-rw-r--r--pdf/xpdf/pdftopbm.cc34
1 files changed, 26 insertions, 8 deletions
diff --git a/pdf/xpdf/pdftopbm.cc b/pdf/xpdf/pdftopbm.cc
index 6cfe830..549b57b 100644
--- a/pdf/xpdf/pdftopbm.cc
+++ b/pdf/xpdf/pdftopbm.cc
@@ -29,7 +29,8 @@
static int firstPage = 1;
static int lastPage = 0;
static int resolution = 150;
-GBool printCommands = gFalse;
+static char userPassword[33] = "";
+static GBool printVersion = gFalse;
static GBool printHelp = gFalse;
static ArgDesc argDesc[] = {
@@ -39,8 +40,12 @@ static ArgDesc argDesc[] = {
"last page to print"},
{"-r", argInt, &resolution, 0,
"resolution, in DPI (default is 150)"},
+ {"-upw", argString, userPassword, sizeof(userPassword),
+ "user password (for encrypted files)"},
{"-q", argFlag, &errQuiet, 0,
"don't print any messages or errors"},
+ {"-v", argFlag, &printVersion, 0,
+ "print copyright and version info"},
{"-h", argFlag, &printHelp, 0,
"print usage information"},
{"-help", argFlag, &printHelp, 0,
@@ -52,15 +57,18 @@ int main(int argc, char *argv[]) {
PDFDoc *doc;
GString *fileName;
char *pbmRoot;
+ GString *userPW;
PBMOutputDev *pbmOut;
GBool ok;
// parse args
ok = parseArgs(argDesc, &argc, argv);
- if (!ok || argc != 3 || printHelp) {
+ if (!ok || argc != 3 || printVersion || printHelp) {
fprintf(stderr, "pdftopbm version %s\n", xpdfVersion);
fprintf(stderr, "%s\n", xpdfCopyright);
- printUsage("pdftopbm", "<PDF-file> <PBM-root>", argDesc);
+ if (!printVersion) {
+ printUsage("pdftopbm", "<PDF-file> <PBM-root>", argDesc);
+ }
exit(1);
}
fileName = new GString(argv[1]);
@@ -74,9 +82,18 @@ int main(int argc, char *argv[]) {
// open PDF file
xref = NULL;
- doc = new PDFDoc(fileName);
- if (!doc->isOk())
- exit(1);
+ if (userPassword[0]) {
+ userPW = new GString(userPassword);
+ } else {
+ userPW = NULL;
+ }
+ doc = new PDFDoc(fileName, userPW);
+ if (userPW) {
+ delete userPW;
+ }
+ if (!doc->isOk()) {
+ goto err;
+ }
// get page range
if (firstPage < 1)
@@ -87,10 +104,11 @@ int main(int argc, char *argv[]) {
// write PBM files
rgbCubeSize = 1;
pbmOut = PBMOutputDev::makePBMOutputDev(NULL, pbmRoot);
- doc->displayPages(pbmOut, firstPage, lastPage, resolution, 0);
- delete pbmOut;
+ doc->displayPages(pbmOut, firstPage, lastPage, resolution, 0, gFalse);
+ PBMOutputDev::killPBMOutputDev(pbmOut);
// clean up
+ err:
delete doc;
freeParams();