#include "CharTypes.h"
#include "UnicodeMap.h"
#include "Error.h"
-#include "config.h"
+#include "xpdfconfig.h"
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";
"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),
GString *fileName;
GString *ownerPW, *userPW;
UnicodeMap *uMap;
+ Page *page;
Object info;
+ char buf[256];
double w, h, wISO, hISO;
FILE *f;
GString *metadata;
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");
}
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);
+}