[poppler] 2 commits - utils/CMakeLists.txt utils/Makefile.am utils/pdffonts.1 utils/pdfimages.1 utils/pdfinfo.1 utils/pdfinfo.cc utils/pdftoppm.1 utils/pdftops.1 utils/pdftotext.1 utils/pdftotext.cc utils/printencodings.cc utils/printencodings.h

Albert Astals Cid aacid at kemper.freedesktop.org
Fri Aug 1 08:48:27 PDT 2008


 utils/CMakeLists.txt    |    4 ++--
 utils/Makefile.am       |    2 ++
 utils/pdffonts.1        |   18 ------------------
 utils/pdfimages.1       |   14 --------------
 utils/pdfinfo.1         |   28 ++++------------------------
 utils/pdfinfo.cc        |   16 ++++++++++++++--
 utils/pdftoppm.1        |   42 +++++++++++++++++++++---------------------
 utils/pdftops.1         |   41 +++--------------------------------------
 utils/pdftotext.1       |   32 ++++----------------------------
 utils/pdftotext.cc      |   16 ++++++++++++++--
 utils/printencodings.cc |   34 ++++++++++++++++++++++++++++++++++
 utils/printencodings.h  |   24 ++++++++++++++++++++++++
 12 files changed, 122 insertions(+), 149 deletions(-)

New commits:
commit 9fd1077e63d97a316380b8df4821bf4c9434fb52
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Aug 1 17:47:51 2008 +0200

    Build with cmake too

diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 8f8b418..f5d4911 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -39,7 +39,7 @@ install(TARGETS pdfimages DESTINATION bin)
 
 # pdfinfo
 set(pdfinfo_SOURCES ${common_srcs}
-  pdfinfo.cc
+  pdfinfo.cc printencodings.cc
 )
 add_executable(pdfinfo ${pdfinfo_SOURCES})
 target_link_libraries(pdfinfo ${common_libs})
@@ -55,7 +55,7 @@ install(TARGETS pdftops DESTINATION bin)
 
 # pdftotext
 set(pdftotext_SOURCES ${common_srcs}
-  pdftotext.cc
+  pdftotext.cc printencodings.cc
 )
 add_executable(pdftotext ${pdftotext_SOURCES})
 target_link_libraries(pdftotext ${common_libs})
commit d8d6a3f46620d45c279b7ca1a4a2fa3a36285cde
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Aug 1 17:44:07 2008 +0200

    Improve manpages and add -listenc to pdfinfo and pdftotext in the way
    
    Our manpages listed things like xpdfrc and -cfg options we don't support at all.
    Also some options were missing from the man pages
    Finally there was the -enc option you completely had to guess which string to pass,
    so i've added the -listenc option to get the user the list of encodings he can use

diff --git a/utils/Makefile.am b/utils/Makefile.am
index 4fc1308..690ef18 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -66,6 +66,7 @@ pdfimages_SOURCES =				\
 
 pdfinfo_SOURCES =				\
 	pdfinfo.cc				\
+	printencodings.cc			\
 	$(common)
 
 pdftops_SOURCES =				\
@@ -74,6 +75,7 @@ pdftops_SOURCES =				\
 
 pdftotext_SOURCES =				\
 	pdftotext.cc				\
+	printencodings.cc			\
 	$(common)
 
 pdftohtml_SOURCES =				\
diff --git a/utils/pdffonts.1 b/utils/pdffonts.1
index 7324690..fd7386c 100644
--- a/utils/pdffonts.1
+++ b/utils/pdffonts.1
@@ -58,16 +58,7 @@ CID Type 0C -- 16-bit PostScript CFF font
 .RS
 CID TrueType -- 16-bit TrueType font
 .RE
-.SH CONFIGURATION FILE
-Pdffonts reads a configuration file at startup.  It first tries to
-find the user's private config file, ~/.xpdfrc.  If that doesn't
-exist, it looks for a system-wide config file, /etc/xpdf/xpdfrc.  See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to analyze.
@@ -82,11 +73,6 @@ bypass all security restrictions.
 .BI \-upw " password"
 Specify the user password for the PDF file.
 .TP
