[poppler] poppler/utils: HtmlOutputDev.cc, 1.5, 1.6 HtmlOutputDev.h, 1.2, 1.3 pdffonts.cc, 1.5, 1.6 pdfinfo.cc, 1.5, 1.6 pdftoabw.cc, 1.3, 1.4 pdftohtml.cc, 1.6, 1.7 pdftoppm.cc, 1.4, 1.5 pdftops.cc, 1.5, 1.6 pdftotext.cc, 1.5, 1.6

Albert Astals Cid aacid at kemper.freedesktop.org
Wed Apr 25 12:59:13 PDT 2007


Update of /cvs/poppler/poppler/utils
In directory kemper:/tmp/cvs-serv1447/utils

Modified Files:
	HtmlOutputDev.cc HtmlOutputDev.h pdffonts.cc pdfinfo.cc 
	pdftoabw.cc pdftohtml.cc pdftoppm.cc pdftops.cc pdftotext.cc 
Log Message:
Merge xpdf302branch in HEAD as noone vetoed it.
Testing more than welcome


Index: HtmlOutputDev.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/HtmlOutputDev.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- HtmlOutputDev.cc	19 Mar 2006 17:01:05 -0000	1.5
+++ HtmlOutputDev.cc	25 Apr 2007 19:59:10 -0000	1.6
@@ -27,13 +27,13 @@
 #include "goo/gmem.h"
 #include "Error.h"
 #include "GfxState.h"
+#include "Page.h"
 #ifdef ENABLE_LIBJPEG
 #include "DCTStream.h"
 #endif
 #include "GlobalParams.h"
 #include "HtmlOutputDev.h"
 #include "HtmlFonts.h"
-#include "UGooString.h"
 
 int HtmlPage::pgNum=0;
 int HtmlOutputDev::imgNum=1;
