[poppler] 2 commits - utils/pdftotext.1 utils/pdftotext.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Sun Mar 8 05:45:09 PDT 2009
utils/pdftotext.1 | 15 +++++++++++++++
utils/pdftotext.cc | 29 ++++++++++++++++++++++++++++-
2 files changed, 43 insertions(+), 1 deletion(-)
New commits:
commit bf2e2f056cadbc488cd3e9576b44beb34689ec81
Author: Albert Astals Cid <aacid at kde.org>
Date: Sun Mar 8 13:44:44 2009 +0100
Add the new croptting options explanations
diff --git a/utils/pdftotext.1 b/utils/pdftotext.1
index 5a07c9b..4e3cb0b 100644
--- a/utils/pdftotext.1
+++ b/utils/pdftotext.1
@@ -33,6 +33,21 @@ Specifies the first page to convert.
.BI \-l " number"
Specifies the last page to convert.
.TP
+.BI \-r " number"
+Specifies the resolution, in DPI. The default is 72 DPI.
+.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
.B \-layout
Maintain (as best as possible) the original physical layout of the
text. The default is to \'undo' physical layout (columns,
commit 663d9e5a448641421d290dd228be692a0f236b9c
Author: Jan Jockusch <jan at jockusch.de>
Date: Sun Mar 8 13:44:20 2009 +0100
Make pdftotext to accept cropping options like pdftoppm
Bug #20331
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 27d71ad..4ebda19 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -17,6 +17,7 @@
//
// Copyright (C) 2006 Dominic Lachowicz <cinamod at hotmail.com>
// Copyright (C) 2007-2008 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2009 Jan Jockusch <jan at jockusch.de>
//
// 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
@@ -53,6 +54,11 @@ static void printInfoDate(FILE *f, Dict *infoDict, char *key, char *fmt);
static int firstPage = 1;
static int lastPage = 0;
+static double resolution = 72.0;
+static int x = 0;
+static int y = 0;
+static int w = 0;
+static int h = 0;
static GBool physLayout = gFalse;
static GBool rawOrder = gFalse;
static GBool htmlMeta = gFalse;
@@ -71,6 +77,16 @@ static const ArgDesc argDesc[] = {
"first page to convert"},
{"-l", argInt, &lastPage, 0,
"last page to convert"},
+ {"-r", argFP, &resolution, 0,
+ "resolution, in DPI (default is 72)"},
+ {"-x", argInt, &x, 0,
+ "x-coordinate of the crop area top left corner"},
+ {"-y", argInt, &y, 0,
+ "y-coordinate of the crop area top left corner"},
+ {"-W", argInt, &w, 0,
+ "width of crop area in pixels (default is 0)"},
+ {"-H", argInt, &h, 0,
+ "height of crop area in pixels (default is 0)"},
{"-layout", argFlag, &physLayout, 0,
"maintain original physical layout"},
{"-raw", argFlag, &rawOrder, 0,
@@ -272,8 +288,19 @@ int main(int argc, char *argv[]) {
textOut = new TextOutputDev(textFileName->getCString(),
physLayout, rawOrder, htmlMeta);
if (textOut->isOk()) {
- doc->displayPages(textOut, firstPage, lastPage, 72, 72, 0,
+ if ((w==0) && (h==0) && (x==0) && (y==0)) {
+ doc->displayPages(textOut, firstPage, lastPage, resolution, resolution, 0,
gTrue, gFalse, gFalse);
+ } else {
+ int page;
+
+ for (page = firstPage; page <= lastPage; ++page) {
+ doc->displayPageSlice(textOut, page, resolution, resolution, 0,
+ gTrue, gFalse, gFalse,
+ x, y, w, h);
+ }
+ }
+
} else {
delete textOut;
exitCode = 2;
More information about the poppler
mailing list