-.BI \-cfg " config-file"
-Read
-.I config-file
-in place of ~/.xpdfrc or the system-wide config file.
-.TP
 .B \-v
 Print copyright and version information.
 .TP
@@ -117,12 +103,8 @@ Other error.
 The pdffonts software and documentation are copyright 1996-2004 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftops (1),
 .BR pdftotext (1),
 .BR pdfinfo (1),
 .BR pdftoppm (1),
 .BR pdfimages (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdfimages.1 b/utils/pdfimages.1
index c580625..ff31d85 100644
--- a/utils/pdfimages.1
+++ b/utils/pdfimages.1
@@ -21,16 +21,7 @@ where
 is the image number and
 .I xxx
 is the image type (.ppm, .pbm, .jpg).
-.SH CONFIGURATION FILE
-Pdfimages reads a configuration file at startup.  It first tries to
-find the user's private config file, ~/.xpdfrc.  If that doesn't
-exist, it looks for a system-wide config file, /etc/xpdf/xpdfrc.  See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to scan.
@@ -53,7 +44,6 @@ Specify the user password for the PDF file.
 .TP
 .B \-q
 Don't print any messages or errors.
-.RB "[config file: " errQuiet ]
 .TP
 .B \-v
 Print copyright and version information.
@@ -85,12 +75,8 @@ Other error.
 The pdfimages software and documentation are copyright 1998-2004 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftops (1),
 .BR pdftotext (1),
 .BR pdfinfo (1),
 .BR pdffonts (1),
 .BR pdftoppm (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdfinfo.1 b/utils/pdfinfo.1
index 334520c..0b72f56 100644
--- a/utils/pdfinfo.1
+++ b/utils/pdfinfo.1
@@ -68,16 +68,7 @@ PDF version
 .RS
 metadata (only if requested)
 .RE
-.SH CONFIGURATION FILE
-Pdfinfo reads a configuration file at startup.  It first tries to find
-the user's private config file, ~/.xpdfrc.  If that doesn't exist, it
-looks for a system-wide config file, /etc/xpdf/xpdfrc.  See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to examine.  If multiple pages are requested
@@ -97,12 +88,10 @@ Prints document-level metadata.  (This is the "Metadata" stream from
 the PDF file's Catalog object.)
 .TP
 .BI \-enc " encoding-name"
-Sets the encoding to use for text output.  The
-.I encoding\-name
-must be defined with the unicodeMap command (see
-.BR xpdfrc (5)).
-This defaults to "Latin1" (which is a built-in encoding).
-.RB "[config file: " textEncoding ]
+Sets the encoding to use for text output. This defaults to "UTF-8".
+.TP
+.B \-listenc
+Lits the available encodings
 .TP
 .BI \-opw " password"
 Specify the owner password for the PDF file.  Providing this will
@@ -111,11 +100,6 @@ bypass all security restrictions.
 .BI \-upw " password"
 Specify the user password for the PDF file.
 .TP
-.BI \-cfg " config-file"
-Read
-.I config-file
-in place of ~/.xpdfrc or the system-wide config file.
-.TP
 .B \-v
 Print copyright and version information.
 .TP
@@ -146,12 +130,8 @@ Other error.
 The pdfinfo software and documentation are copyright 1996-2004 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftops (1),
 .BR pdftotext (1),
 .BR pdffonts (1),
 .BR pdftoppm (1),
 .BR pdfimages (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc
index b9fc10e..71ce3a8 100644
--- a/utils/pdfinfo.cc
+++ b/utils/pdfinfo.cc
@@ -15,6 +15,7 @@
 #include <time.h>
 #include <math.h>
 #include "parseargs.h"
+#include "printencodings.h"
 #include "goo/GooString.h"
 #include "goo/gmem.h"
 #include "GlobalParams.h"
@@ -45,6 +46,7 @@ static char ownerPassword[33] = "\001";
 static char userPassword[33] = "\001";
 static GBool printVersion = gFalse;
 static GBool printHelp = gFalse;
+static GBool printEnc = gFalse;
 
 static const ArgDesc argDesc[] = {
   {"-f",      argInt,      &firstPage,        0,
@@ -57,6 +59,8 @@ static const ArgDesc argDesc[] = {
    "print the document metadata (XML)"},
   {"-enc",    argString,   textEncName,    sizeof(textEncName),
    "output text encoding name"},
+  {"-listenc",argFlag,     &printEnc,      0,
+   "list available encodings"},
   {"-opw",    argString,   ownerPassword,  sizeof(ownerPassword),
    "owner password (for encrypted files)"},
   {"-upw",    argString,   userPassword,   sizeof(userPassword),
@@ -94,7 +98,7 @@ int main(int argc, char *argv[]) {
 
   // parse args
   ok = parseArgs(argDesc, &argc, argv);
-  if (!ok || argc != 2 || printVersion || printHelp) {
+  if (!ok || (argc != 2 && !printEnc) || printVersion || printHelp) {
     fprintf(stderr, "pdfinfo version %s\n", xpdfVersion);
     fprintf(stderr, "%s\n", xpdfCopyright);
     if (!printVersion) {
@@ -102,10 +106,18 @@ int main(int argc, char *argv[]) {
     }
     goto err0;
   }
-  fileName = new GooString(argv[1]);
 
   // read config file
   globalParams = new GlobalParams();
+
+  if (printEnc) {
+    printEncodings();
+    delete globalParams;
+    goto err0;
+  }
+
+  fileName = new GooString(argv[1]);
+
   if (textEncName[0]) {
     globalParams->setTextEncoding(textEncName);
   }
diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1
index f4d93e3..e6497a9 100644
--- a/utils/pdftoppm.1
+++ b/utils/pdftoppm.1
@@ -21,16 +21,7 @@ and writes one PPM file for each page,
 where
 .I nnnnnn
 is the page number.
-.SH CONFIGURATION FILE
-Pdftoppm reads a configuration file at startup.  It first tries to
-find the user's private config file, ~/.xpdfrc.  If that doesn't
-exist, it looks for a system-wide config file, /etc/xpdf/xpdfrc. See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to convert.
@@ -41,25 +32,39 @@ Specifies the last page to convert.
 .BI \-r " number"
 Specifies the resolution, in DPI.  The default is 150 DPI.
 .TP
+.BI \-scale-to " number"
+Scales each page to fit in scale-to*scale-to box
+.TP
+.BI \-x " number"
+Specifies the x-coordinate of the crop area top left corner
+.TP
+.BI \-y " number"
+Specifies the y-coordinate of the crop area top left corner
+.TP
+.BI \-W " number"
+Specifies the width of crop area in pixels (default is 0)
+.TP
+.BI \-H " number"
+Specifies the height of crop area in pixels (default is 0)
+.TP
+.BI \-sz " number"
+Specifies the size of crop square in pixels (sets W and H)
+.TP
 .B \-mono
 Generate a monochrome PBM file (instead of a color PPM file).
 .TP
 .B \-gray
 Generate a grayscale PGM file (instead of a color PPM file).
 .TP
-.BI \-t1lib " yes | no"
-Enable or disable t1lib (a Type 1 font rasterizer).  This defaults to
-"yes".
-.RB "[config file: " enableT1lib ]
-.TP
 .BI \-freetype " yes | no"
 Enable or disable FreeType (a TrueType / Type 1 font rasterizer).
 This defaults to "yes".
-.RB "[config file: " enableFreeType ]
 .TP
 .BI \-aa " yes | no"
 Enable or disable font anti-aliasing.  This defaults to "yes".
-.RB "[config file: " antialias ]
+.TP
+.BI \-aaVector " yes | no"
+Enable or disable vector anti-aliasing.  This defaults to "yes".
 .TP
 .BI \-opw " password"
 Specify the owner password for the PDF file.  Providing this will
@@ -70,7 +75,6 @@ Specify the user password for the PDF file.
 .TP
 .B \-q
 Don't print any messages or errors.
-.RB "[config file: " errQuiet ]
 .TP
 .B \-v
 Print copyright and version information.
@@ -102,12 +106,8 @@ Other error.
 The pdftoppm software and documentation are copyright 1996-2004 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftops (1),
 .BR pdftotext (1),
 .BR pdfinfo (1),
 .BR pdffonts (1),
 .BR pdfimages (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdftops.1 b/utils/pdftops.1
index 04c5c7e..e5482ab 100644
--- a/utils/pdftops.1
+++ b/utils/pdftops.1
@@ -28,16 +28,7 @@ to
 with the -eps option).  If 
 .I PS-file
 is \'-', the PostScript is sent to stdout.
-.SH CONFIGURATION FILE
-Pdftops reads a configuration file at startup.  It first tries to find
-the user's private config file, ~/.xpdfrc.  If that doesn't exist, it
-looks for a system-wide config file, /etc/xpdf/xpdfrc.  See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to print.
@@ -51,34 +42,28 @@ significantly larger (if they contain images), but will print on Level
 1 printers.  This also converts all images to black and white.  No
 more than one of the PostScript level options (-level1, -level1sep,
 -level2, -level2sep, -level3, -level3Sep) may be given.
-.RB "[config file: " psLevel ]
 .TP
 .B \-level1sep
 Generate Level 1 separable PostScript.  All colors are converted to
 CMYK.  Images are written with separate stream data for the four
 components.
-.RB "[config file: " psLevel ]
 .TP
 .B \-level2
 Generate Level 2 PostScript.  Level 2 supports color images and image
 compression.  This is the default setting.
-.RB "[config file: " psLevel ]
 .TP
 .B \-level2sep
 Generate Level 2 separable PostScript.  All colors are converted to
 CMYK.  The PostScript separation convention operators are used to
 handle custom (spot) colors.
-.RB "[config file: " psLevel ]
 .TP
 .B \-level3
 Generate Level 3 PostScript.  This enables all Level 2 features plus
 CID font embedding.