@@ -1037,6 +1037,12 @@
 
 
 void HtmlOutputDev::endPage() {
+  Links *linksList = catalog->getPage(pageNum)->getLinks(catalog);
+  for (int i = 0; i < linksList->getNumLinks(); ++i)
+  {
+      processLink(linksList->getLink(i));
+  }
+
   pages->conv();
   pages->coalesce();
   pages->dump(page, pageNum);
@@ -1268,18 +1274,17 @@
 
 
 
-void HtmlOutputDev::drawLink(Link* link,Catalog *cat){
-  double _x1,_y1,_x2,_y2,w;
+void HtmlOutputDev::processLink(Link* link){
+  double _x1,_y1,_x2,_y2;
   int x1,y1,x2,y2;
   
   link->getRect(&_x1,&_y1,&_x2,&_y2);
-  w = link->getBorderStyle()->getWidth();
   cvtUserToDev(_x1,_y1,&x1,&y1);
   
   cvtUserToDev(_x2,_y2,&x2,&y2); 
 
 
-  GooString* _dest=getLinkDest(link,cat);
+  GooString* _dest=getLinkDest(link,catalog);
   HtmlLink t((double) x1,(double) y2,(double) x2,(double) y1,_dest);
   pages->AddLink(t);
   delete _dest;

Index: HtmlOutputDev.h
===================================================================
RCS file: /cvs/poppler/poppler/utils/HtmlOutputDev.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- HtmlOutputDev.h	19 Mar 2006 17:01:05 -0000	1.2
+++ HtmlOutputDev.h	25 Apr 2007 19:59:10 -0000	1.3
@@ -232,6 +232,18 @@
 
   //----- initialization and control
 
+  virtual GBool checkPageSlice(Page *page, double hDPI, double vDPI,
+                               int rotate, GBool useMediaBox, GBool crop,
+                               int sliceX, int sliceY, int sliceW, int sliceH,
+                               GBool printing, Catalog * catalogA,
+                               GBool (* abortCheckCbk)(void *data) = NULL,
+                               void * abortCheckCbkData = NULL)
+  {
+   catalog = catalogA;
+   return gTrue;
+  }
+
+
   // Start a page.
   virtual void startPage(int pageNum, GfxState *state);
 
@@ -259,7 +271,6 @@
 
   //new feature    
   virtual int DevType() {return 1234;}
-  virtual void drawLink(Link *link,Catalog *cat); 
 
   int getPageWidth() { return maxPageWidth; }
   int getPageHeight() { return maxPageHeight; }
@@ -272,6 +283,7 @@
   // convert encoding into a HTML standard, or encoding->getCString if not
   // recognized
   static char* mapEncodingToHtml(GooString* encoding);
+  void processLink(Link *link);
   GooString* getLinkDest(Link *link,Catalog *catalog);
   void dumpMetaVars(FILE *);
   void doFrame(int firstPage);
@@ -294,6 +306,7 @@
   GooString *Docname;
   GooString *docTitle;
   GooList *glMetaVars;
+  Catalog *catalog;
   friend class HtmlPage;
 };
 

Index: pdffonts.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdffonts.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pdffonts.cc	24 Feb 2007 23:43:35 -0000	1.5
+++ pdffonts.cc	25 Apr 2007 19:59:10 -0000	1.6
@@ -2,7 +2,7 @@
 //
 // pdffonts.cc
 //
-// Copyright 2001-2003 Glyph & Cog, LLC
+// Copyright 2001-2007 Glyph & Cog, LLC
 //
 //========================================================================
 
@@ -23,17 +23,20 @@
 #include "GfxFont.h"
 #include "Annot.h"
 #include "PDFDoc.h"
-#include "UGooString.h"
 
 static char *fontTypeNames[] = {
   "unknown",
   "Type 1",
   "Type 1C",
+  "Type 1C (OT)",
   "Type 3",
   "TrueType",
+  "TrueType (OT)",
   "CID Type 0",
   "CID Type 0C",
-  "CID TrueType"
+  "CID Type 0C (OT)",
+  "CID TrueType",
+  "CID TrueType (OT)"
 };
 
 static void scanFonts(Dict *resDict, PDFDoc *doc);
@@ -142,8 +145,8 @@
   }
 
   // scan the fonts
-  printf("name                                 type         emb sub uni object ID\n");
-  printf("------------------------------------ ------------ --- --- --- ---------\n");
+  printf("name                                 type              emb sub uni object ID\n");
+  printf("------------------------------------ ----------------- --- --- --- ---------\n");
   fonts = NULL;
   fontsLen = fontsSize = 0;
   for (pg = firstPage; pg <= lastPage; ++pg) {
@@ -280,7 +283,7 @@
   }
 
   // print the font info
-  printf("%-36s %-12s %-3s %-3s %-3s",
+  printf("%-36s %-17s %-3s %-3s %-3s",
 	 name ? name->getCString() : "[none]",
 	 fontTypeNames[font->getType()],
 	 emb ? "yes" : "no",

Index: pdfinfo.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdfinfo.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pdfinfo.cc	24 Feb 2007 23:43:35 -0000	1.5
+++ pdfinfo.cc	25 Apr 2007 19:59:10 -0000	1.6
@@ -28,8 +28,8 @@
 #include "PDFDoc.h"
 #include "CharTypes.h"
 #include "UnicodeMap.h"
+#include "PDFDocEncoding.h"
 #include "Error.h"
-#include "UGooString.h"
 
 static void printInfoString(Dict *infoDict, char *key, char *text,
 			    UnicodeMap *uMap);
@@ -198,8 +198,8 @@
 
   // print page size
   for (pg = firstPage; pg <= lastPage; ++pg) {
-    w = doc->getPageMediaWidth(pg);
-    h = doc->getPageMediaHeight(pg);
+    w = doc->getPageCropWidth(pg);
+    h = doc->getPageCropHeight(pg);
     if (multiPage) {
       printf("Page %4d size: %g x %g pts", pg, w, h);
     } else {
@@ -327,7 +327,7 @@
 	    (s1->getChar(i+1) & 0xff);
 	i += 2;
       } else {
-	u = s1->getChar(i) & 0xff;
+	u = pdfDocEncoding[s1->getChar(i) & 0xff];
 	++i;
       }
       n = uMap->mapUnicode(u, buf, sizeof(buf));
@@ -341,7 +341,7 @@
 static void printInfoDate(Dict *infoDict, char *key, char *text) {
   Object obj;
   char *s;
-  int year, mon, day, hour, min, sec;
+  int year, mon, day, hour, min, sec, n;
   struct tm tmStruct;
   char buf[256];
 
@@ -351,8 +351,15 @@
     if (s[0] == 'D' && s[1] == ':') {
       s += 2;
     }
-    if (sscanf(s, "%4d%2d%2d%2d%2d%2d",
-	       &year, &mon, &day, &hour, &min, &sec) == 6) {
+    if ((n = sscanf(s, "%4d%2d%2d%2d%2d%2d",
+		    &year, &mon, &day, &hour, &min, &sec)) >= 1) {
+      switch (n) {
+      case 1: mon = 1;
+      case 2: day = 1;
+      case 3: hour = 0;
+      case 4: min = 0;
+      case 5: sec = 0;
+      }
       tmStruct.tm_year = year - 1900;
       tmStruct.tm_mon = mon - 1;
       tmStruct.tm_mday = day;

Index: pdftoabw.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdftoabw.cc,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- pdftoabw.cc	7 Apr 2007 21:12:36 -0000	1.3
+++ pdftoabw.cc	25 Apr 2007 19:59:10 -0000	1.4
@@ -29,7 +29,6 @@
 #include "PSOutputDev.h"
 #include "GlobalParams.h"
 #include "Error.h"
-#include "UGooString.h"
 #include "goo/gfile.h"
 #include <libxml/parser.h>
 #include <libxml/tree.h>

Index: pdftohtml.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdftohtml.cc,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- pdftohtml.cc	14 Apr 2007 23:19:46 -0000	1.6
+++ pdftohtml.cc	25 Apr 2007 19:59:10 -0000	1.7
@@ -29,7 +29,6 @@
 #include "PSOutputDev.h"
 #include "GlobalParams.h"
 #include "Error.h"
-#include "UGooString.h"
 #include "goo/gfile.h"
 
 #ifndef GHOSTSCRIPT
@@ -300,7 +299,7 @@
   if (htmlOut->isOk())
   {
     doc->displayPages(htmlOut, firstPage, lastPage, 72, 72, 0,
-		      gTrue, gFalse, gTrue);
+		      gTrue, gFalse, gFalse);
   	if (!xml)
 	{
 		htmlOut->dumpDocOutline(doc->getCatalog());

Index: pdftoppm.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdftoppm.cc,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- pdftoppm.cc	24 Feb 2007 23:43:35 -0000	1.4
+++ pdftoppm.cc	25 Apr 2007 19:59:11 -0000	1.5
@@ -26,6 +26,7 @@
 static GBool gray = gFalse;
 static char enableFreeTypeStr[16] = "";
 static char antialiasStr[16] = "";
+static char vectorAntialiasStr[16] = "";
 static char ownerPassword[33] = "";
 static char userPassword[33] = "";
 static GBool quiet = gFalse;
@@ -49,6 +50,8 @@
 #endif
   {"-aa",         argString,      antialiasStr,   sizeof(antialiasStr),
    "enable font anti-aliasing: yes, no"},
+  {"-aaVector",   argString,      vectorAntialiasStr, sizeof(vectorAntialiasStr),
+   "enable vector anti-aliasing: yes, no"},
   {"-opw",    argString,   ownerPassword,  sizeof(ownerPassword),
    "owner password (for encrypted files)"},
   {"-upw",    argString,   userPassword,   sizeof(userPassword),
@@ -110,6 +113,11 @@
       fprintf(stderr, "Bad '-aa' value on command line\n");
     }
   }
+  if (vectorAntialiasStr[0]) {
+    if (!globalParams->setVectorAntialias(vectorAntialiasStr)) {
+      fprintf(stderr, "Bad '-aaVector' value on command line\n");
+    }
+  }
   if (quiet) {
     globalParams->setErrQuiet(quiet);
   }

Index: pdftops.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdftops.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pdftops.cc	24 Feb 2007 23:43:35 -0000	1.5
+++ pdftops.cc	25 Apr 2007 19:59:11 -0000	1.6
@@ -68,6 +68,7 @@
 static GBool noEmbedTTFonts = gFalse;
 static GBool noEmbedCIDPSFonts = gFalse;
 static GBool noEmbedCIDTTFonts = gFalse;
+static GBool preload = gFalse;
 static char paperSize[15] = "";
 static int paperWidth = 0;
 static int paperHeight = 0;
@@ -115,6 +116,8 @@
    "don't embed CID PostScript fonts"},
   {"-noembcidtt", argFlag, &noEmbedCIDTTFonts,  0,
    "don't embed CID TrueType fonts"},
+  {"-preload",    argFlag,     &preload,        0,
+   "preload images and forms"},
   {"-paper",      argString,   paperSize,       sizeof(paperSize),
    "paper size (letter, legal, A4, A3, match)"},
   {"-paperw",     argInt,      &paperWidth,     0,
@@ -242,6 +245,9 @@
   if (noEmbedCIDTTFonts) {
     globalParams->setPSEmbedCIDTrueType(!noEmbedCIDTTFonts);
   }
+  if (preload) {
+    globalParams->setPSPreload(preload);
+  }
 #if OPI_SUPPORT
   if (doOPI) {
     globalParams->setPSOPI(doOPI);
@@ -319,7 +325,7 @@
 			  duplex);
   if (psOut->isOk()) {
     doc->displayPages(psOut, firstPage, lastPage, 72, 72,
-		      0, !noCrop, gFalse, gFalse);
+		      0, !noCrop, gFalse, gTrue);
   } else {
     delete psOut;
     exitCode = 2;

Index: pdftotext.cc
===================================================================
RCS file: /cvs/poppler/poppler/utils/pdftotext.cc,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- pdftotext.cc	24 Feb 2007 23:43:35 -0000	1.5
+++ pdftotext.cc	25 Apr 2007 19:59:11 -0000	1.6
@@ -30,7 +30,6 @@
 #include "CharTypes.h"
 #include "UnicodeMap.h"
 #include "Error.h"
-#include "UGooString.h"
 
 static void printInfoString(FILE *f, Dict *infoDict, char *key,
 			    char *text1, char *text2, UnicodeMap *uMap);



More information about the poppler mailing list