Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/pdf/xpdf/pdfinfo.cc
diff options
context:
space:
mode:
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-17 19:37:57 (GMT)
committer Martin Kretzschmar <mkretzschmar@src.gnome.org>2004-05-17 19:37:57 (GMT)
commit6c85243ff859071be4fd2a3847b0fc2086206d31 (patch)
tree68b85384564a33061b32d5668c0eff7067a39ffc /pdf/xpdf/pdfinfo.cc
parentaf15b57b30fcf442262f3a797d169d6bc3c1a44a (diff)
Imported Xpdf 3.00 and fixed build.
* ANNOUNCE: * CHANGES: * Makefile.am: * README: * aconf-win32.h: * configure.in: * dj_make.bat: * doc/pdffonts.1: * doc/pdffonts.cat: * doc/pdffonts.hlp: * doc/pdfimages.1: * doc/pdfimages.cat: * doc/pdfimages.hlp: * doc/pdfinfo.1: * doc/pdfinfo.cat: * doc/pdfinfo.hlp: * doc/pdftopbm.1: * doc/pdftopbm.cat: * doc/pdftopbm.hlp: * doc/pdftops.1: * doc/pdftops.cat: * doc/pdftops.hlp: * doc/pdftotext.1: * doc/pdftotext.cat: * doc/pdftotext.hlp: * doc/xpdf.1: * doc/xpdf.cat: * doc/xpdf.hlp: * doc/xpdfrc.5: * doc/xpdfrc.cat: * doc/xpdfrc.hlp: * fofi/Makefile.in: * goo/GHash.cc: * goo/GHash.h: * ms_make.bat: * splash/Makefile.in: * xpdf/DisplayFontTable.h: * xpdf/ErrorCodes.h: * xpdf/FTFont.cc: * xpdf/FTFont.h: * xpdf/FontFile.cc: * xpdf/FontFile.h: * xpdf/Function.h: * xpdf/GPOutputDev.cc: * xpdf/Gfx.cc: * xpdf/Gfx.h: * xpdf/GfxFont.cc: * xpdf/GfxFont.h: * xpdf/GfxState.cc: * xpdf/GfxState.h: * xpdf/GlobalParams.cc: * xpdf/GlobalParams.h: * xpdf/Makefile.am: * xpdf/Object.cc: * xpdf/Object.h: * xpdf/Outline.cc: * xpdf/OutputDev.cc: * xpdf/OutputDev.h: * xpdf/PBMOutputDev.cc: * xpdf/PBMOutputDev.h: * xpdf/PDFDoc.cc: * xpdf/PDFDoc.h: * xpdf/PSOutputDev.cc: * xpdf/PSOutputDev.h: * xpdf/Page.cc: * xpdf/Page.h: * xpdf/Parser.cc: * xpdf/SFont.cc: * xpdf/SFont.h: * xpdf/Stream.cc: * xpdf/Stream.h: * xpdf/T1Font.cc: * xpdf/T1Font.h: * xpdf/TTFont.cc: * xpdf/TTFont.h: * xpdf/TextOutputDev.cc: * xpdf/TextOutputDev.h: * xpdf/XOutputDev.cc: * xpdf/XOutputDev.h: * xpdf/XPixmapOutputDev.cc: * xpdf/XPixmapOutputDev.h: * xpdf/XRef.cc: * xpdf/XRef.h: * xpdf/config.h: * xpdf/gpdf-control.cc: * xpdf/pdffonts.cc: * xpdf/pdfimages.cc: * xpdf/pdfinfo.cc: * xpdf/pdftopbm.cc: * xpdf/pdftops.cc: * xpdf/pdftotext.cc: * xpdf/tests/Makefile.am: * xpdf/vms_make.com: * xpdf/xpdf.cc: Imported Xpdf 3.00 and fixed build.
Diffstat (limited to 'pdf/xpdf/pdfinfo.cc')
-rw-r--r--pdf/xpdf/pdfinfo.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/pdf/xpdf/pdfinfo.cc b/pdf/xpdf/pdfinfo.cc
index e29e673..4a50fee 100644
--- a/pdf/xpdf/pdfinfo.cc
+++ b/pdf/xpdf/pdfinfo.cc
@@ -33,9 +33,11 @@
static void printInfoString(Dict *infoDict, char *key, char *text,
UnicodeMap *uMap);
static void printInfoDate(Dict *infoDict, char *key, char *text);
+static void printBox(char *text, PDFRectangle *box);
static int firstPage = 1;
static int lastPage = 0;
+static GBool printBoxes = gFalse;
static GBool printMetadata = gFalse;
static char textEncName[128] = "";
static char ownerPassword[33] = "\001";
@@ -49,6 +51,8 @@ static ArgDesc argDesc[] = {
"first page to convert"},
{"-l", argInt, &lastPage, 0,
"last page to convert"},
+ {"-box", argFlag, &printBoxes, 0,
+ "print the page bounding boxes"},
{"-meta", argFlag, &printMetadata, 0,
"print the document metadata (XML)"},
{"-enc", argString, textEncName, sizeof(textEncName),
@@ -77,7 +81,9 @@ int main(int argc, char *argv[]) {
GString *fileName;
GString *ownerPW, *userPW;
UnicodeMap *uMap;
+ Page *page;
Object info;
+ char buf[256];
double w, h, wISO, hISO;
FILE *f;
GString *metadata;
@@ -211,6 +217,32 @@ int main(int argc, char *argv[]) {
printf("\n");
}
+ // print the boxes
+ if (printBoxes) {
+ if (multiPage) {
+ for (pg = firstPage; pg <= lastPage; ++pg) {
+ page = doc->getCatalog()->getPage(pg);
+ sprintf(buf, "Page %4d MediaBox: ", pg);
+ printBox(buf, page->getMediaBox());
+ sprintf(buf, "Page %4d CropBox: ", pg);
+ printBox(buf, page->getCropBox());
+ sprintf(buf, "Page %4d BleedBox: ", pg);
+ printBox(buf, page->getBleedBox());
+ sprintf(buf, "Page %4d TrimBox: ", pg);
+ printBox(buf, page->getTrimBox());
+ sprintf(buf, "Page %4d ArtBox: ", pg);
+ printBox(buf, page->getArtBox());
+ }
+ } else {
+ page = doc->getCatalog()->getPage(firstPage);
+ printBox("MediaBox: ", page->getMediaBox());
+ printBox("CropBox: ", page->getCropBox());
+ printBox("BleedBox: ", page->getBleedBox());
+ printBox("TrimBox: ", page->getTrimBox());
+ printBox("ArtBox: ", page->getArtBox());
+ }
+ }
+
// print file size
#ifdef VMS
f = fopen(fileName->getCString(), "rb", "ctx=stm");
@@ -337,3 +369,8 @@ static void printInfoDate(Dict *infoDict, char *key, char *text) {
}
obj.free();
}
+
+static void printBox(char *text, PDFRectangle *box) {
+ printf("%s%8.2f %8.2f %8.2f %8.2f\n",
+ text, box->x1, box->y1, box->x2, box->y2);
+}