-.RB "[config file: " psLevel ]
 .TP
 .B \-level3Sep
 Generate Level 3 separable PostScript.  The separation handling is the
 same as for -level2Sep.
-.RB "[config file: " psLevel ]
 .TP
 .B \-eps
 Generate an Encapsulated PostScript (EPS) file.  An EPS file contains
@@ -96,14 +81,12 @@ single page.  The -level1 option cannot be used with -form.
 Generate OPI comments for all images and forms which have OPI
 information.  (This option is only available if pdftops was compiled
 with OPI support.)
-.RB "[config file: " psOPI ]
 .TP
 .B \-noembt1
 By default, any Type 1 fonts which are embedded in the PDF file are
 copied into the PostScript file.  This option causes pdftops to
 substitute base fonts instead.  Embedded fonts make PostScript files
 larger, but may be necessary for readable output.
-.RB "[config file: " psEmbedType1Fonts ]
 .TP
 .B \-noembtt
 By default, any TrueType fonts which are embedded in the PDF file are
@@ -111,61 +94,53 @@ copied into the PostScript file.  This option causes pdftops to
 substitute base fonts instead.  Embedded fonts make PostScript files
 larger, but may be necessary for readable output.  Also, some
 PostScript interpreters do not have TrueType rasterizers.
-.RB "[config file: " psEmbedTrueTypeFonts ]
 .TP
 .B \-noembcidps
 By default, any CID PostScript fonts which are embedded in the PDF
 file are copied into the PostScript file.  This option disables that
 embedding.  No attempt is made to substitute for non-embedded CID
 PostScript fonts.
-.RB "[config file: " psEmbedCIDPostScriptFonts ]
 .TP
 .B \-noembcidtt
 By default, any CID TrueType fonts which are embedded in the PDF file
 are copied into the PostScript file.  This option disables that
 embedding.  No attempt is made to substitute for non-embedded CID
 TrueType fonts.
-.RB "[config file: " psEmbedCIDTrueTypeFonts ]
+.TP
+.B \-preload
+preload images and forms
 .TP
 .BI \-paper " size"
 Set the paper size to one of "letter", "legal", "A4", or "A3".  This
 can also be set to "match", which will set the paper size to match the
 size specified in the PDF file.
-.RB "[config file: " psPaperSize ]
 .TP
 .BI \-paperw " size"
 Set the paper width, in points.
-.RB "[config file: " psPaperSize ]
 .TP
 .BI \-paperh " size"
 Set the paper height, in points.
-.RB "[config file: " psPaperSize ]
 .TP
 .B \-nocrop
 By default, output is cropped to the CropBox specified in the PDF
 file.  This option disables cropping.
-.RB "[config file: " psCrop ]
 .TP
 .B \-expand
 Expand PDF pages smaller than the paper to fill the paper.  By
 default, these pages are not scaled.
-.RB "[config file: " psExpandSmaller ]
 .TP
 .B \-noshrink
 Don't scale PDF pages which are larger than the paper.  By default,
 pages larger than the paper are shrunk to fit.
-.RB "[config file: " psShrinkLarger ]
 .TP
 .B \-nocenter
 By default, PDF pages smaller than the paper (after any scaling) are
 centered on the paper.  This option causes them to be aligned to the
 lower-left corner of the paper instead.
-.RB "[config file: " psCenter ]
 .TP
 .B \-duplex
 Set the Duplex pagedevice entry in the PostScript file.  This tells
 duplex-capable printers to enable duplexing.
-.RB "[config file: " psDuplex ]
 .TP
 .BI \-opw " password"
 Specify the owner password for the PDF file.  Providing this will
@@ -176,12 +151,6 @@ Specify the user password for the PDF file.
 .TP
 .B \-q
 Don't print any messages or errors.
-.RB "[config file: " errQuiet ]
-.TP
-.BI \-cfg " config-file"
-Read
-.I config-file
-in place of ~/.xpdfrc or the system-wide config file.
 .TP
 .B \-v
 Print copyright and version information.
@@ -213,12 +182,8 @@ Other error.
 The pdftops software and documentation are copyright 1996-2004 Glyph &
 Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftotext (1),
 .BR pdfinfo (1),
 .BR pdffonts (1),
 .BR pdftoppm (1),
 .BR pdfimages (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdftotext.1 b/utils/pdftotext.1
index 11a6769..5a07c9b 100644
--- a/utils/pdftotext.1
+++ b/utils/pdftotext.1
@@ -25,16 +25,7 @@ to
 If 
 .I text-file
 is \'-', the text is sent to stdout.
-.SH CONFIGURATION FILE
-Pdftotext reads a configuration file at startup.  It first tries to
-find the user's private config file, ~/.xpdfrc.  If that doesn't
-exist, it looks for a system-wide config file, /etc/xpdf/xpdfrc.  See the
-.BR xpdfrc (5)
-man page for details.
 .SH OPTIONS
-Many of the following options can be set with configuration file
-commands.  These are listed in square brackets with the description of
-the corresponding command line option.
 .TP
 .BI \-f " number"
 Specifies the first page to convert.
@@ -58,21 +49,16 @@ simply wraps the text in <pre> and </pre> and prepends the meta
 headers.
 .TP
 .BI \-enc " encoding-name"
-Sets the encoding to use for text output.  The
-.I encoding\-name
-must be defined with the unicodeMap command (see
-.BR xpdfrc (5)).
-The encoding name is case-sensitive.  This defaults to "Latin1" (which
-is a built-in encoding).
-.RB "[config file: " textEncoding ]
+Sets the encoding to use for text output. This defaults to "UTF-8".
+.TP
+.B \-listenc
+Lits the available encodings
 .TP
 .BI \-eol " unix | dos | mac"
 Sets the end-of-line convention to use for text output.
-.RB "[config file: " textEOL ]
 .TP
 .B \-nopgbrk
 Don't insert page breaks (form feed characters) between pages.
-.RB "[config file: " textPageBreaks ]
 .TP
 .BI \-opw " password"
 Specify the owner password for the PDF file.  Providing this will
@@ -83,12 +69,6 @@ Specify the user password for the PDF file.
 .TP
 .B \-q
 Don't print any messages or errors.
-.RB "[config file: " errQuiet ]
-.TP
-.BI \-cfg " config-file"
-Read
-.I config-file
-in place of ~/.xpdfrc or the system-wide config file.
 .TP
 .B \-v
 Print copyright and version information.
@@ -124,12 +104,8 @@ Other error.
 The pdftotext software and documentation are copyright 1996-2004 Glyph
 & Cog, LLC.
 .SH "SEE ALSO"
-.BR xpdf (1),
 .BR pdftops (1),
 .BR pdfinfo (1),
 .BR pdffonts (1),
 .BR pdftoppm (1),
 .BR pdfimages (1),
-.BR xpdfrc (5)
-.br
-.B http://www.foolabs.com/xpdf/
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 10707e5..b6f885b 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -15,6 +15,7 @@
 #include <stddef.h>
 #include <string.h>
 #include "parseargs.h"
+#include "printencodings.h"
 #include "goo/GooString.h"
 #include "goo/gmem.h"
 #include "GlobalParams.h"
@@ -48,6 +49,7 @@ static char userPassword[33] = "\001";
 static GBool quiet = gFalse;
 static GBool printVersion = gFalse;
 static GBool printHelp = gFalse;
+static GBool printEnc = gFalse;
 
 static const ArgDesc argDesc[] = {
   {"-f",       argInt,      &firstPage,     0,
@@ -62,6 +64,8 @@ static const ArgDesc argDesc[] = {
    "generate a simple HTML file, including the meta information"},
   {"-enc",     argString,   textEncName,    sizeof(textEncName),
    "output text encoding name"},
+  {"-listenc",argFlag,     &printEnc,      0,
+   "list available encodings"},
   {"-eol",     argString,   textEOL,        sizeof(textEOL),
    "output end-of-line convention (unix, dos, or mac)"},
   {"-nopgbrk", argFlag,     &noPageBreaks,  0,
@@ -102,7 +106,7 @@ int main(int argc, char *argv[]) {
 
   // parse args
   ok = parseArgs(argDesc, &argc, argv);
-  if (!ok || argc < 2 || argc > 3 || printVersion || printHelp) {
+  if (!ok || (argc < 2 && !printEnc) || argc > 3 || printVersion || printHelp) {
     fprintf(stderr, "pdftotext version %s\n", xpdfVersion);
     fprintf(stderr, "%s\n", xpdfCopyright);
     if (!printVersion) {
@@ -110,10 +114,18 @@ int main(int argc, char *argv[]) {
     }
     goto err0;
   }
-  fileName = new GooString(argv[1]);
 
   // read config file
   globalParams = new GlobalParams();
+
+  if (printEnc) {
+    printEncodings();
+    delete globalParams;
+    goto err0;
+  }
+
+  fileName = new GooString(argv[1]);
+
   if (textEncName[0]) {
     globalParams->setTextEncoding(textEncName);
   }
diff --git a/utils/printencodings.cc b/utils/printencodings.cc
new file mode 100644
index 0000000..dec6f98
--- /dev/null
+++ b/utils/printencodings.cc
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2008, Albert Astals Cid <aacid at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#include "printencodings.h"
+
+#include "GlobalParams.h"
+#include "goo/GooList.h"
+#include "goo/GooString.h"
+
+void printEncodings()
+{
+  GooList *encNames = globalParams->getEncodingNames();
+  printf("Available encodings are:\n");
+  for (int i = 0; i < encNames->getLength(); ++i) {
+    GooString *enc = (GooString*)encNames->get(i);
+    printf("%s\n", enc->getCString());
+  }
+  delete encNames;
+}
diff --git a/utils/printencodings.h b/utils/printencodings.h
new file mode 100644
index 0000000..5be2819
--- /dev/null
+++ b/utils/printencodings.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2008, Albert Astals Cid <aacid at kde.org>
+ *
+ * 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
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef PRINTENCODINGS_H
+#define PRINTENCODINGS_H
+
+void printEncodings();
+
+#endif


More information about the poppler mailing list