From aacid at kemper.freedesktop.org Tue Jun 1 13:01:10 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 1 Jun 2010 13:01:10 -0700 (PDT) Subject: [poppler] poppler/Lexer.h Message-ID: <20100601200111.06E2610057@kemper.freedesktop.org> poppler/Lexer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) New commits: commit b15c793a8a58b17a7fe7b32c1037726e1e0e1bf0 Author: Albert Astals Cid Date: Tue Jun 1 20:57:16 2010 +0100 Check it is a stream, not that it is not none People is reporting aborts, e.g. KDE bug 240208 but can not check if this really fixes it since he can not share the document diff --git a/poppler/Lexer.h b/poppler/Lexer.h index a0fcc6a..284479d 100644 --- a/poppler/Lexer.h +++ b/poppler/Lexer.h @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2006, 2007 Albert Astals Cid +// Copyright (C) 2006, 2007, 2010 Albert Astals Cid // Copyright (C) 2006 Krzysztof Kowalczyk // // To see a description of the changes please see the Changelog file that @@ -64,16 +64,16 @@ public: // Get stream. Stream *getStream() - { return curStr.isNone() ? (Stream *)NULL : curStr.getStream(); } + { return curStr.isStream() ? curStr.getStream() : (Stream *)NULL; } // Get current position in file. This is only used for error // messages, so it returns an int instead of a Guint. int getPos() - { return curStr.isNone() ? -1 : (int)curStr.streamGetPos(); } + { return curStr.isStream() ? (int)curStr.streamGetPos() : -1; } // Set position in file. void setPos(Guint pos, int dir = 0) - { if (!curStr.isNone()) curStr.streamSetPos(pos, dir); } + { if (curStr.isStream()) curStr.streamSetPos(pos, dir); } // Returns true if is a whitespace character. static GBool isSpace(int c); From aacid at kemper.freedesktop.org Tue Jun 1 13:40:38 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 1 Jun 2010 13:40:38 -0700 (PDT) Subject: [poppler] poppler/XRef.cc Message-ID: <20100601204038.6C4BD10057@kemper.freedesktop.org> poppler/XRef.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) New commits: commit 41e9af7f505dbfbda36f6ac97df90f2a42ab3160 Author: Albert Astals Cid Date: Tue Jun 1 21:40:07 2010 +0100 If the document is not encrypted it is ok to print diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 8ce370c..1e60575 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -897,13 +897,17 @@ GBool XRef::okToPrint(GBool ignoreOwnerPW) { // 2 (and we are allowed to print at all), or with security handler rev // 3 and we are allowed to print, and bit 12 is set. GBool XRef::okToPrintHighRes(GBool ignoreOwnerPW) { - if (2 == encRevision) { - return (okToPrint(ignoreOwnerPW)); - } else if (encRevision >= 3) { - return (okToPrint(ignoreOwnerPW) && (permFlags & permHighResPrint)); + if (encrypted) { + if (2 == encRevision) { + return (okToPrint(ignoreOwnerPW)); + } else if (encRevision >= 3) { + return (okToPrint(ignoreOwnerPW) && (permFlags & permHighResPrint)); + } else { + // something weird - unknown security handler version + return gFalse; + } } else { - // something weird - unknown security handler version - return gFalse; + return gTrue; } } From aacid at kde.org Thu Jun 3 14:45:31 2010 From: aacid at kde.org (Albert Astals Cid) Date: Thu, 3 Jun 2010 22:45:31 +0100 Subject: [poppler] Poppler 0.14.0 next tuesday Message-ID: <201006032245.32260.aacid@kde.org> Hi, i plan release poppler 0.14.0 next tuesday, anyone has a reson why i shouldn't? Albert From aacid at kemper.freedesktop.org Fri Jun 4 00:46:58 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Fri, 4 Jun 2010 00:46:58 -0700 (PDT) Subject: [poppler] 2 commits - poppler/Lexer.cc poppler/Object.cc poppler/Object.h poppler/SecurityHandler.cc Message-ID: <20100604074658.D8CE410057@kemper.freedesktop.org> poppler/Lexer.cc | 32 +++++++++++++++++++++++++------- poppler/Object.cc | 5 ++++- poppler/Object.h | 14 +++++++++++--- poppler/SecurityHandler.cc | 22 ++++++++++++++++++++++ 4 files changed, 62 insertions(+), 11 deletions(-) New commits: commit e7a5e9f70ee1283a2ca6734552d905279c97989b Author: Albert Astals Cid Date: Fri Jun 4 08:46:33 2010 +0100 a bit of docu diff --git a/poppler/Object.h b/poppler/Object.h index a71dca8..2b9f20c 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -99,7 +99,7 @@ enum ObjType { objNone, // uninitialized object // poppler-only objects - objUint // overflown integer + objUint // overflown integer that still fits in a unsigned integer }; #define numObjTypes 15 // total number of object types commit 9ff4dab2558f7c2700fd7fcaccacdad9619dbdda Author: Albert Astals Cid Date: Fri Jun 4 08:44:34 2010 +0100 Add support for unsigned integer numbers So files store their P as a 32 bit unsigned instead of as a 32 bit signed, making us to overflow our objInt parsing and rejecting to open the file, this patch introduces objUint that only happens when the number is not real, does not fit in a 32 bit integer but still fits in a 32 bit unsigned integer diff --git a/poppler/Lexer.cc b/poppler/Lexer.cc index 60bb09e..6250d40 100644 --- a/poppler/Lexer.cc +++ b/poppler/Lexer.cc @@ -13,9 +13,9 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2010 Carlos Garcia Campos -// Copyright (C) 2006-2009 Albert Astals Cid +// Copyright (C) 2006-2010 Albert Astals Cid // Copyright (C) 2006 Krzysztof Kowalczyk +// Copyright (C) 2010 Carlos Garcia Campos // // 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 @@ -154,10 +154,11 @@ int Lexer::lookChar() { Object *Lexer::getObj(Object *obj, int objNum) { char *p; int c, c2; - GBool comment, neg, done, overflownInteger; + GBool comment, neg, done, overflownInteger, overflownUnsignedInteger; int numParen; int xi; - double xf, scale; + unsigned int xui = 0; + double xf = 0, scale; GooString *s; int n, m; @@ -185,6 +186,7 @@ Object *Lexer::getObj(Object *obj, int objNum) { case '5': case '6': case '7': case '8': case '9': case '+': case '-': case '.': overflownInteger = gFalse; + overflownUnsignedInteger = gFalse; neg = gFalse; xi = 0; if (c == '-') { @@ -199,12 +201,22 @@ Object *Lexer::getObj(Object *obj, int objNum) { if (isdigit(c)) { getChar(); if (unlikely(overflownInteger)) { - xf = xf * 10.0 + (c - '0'); + if (overflownUnsignedInteger) { + xf = xf * 10.0 + (c - '0'); + } else { + overflownUnsignedInteger = gTrue; + xf = xui * 10.0 + (c - '0'); + } } else { if (unlikely(xi > IntegerSafeLimit) && (xi > (INT_MAX - (c - '0')) / 10.0)) { overflownInteger = gTrue; - xf = xi * 10.0 + (c - '0'); + if (xi > (UINT_MAX - (c - '0')) / 10.0) { + overflownUnsignedInteger = gTrue; + xf = xi * 10.0 + (c - '0'); + } else { + xui = xi * 10.0 + (c - '0'); + } } else { xi = xi * 10 + (c - '0'); } @@ -219,7 +231,11 @@ Object *Lexer::getObj(Object *obj, int objNum) { if (neg) xi = -xi; if (unlikely(overflownInteger)) { - obj->initError(); + if (overflownUnsignedInteger) { + obj->initError(); + } else { + obj->initUint(xui); + } } else { obj->initInt(xi); } @@ -227,6 +243,8 @@ Object *Lexer::getObj(Object *obj, int objNum) { doReal: if (likely(!overflownInteger)) { xf = xi; + } else if (!overflownUnsignedInteger) { + xf = xui; } scale = 0.1; while (1) { diff --git a/poppler/Object.cc b/poppler/Object.cc index 49b2d44..9c05557 100644 --- a/poppler/Object.cc +++ b/poppler/Object.cc @@ -13,7 +13,7 @@ // All changes made under the Poppler project to this file are licensed // under GPL version 2 or later // -// Copyright (C) 2008 Albert Astals Cid +// Copyright (C) 2008, 2010 Albert Astals Cid // // 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 @@ -223,6 +223,9 @@ void Object::print(FILE *f) { case objNone: fprintf(f, ""); break; + case objUint: + fprintf(f, "%u", uintg); + break; } } diff --git a/poppler/Object.h b/poppler/Object.h index eb3fc33..a71dca8 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -15,7 +15,7 @@ // // Copyright (C) 2007 Julien Rebetez // Copyright (C) 2008 Kees Cook -// Copyright (C) 2008 Albert Astals Cid +// Copyright (C) 2008, 2010 Albert Astals Cid // Copyright (C) 2009 Jakub Wilk // // To see a description of the changes please see the Changelog file that @@ -96,10 +96,13 @@ enum ObjType { objCmd, // command name objError, // error return from Lexer objEOF, // end of file return from Lexer - objNone // uninitialized object + objNone, // uninitialized object + + // poppler-only objects + objUint // overflown integer }; -#define numObjTypes 14 // total number of object types +#define numObjTypes 15 // total number of object types //------------------------------------------------------------------------ // Object @@ -145,6 +148,8 @@ public: { initObj(objError); return this; } Object *initEOF() { initObj(objEOF); return this; } + Object *initUint(unsigned int uintgA) + { initObj(objUint); uintg = uintgA; return this; } // Copy an object. Object *copy(Object *obj); @@ -177,6 +182,7 @@ public: GBool isError() { return type == objError; } GBool isEOF() { return type == objEOF; } GBool isNone() { return type == objNone; } + GBool isUint() { return type == objUint; } // Special type checking. GBool isName(char *nameA) @@ -200,6 +206,7 @@ public: int getRefNum() { OBJECT_TYPE_CHECK(objRef); return ref.num; } int getRefGen() { OBJECT_TYPE_CHECK(objRef); return ref.gen; } char *getCmd() { OBJECT_TYPE_CHECK(objCmd); return cmd; } + unsigned int getUint() { OBJECT_TYPE_CHECK(objUint); return uintg; } // Array accessors. int arrayGetLength(); @@ -242,6 +249,7 @@ private: union { // value for each type: GBool booln; // boolean int intg; // integer + unsigned int uintg; // unsigned integer double real; // real GooString *string; // string char *name; // name diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc index ea91e21..630c753 100644 --- a/poppler/SecurityHandler.cc +++ b/poppler/SecurityHandler.cc @@ -6,6 +6,20 @@ // //======================================================================== +//======================================================================== +// +// Modified under the Poppler project - http://poppler.freedesktop.org +// +// All changes made under the Poppler project to this file are licensed +// under GPL version 2 or later +// +// Copyright (C) 2010 Albert Astals Cid +// +// 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 +// +//======================================================================== + #include #ifdef USE_GCC_PRAGMAS @@ -27,6 +41,8 @@ #endif #include "SecurityHandler.h" +#include + //------------------------------------------------------------------------ // SecurityHandler //------------------------------------------------------------------------ @@ -145,6 +161,12 @@ StandardSecurityHandler::StandardSecurityHandler(PDFDoc *docA, encryptDictA->dictLookup("O", &ownerKeyObj); encryptDictA->dictLookup("U", &userKeyObj); encryptDictA->dictLookup("P", &permObj); + if (permObj.isUint()) { + unsigned int permUint = permObj.getUint(); + int perms = permUint - UINT_MAX - 1; + permObj.free(); + permObj.initInt(perms); + } doc->getXRef()->getTrailerDict()->dictLookup("ID", &fileIDObj); if (versionObj.isInt() && revisionObj.isInt() && From sergio at sergiomb.no-ip.org Mon Jun 7 17:28:21 2010 From: sergio at sergiomb.no-ip.org (Sergio Monteiro Basto) Date: Tue, 08 Jun 2010 01:28:21 +0100 Subject: [poppler] man page of pdftoppm not metion cropbox Message-ID: <1275956901.8782.46.camel@segulix> Hi, pdftoppm --help 2>&1 | grep cropbox -cropbox : use the crop box rather than media box but man pdftoppm don't have cropbox . BTW: IMHO cropbox should be enabled by default . Thanks, -- S?rgio M. B. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3293 bytes Desc: not available URL: From aacid at kemper.freedesktop.org Tue Jun 8 11:36:39 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 11:36:39 -0700 (PDT) Subject: [poppler] poppler/XRef.cc Message-ID: <20100608183639.2937710057@kemper.freedesktop.org> poppler/XRef.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) New commits: commit 5ef45b1e72aed88ece0905b1204edee641f3c8fc Author: Albert Astals Cid Date: Tue Jun 8 19:35:20 2010 +0100 Do not exit when trying to allocate memory for the XRef fails See bug 28406 diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 1e60575..9d0cd3b 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -816,7 +816,11 @@ GBool XRef::constructXRef() { return gFalse; } entries = (XRefEntry *) - greallocn(entries, newSize, sizeof(XRefEntry)); + greallocn_checkoverflow(entries, newSize, sizeof(XRefEntry)); + if (entries == NULL) { + size = 0; + return gFalse; + } for (i = size; i < newSize; ++i) { entries[i].offset = 0xffffffff; entries[i].type = xrefEntryFree; From aacid at kde.org Tue Jun 8 11:50:50 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 19:50:50 +0100 Subject: [poppler] man page of pdftoppm not metion cropbox In-Reply-To: <1275956901.8782.46.camel@segulix> References: <1275956901.8782.46.camel@segulix> Message-ID: <201006081950.50592.aacid@kde.org> A Dimarts, 8 de juny de 2010, Sergio Monteiro Basto va escriure: > Hi, > > pdftoppm --help 2>&1 | grep cropbox > > -cropbox : use the crop box rather than media box > > but man pdftoppm don't have cropbox . > > BTW: IMHO cropbox should be enabled by default . Not going to happen, people has been using pdftoppm since ages and there's no reason for a behaviour change. > > Thanks, If you are going to report bugs i personally prefer bugzilla since it is much easier to keep track of things, if you are going to send patches both the list and the bugzilla are as good. Albert From sergio at sergiomb.no-ip.org Tue Jun 8 12:34:02 2010 From: sergio at sergiomb.no-ip.org (Sergio Monteiro Basto) Date: Tue, 08 Jun 2010 20:34:02 +0100 Subject: [poppler] man page of pdftoppm not metion cropbox In-Reply-To: <201006081950.50592.aacid@kde.org> References: <1275956901.8782.46.camel@segulix> <201006081950.50592.aacid@kde.org> Message-ID: <1276025642.6466.0.camel@segulix> On Tue, 2010-06-08 at 19:50 +0100, Albert Astals Cid wrote: > If you are going to report bugs i personally prefer bugzilla since it > is much > easier to keep track of things, if you are going to send patches both > the list > and the bugzilla are as good. https://bugs.freedesktop.org/show_bug.cgi?id=28452 Thanks, -- S?rgio M. B. -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 3293 bytes Desc: not available URL: From aacid at kemper.freedesktop.org Tue Jun 8 12:44:12 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 12:44:12 -0700 (PDT) Subject: [poppler] Changes to 'refs/tags/poppler-0.14.0' Message-ID: <20100608194412.EB57410058@kemper.freedesktop.org> Tag 'poppler-0.14.0' created by Albert Astals Cid at 2010-06-08 20:43 -0700 0.14.0 Changes since poppler-0.13.4-19: --- 0 files changed --- From aacid at kemper.freedesktop.org Tue Jun 8 12:44:35 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 12:44:35 -0700 (PDT) Subject: [poppler] Changes to 'poppler-0.14' Message-ID: <20100608194436.12CA710057@kemper.freedesktop.org> New branch 'poppler-0.14' available with the following commits: From aacid at kemper.freedesktop.org Tue Jun 8 12:46:17 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 12:46:17 -0700 (PDT) Subject: [poppler] 3 commits - CMakeLists.txt configure.ac cpp/Doxyfile glib/CMakeLists.txt glib/Makefile.am NEWS qt4/src Message-ID: <20100608194617.B725310057@kemper.freedesktop.org> CMakeLists.txt | 4 ++-- NEWS | 18 ++++++++++++++++++ configure.ac | 4 ++-- cpp/Doxyfile | 2 +- glib/CMakeLists.txt | 2 +- glib/Makefile.am | 2 +- qt4/src/CMakeLists.txt | 2 +- qt4/src/Doxyfile | 2 +- qt4/src/Makefile.am | 2 +- 9 files changed, 28 insertions(+), 10 deletions(-) New commits: commit f9e6cb9647981f7afbb20261b3ccedaf003657d2 Author: Albert Astals Cid Date: Tue Jun 8 20:43:11 2010 +0100 0.14.0 diff --git a/CMakeLists.txt b/CMakeLists.txt index 729532d..cf8a47a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,8 @@ include(MacroBoolTo01) find_package(Threads) set(POPPLER_MAJOR_VERSION "0") -set(POPPLER_MINOR_VERSION "13") -set(POPPLER_MICRO_VERSION "4") +set(POPPLER_MINOR_VERSION "14") +set(POPPLER_MICRO_VERSION "0") set(POPPLER_VERSION "${POPPLER_MAJOR_VERSION}.${POPPLER_MINOR_VERSION}.${POPPLER_MICRO_VERSION}") # command line switches diff --git a/NEWS b/NEWS index 5ffaa53..f4d7ac6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,21 @@ +Release 0.14.0 + + core: + * Fix crash when parsing pdf with broken JBIG2Stream (Bug #28170) + * Do not follow loops blindly when parsing XRef (Bug #28172) + * Allow quality & progressive mode to be utilised in JpegWriter + * Fix potential assert in Lexer code (KDE bug #240208) + * Fix opening of files whose /P is stored as unsigned integer + * Do not exit() when trying to allocate memory for the XRef fails + + cpp: + * Minor bugfixes + * Documentation improvements + + build system: + * Fix build in mingw32 when using autotools + * Preserve compiler flags when using cmake + Release 0.13.4 (0.14 RC 1) core: diff --git a/configure.ac b/configure.ac index 7979bca..48a3f15 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ m4_define([poppler_version_major],[0]) -m4_define([poppler_version_minor],[13]) -m4_define([poppler_version_micro],[4]) +m4_define([poppler_version_minor],[14]) +m4_define([poppler_version_micro],[0]) m4_define([poppler_version],[poppler_version_major.poppler_version_minor.poppler_version_micro]) AC_PREREQ(2.59) diff --git a/cpp/Doxyfile b/cpp/Doxyfile index e64c72e..c06415a 100644 --- a/cpp/Doxyfile +++ b/cpp/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler CPP" # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.13.4 +PROJECT_NUMBER = 0.14.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. diff --git a/qt4/src/Doxyfile b/qt4/src/Doxyfile index 4642707..5e9991a 100644 --- a/qt4/src/Doxyfile +++ b/qt4/src/Doxyfile @@ -31,7 +31,7 @@ PROJECT_NAME = "Poppler Qt4 " # This could be handy for archiving the generated documentation or # if some version control system is used. -PROJECT_NUMBER = 0.13.4 +PROJECT_NUMBER = 0.14.0 # The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) # base path where the generated documentation will be put. commit 963afdc39153fee69ecb939c98deeef4f64638de Author: Albert Astals Cid Date: Tue Jun 8 20:29:58 2010 +0100 libpoppler-qt4.so.3.2.0 -> libpoppler-qt4.so.3.3.0 diff --git a/qt4/src/CMakeLists.txt b/qt4/src/CMakeLists.txt index e2ad57a..8ad3fbc 100644 --- a/qt4/src/CMakeLists.txt +++ b/qt4/src/CMakeLists.txt @@ -29,7 +29,7 @@ set(poppler_qt4_SRCS ) qt4_automoc(${poppler_qt4_SRCS}) add_library(poppler-qt4 SHARED ${poppler_qt4_SRCS}) -set_target_properties(poppler-qt4 PROPERTIES VERSION 3.2.0 SOVERSION 3) +set_target_properties(poppler-qt4 PROPERTIES VERSION 3.3.0 SOVERSION 3) target_link_libraries(poppler-qt4 poppler ${QT4_QTCORE_LIBRARY} ${QT4_QTGUI_LIBRARY} ${QT4_QTXML_LIBRARY}) if(MSVC) target_link_libraries(poppler-qt4 poppler ${poppler_LIBS}) diff --git a/qt4/src/Makefile.am b/qt4/src/Makefile.am index 600d0cc..a2eda77 100644 --- a/qt4/src/Makefile.am +++ b/qt4/src/Makefile.am @@ -57,7 +57,7 @@ libpoppler_qt4_la_LIBADD = \ $(FONTCONFIG_LIBS) \ $(POPPLER_QT4_LIBS) -libpoppler_qt4_la_LDFLAGS = -version-info 5:0:2 @create_shared_lib@ +libpoppler_qt4_la_LDFLAGS = -version-info 6:0:3 @create_shared_lib@ # This rule lets GNU make create any *.moc from the equivalent *.h .h.moc: commit c1629be8011f3bddbf619246090640d62136d521 Author: Albert Astals Cid Date: Tue Jun 8 20:23:00 2010 +0100 Increase soname as _PopplerActionMovie struct grew diff --git a/glib/CMakeLists.txt b/glib/CMakeLists.txt index 29af638..c308219 100644 --- a/glib/CMakeLists.txt +++ b/glib/CMakeLists.txt @@ -78,7 +78,7 @@ set(poppler_glib_SRCS ${CMAKE_SOURCE_DIR}/poppler/CairoRescaleBox.cc ) add_library(poppler-glib SHARED ${poppler_glib_SRCS}) -set_target_properties(poppler-glib PROPERTIES VERSION 4.0.0 SOVERSION 4) +set_target_properties(poppler-glib PROPERTIES VERSION 5.0.0 SOVERSION 5) target_link_libraries(poppler-glib poppler ${GLIB2_LIBRARIES} ${CAIRO_LIBRARIES} ${FREETYPE_LIBRARIES}) if (GDK_FOUND) target_link_libraries(poppler-glib ${GDK2_LIBRARIES}) diff --git a/glib/Makefile.am b/glib/Makefile.am index 0616bef..f69c67a 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -74,7 +74,7 @@ libpoppler_glib_la_LIBADD = \ $(FREETYPE_LIBS) \ $(FONTCONFIG_LIBS) -libpoppler_glib_la_LDFLAGS = -version-info 4:0:0 @create_shared_lib@ @auto_import_flags@ +libpoppler_glib_la_LDFLAGS = -version-info 5:0:0 @create_shared_lib@ @auto_import_flags@ if BUILD_WITH_GDK noinst_PROGRAMS = test-poppler-glib From aacid at kde.org Tue Jun 8 12:50:34 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 20:50:34 +0100 Subject: [poppler] Poppler 0.14.0 released Message-ID: <201006082050.34158.aacid@kde.org> Available from http://poppler.freedesktop.org/poppler-0.14.0.tar.gz Changes against the 0.13.4 release: core: * Fix crash when parsing pdf with broken JBIG2Stream (Bug #28170) * Do not follow loops blindly when parsing XRef (Bug #28172) * Allow quality & progressive mode to be utilised in JpegWriter * Fix potential assert in Lexer code (KDE bug #240208) * Fix opening of files whose /P is stored as unsigned integer * Do not exit() when trying to allocate memory for the XRef fails cpp: * Minor bugfixes * Documentation improvements build system: * Fix build in mingw32 when using autotools * Preserve compiler flags when using cmake Testing, patches and bug reports welcome. I've also created the poppler-0.14 branch for fixes for the upcoming 0.14.x releases Albert From ken at hero.com Tue Jun 8 12:58:38 2010 From: ken at hero.com (Kenneth Berland) Date: Tue, 8 Jun 2010 12:58:38 -0700 (PDT) Subject: [poppler] commit? bounding box html in pdftotext In-Reply-To: <201005302133.55535.aacid@kde.org> References: <201005262049.18428.aacid@kde.org> <201005302133.55535.aacid@kde.org> Message-ID: Does GooString have a replace() method? I could not find one. Does this mean I should write one? -KB On Sun, 30 May 2010, Albert Astals Cid wrote: > A Diumenge, 30 de maig de 2010, Kenneth Berland va escriure: >> 1) Since I sent my last diff, I've: >> >> a) added some string processing to make sure no HTML reserved >> characters are placed into the output. I process each word. >> b) altered the html a bit so that XML parsers can deal with it. >> I've put in a title tag or an empty title tag and added end tags to the >> meta tags. >> >> 2) Addressing your concerns: >> >> a) I've removed the initialization of stdout. >> >> b) I close f now and reopen it. This also removes the warning. >> >> c) If a user is running with the -bbox option, they want word >> bounding boxes. If there are no words, I think a line to stderr is >> appropriate. > > Cool, though we try not to use the std (yeah it sucks i know), can you either > use GooString or char *? > > > Thanks, > Albert > > >> >> -KB >> >> On Wed, 26 May 2010, Albert Astals Cid wrote: >>> A Dimecres, 26 de maig de 2010, Kenneth Berland va escriure: >>>> I get a compiler warning without it. >>>> >>>> pdftotext.cc: In function ?int main(int, char**)?: >>>> pdftotext.cc:164: warning: ?f? may be used uninitialized in this >>>> function >>> >>> That change will not get accepted, sorry, initializing f to stdout is not >>> a solution. >>> >>> Also i do not like the fact that you do not close f if you are writing >>> the bbox? Can't you just open it again like the code already does? >>> >>> Also i do not understand why the code considers a page having no text an >>> error. >>> >>> Albert >>> >>>> -KB >>>> >>>> On Wed, 26 May 2010, Albert Astals Cid wrote: >>>>> A Diumenge, 9 de maig de 2010, Kenneth Berland va escriure: >>>>>> List, >>>>>> >>>>>> I've attached a small addition to pdftotext that outputs bounding box >>>>>> information to html like this: >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> >>>>> >>>>>> yMax="70.492000">The >>>>>> >>>>>> >>>>>> I had a need, maybe others will too. >>>>>> >>>>>> -KB >>>>> >>>>> Why is this change necessary? >>>>> >>>>> - FILE *f; >>>>> + FILE *f = stdout; >>>>> >>>>> Albert >>> >>> _______________________________________________ >>> poppler mailing list >>> poppler at lists.freedesktop.org >>> http://lists.freedesktop.org/mailman/listinfo/poppler > From lrosenth at adobe.com Tue Jun 8 12:04:16 2010 From: lrosenth at adobe.com (Leonard Rosenthol) Date: Tue, 8 Jun 2010 12:04:16 -0700 Subject: [poppler] man page of pdftoppm not metion cropbox In-Reply-To: <201006081950.50592.aacid@kde.org> References: <1275956901.8782.46.camel@segulix> <201006081950.50592.aacid@kde.org> Message-ID: I would argue that using the CropBox when present is actually a requirement of ISO 32000-1, so that if you do NOT do that by default, then you're violating the standard. But I also understand the "changing default behavior after many years" argument... Leonard -----Original Message----- From: poppler-bounces+leonardr=adobe.com at lists.freedesktop.org [mailto:poppler-bounces+leonardr=adobe.com at lists.freedesktop.org] On Behalf Of Albert Astals Cid Sent: Tuesday, June 08, 2010 2:51 PM To: poppler at lists.freedesktop.org Subject: Re: [poppler] man page of pdftoppm not metion cropbox A Dimarts, 8 de juny de 2010, Sergio Monteiro Basto va escriure: > Hi, > > pdftoppm --help 2>&1 | grep cropbox > > -cropbox : use the crop box rather than media box > > but man pdftoppm don't have cropbox . > > BTW: IMHO cropbox should be enabled by default . Not going to happen, people has been using pdftoppm since ages and there's no reason for a behaviour change. > > Thanks, If you are going to report bugs i personally prefer bugzilla since it is much easier to keep track of things, if you are going to send patches both the list and the bugzilla are as good. Albert _______________________________________________ poppler mailing list poppler at lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kemper.freedesktop.org Tue Jun 8 13:50:10 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 13:50:10 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - utils/pdftoppm.1 Message-ID: <20100608205010.ACADD10057@kemper.freedesktop.org> utils/pdftoppm.1 | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 129aeee14477263bd519a517714e81e854fa8ea6 Author: Albert Astals Cid Date: Tue Jun 8 21:49:40 2010 +0100 Add cropbox to the manpage diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1 index de2405c..3ca06c8 100644 --- a/utils/pdftoppm.1 +++ b/utils/pdftoppm.1 @@ -68,6 +68,9 @@ Specifies the height of crop area in pixels (default is 0) .BI \-sz " number" Specifies the size of crop square in pixels (sets W and H) .TP +.B \-cropbox +Useis the crop box rather than media box when generating the files +.TP .B \-mono Generate a monochrome PBM file (instead of a color PPM file). .TP From aacid at kemper.freedesktop.org Tue Jun 8 13:50:36 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 13:50:36 -0700 (PDT) Subject: [poppler] utils/pdftoppm.1 Message-ID: <20100608205036.83FBD10057@kemper.freedesktop.org> utils/pdftoppm.1 | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 57cc04ee1a122794b338c0d9818dbdaea46a42d6 Author: Albert Astals Cid Date: Tue Jun 8 21:49:40 2010 +0100 Add cropbox to the manpage diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1 index de2405c..3ca06c8 100644 --- a/utils/pdftoppm.1 +++ b/utils/pdftoppm.1 @@ -68,6 +68,9 @@ Specifies the height of crop area in pixels (default is 0) .BI \-sz " number" Specifies the size of crop square in pixels (sets W and H) .TP +.B \-cropbox +Useis the crop box rather than media box when generating the files +.TP .B \-mono Generate a monochrome PBM file (instead of a color PPM file). .TP From msclrhd at googlemail.com Tue Jun 8 13:52:54 2010 From: msclrhd at googlemail.com (Reece Dunn) Date: Tue, 8 Jun 2010 21:52:54 +0100 Subject: [poppler] utils/pdftoppm.1 In-Reply-To: <20100608205036.83FBD10057@kemper.freedesktop.org> References: <20100608205036.83FBD10057@kemper.freedesktop.org> Message-ID: On 8 June 2010 21:50, Albert Astals Cid wrote: > ?.TP > +.B \-cropbox > +Useis the crop box rather than media box when generating the files Shouldn't this be "Uses" rather than "useis"? - Reece From aacid at kde.org Tue Jun 8 13:54:40 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 21:54:40 +0100 Subject: [poppler] utils/pdftoppm.1 In-Reply-To: References: <20100608205036.83FBD10057@kemper.freedesktop.org> Message-ID: <201006082154.40537.aacid@kde.org> A Dimarts, 8 de juny de 2010, Reece Dunn va escriure: > On 8 June 2010 21:50, Albert Astals Cid wrote: > > .TP > > +.B \-cropbox > > +Useis the crop box rather than media box when generating the files > > Shouldn't this be "Uses" rather than "useis"? Yeah, that's what happens when you use vim to edit, that you end up with to many 'i' :D Albert > > - Reece > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kemper.freedesktop.org Tue Jun 8 13:55:07 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 13:55:07 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - utils/pdftoppm.1 Message-ID: <20100608205507.F414810058@kemper.freedesktop.org> utils/pdftoppm.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 37b79fed454f2ba3b91464a3e4cfffe231e51df9 Author: Albert Astals Cid Date: Tue Jun 8 21:54:52 2010 +0100 Typo-- diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1 index 3ca06c8..cbc3ba9 100644 --- a/utils/pdftoppm.1 +++ b/utils/pdftoppm.1 @@ -69,7 +69,7 @@ Specifies the height of crop area in pixels (default is 0) Specifies the size of crop square in pixels (sets W and H) .TP .B \-cropbox -Useis the crop box rather than media box when generating the files +Uses the crop box rather than media box when generating the files .TP .B \-mono Generate a monochrome PBM file (instead of a color PPM file). From aacid at kemper.freedesktop.org Tue Jun 8 13:55:33 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 13:55:33 -0700 (PDT) Subject: [poppler] utils/pdftoppm.1 Message-ID: <20100608205533.781C310057@kemper.freedesktop.org> utils/pdftoppm.1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 7dfdf1ee293b7d36a049a90d8a17462ed0e50f2c Author: Albert Astals Cid Date: Tue Jun 8 21:54:52 2010 +0100 Typo-- diff --git a/utils/pdftoppm.1 b/utils/pdftoppm.1 index 3ca06c8..cbc3ba9 100644 --- a/utils/pdftoppm.1 +++ b/utils/pdftoppm.1 @@ -69,7 +69,7 @@ Specifies the height of crop area in pixels (default is 0) Specifies the size of crop square in pixels (sets W and H) .TP .B \-cropbox -Useis the crop box rather than media box when generating the files +Uses the crop box rather than media box when generating the files .TP .B \-mono Generate a monochrome PBM file (instead of a color PPM file). From aacid at kde.org Tue Jun 8 13:59:32 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 21:59:32 +0100 Subject: [poppler] Poppler 0.14.x series Message-ID: <201006082159.32278.aacid@kde.org> As with previous poppler releases i plan to run monthly bugfix releases of the poppler 0.14.x series from the poppler-0.14 branch. Albert From aacid at kde.org Tue Jun 8 14:11:29 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 22:11:29 +0100 Subject: [poppler] Poppler 0.16.0 schedule Message-ID: <201006082211.30025.aacid@kde.org> Hi, I know it's early, but the earlier the better, so let's discuss the Poppler 0.16 release schedule: This is my proposed schedule: * Set 15 Poppler 0.15.0 (0.16 Alpha) * Oct 13 (+4 weeks) Poppler 0.15.1 (0.16 Beta) * Oct 27 (+2 weeks) Poppler 0.15.2 (0.16 Beta 2) * Nov 10 (+2 weeks) Poppler 0.15.3 (0.16 RC) * Dec 8 (+4 weeks) Poppler 0.16.0 We could accept new features until Beta 2. Afterwards it's just bugfixing. Comments? Albert From aacid at kde.org Tue Jun 8 14:35:00 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 8 Jun 2010 22:35:00 +0100 Subject: [poppler] commit? bounding box html in pdftotext In-Reply-To: References: <201005302133.55535.aacid@kde.org> Message-ID: <201006082235.00166.aacid@kde.org> A Dimarts, 8 de juny de 2010, v?reu escriure: > Does GooString have a replace() method? I could not find one. Does this > mean I should write one? Yes, you'll have to write one or get the char * from the GooString and use c- string ones. Albert > > -KB > > On Sun, 30 May 2010, Albert Astals Cid wrote: > > A Diumenge, 30 de maig de 2010, Kenneth Berland va escriure: > >> 1) Since I sent my last diff, I've: > >> a) added some string processing to make sure no HTML reserved > >> > >> characters are placed into the output. I process each word. > >> > >> b) altered the html a bit so that XML parsers can deal with it. > >> > >> I've put in a title tag or an empty title tag and added end tags to the > >> meta tags. > >> > >> 2) Addressing your concerns: > >> a) I've removed the initialization of stdout. > >> > >> b) I close f now and reopen it. This also removes the warning. > >> > >> c) If a user is running with the -bbox option, they want word > >> > >> bounding boxes. If there are no words, I think a line to stderr is > >> appropriate. > > > > Cool, though we try not to use the std (yeah it sucks i know), can you > > either use GooString or char *? > > > > > > Thanks, > > > > Albert > > > >> -KB > >> > >> On Wed, 26 May 2010, Albert Astals Cid wrote: > >>> A Dimecres, 26 de maig de 2010, Kenneth Berland va escriure: > >>>> I get a compiler warning without it. > >>>> > >>>> pdftotext.cc: In function ?int main(int, char**)?: > >>>> pdftotext.cc:164: warning: ?f? may be used uninitialized in this > >>>> function > >>> > >>> That change will not get accepted, sorry, initializing f to stdout is > >>> not a solution. > >>> > >>> Also i do not like the fact that you do not close f if you are writing > >>> the bbox? Can't you just open it again like the code already does? > >>> > >>> Also i do not understand why the code considers a page having no text > >>> an error. > >>> > >>> Albert > >>> > >>>> -KB > >>>> > >>>> On Wed, 26 May 2010, Albert Astals Cid wrote: > >>>>> A Diumenge, 9 de maig de 2010, Kenneth Berland va escriure: > >>>>>> List, > >>>>>> > >>>>>> I've attached a small addition to pdftotext that outputs bounding > >>>>>> box information to html like this: > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> > >>>>>> >>>>>> > >>>>>> yMax="70.492000">The > >>>>>> > >>>>>> > >>>>>> I had a need, maybe others will too. > >>>>>> > >>>>>> -KB > >>>>> > >>>>> Why is this change necessary? > >>>>> > >>>>> - FILE *f; > >>>>> + FILE *f = stdout; > >>>>> > >>>>> Albert > >>> > >>> _______________________________________________ > >>> poppler mailing list > >>> poppler at lists.freedesktop.org > >>> http://lists.freedesktop.org/mailman/listinfo/poppler From leenagour at gmail.com Wed Jun 9 03:05:03 2010 From: leenagour at gmail.com (leena chourey) Date: Wed, 9 Jun 2010 15:35:03 +0530 Subject: [poppler] For Accessibility of pdf document: changes required in pdftohtml complex output Message-ID: Dear poppler developers, I am new to this list, and working on Gnome accessibility. To read pdf document, visually impaired person uses screen reader, but very less support is provided by the opensource communities. We are working in the same line and trying to make pdf document accessible using screen reader Orca. We have analysed various options in this reagard, that includes exploration of evince document viewer, orca accessibility features for pdf document and more. As a first step, we have decided to use pdftohtml utility to provide pdf content in html format, so that orca can the pdf content available in html format. Observations while exploring poppler-0.12.4 (utils): - Poppler-utils has a pdftohtml facility to generate html file for pdf document, Similarly with -c option it can generate the formatted html file for corresponding pdf. -c generates file_ind.html, file_outline.html, file.html and 1 .html & .png for each page of pdf. (please confirm) - While working on this file.html in firefox, we have observed that this links/contains only index file (file_ind.html) and file1.html (first page html) file. To shift to another page, I have to click on that page from index, which opens the corresponding page in new tab of firefox. So for every page one new tab will open. (please confirm) - I don't find way to return to previous page or jump to some particular page. For a person with perfect vision, no issues in reading pdfcontent in complex html format. But to ensure that the complex html format is as much as similar to pdfdocument displayed using any document viewer and to make html format more accessible and usable by a blind person, we found that following issues need to be resolved. As mentioned above for accessibility, now if a blind person reads file.html then following are some issues : 1. Because file.html uses frameset/frame so orca is not able to shift control from 1 frame to another. it shifted after reading full content of one frame (with tab). Normal person can shift from frame to frame with the help of mouse, but with tab it is not possible to skip no. of tabs. 2. If a blind person want to read/shift to another page , it opens in new tab, it will be confusing for her/him to handle no of tabs (1 for each page). 3. Some more issues are there related with content format can be discussed in further communication To resolve first 2 issues, it is required to have changes in pdftohtml -c utility, that will make html document more accessible and usable to a visually impaired person. With regards Leena -------------- next part -------------- An HTML attachment was scrubbed... URL: From aacid at kemper.freedesktop.org Wed Jun 9 10:56:56 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Wed, 9 Jun 2010 10:56:56 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - Makefile.am Message-ID: <20100609175656.807AD10057@kemper.freedesktop.org> Makefile.am | 2 ++ 1 file changed, 2 insertions(+) New commits: commit b2427d038e1bd1564147b2e0215b41f2e5f95f64 Author: Albert Astals Cid Date: Wed Jun 9 18:56:16 2010 +0100 we need to ship these two files Bug 28458 diff --git a/Makefile.am b/Makefile.am index eaaac4f..a3cc7c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,6 +73,8 @@ EXTRA_DIST += \ cmake/modules/COPYING-CMAKE-SCRIPTS \ cmake/modules/FindCairo.cmake \ cmake/modules/FindFontconfig.cmake \ + cmake/modules/FindGDK.cmake \ + cmake/modules/FindGLIB.cmake \ cmake/modules/FindGTK.cmake \ cmake/modules/FindIconv.cmake \ cmake/modules/FindLCMS.cmake \ From aacid at kemper.freedesktop.org Wed Jun 9 10:57:53 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Wed, 9 Jun 2010 10:57:53 -0700 (PDT) Subject: [poppler] Makefile.am Message-ID: <20100609175754.0071F10057@kemper.freedesktop.org> Makefile.am | 2 ++ 1 file changed, 2 insertions(+) New commits: commit eb0206ba8458f1dba004ac7bef856dcbb2ccbba5 Author: Albert Astals Cid Date: Wed Jun 9 18:56:16 2010 +0100 we need to ship these two files Bug 28458 diff --git a/Makefile.am b/Makefile.am index eaaac4f..a3cc7c8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -73,6 +73,8 @@ EXTRA_DIST += \ cmake/modules/COPYING-CMAKE-SCRIPTS \ cmake/modules/FindCairo.cmake \ cmake/modules/FindFontconfig.cmake \ + cmake/modules/FindGDK.cmake \ + cmake/modules/FindGLIB.cmake \ cmake/modules/FindGTK.cmake \ cmake/modules/FindIconv.cmake \ cmake/modules/FindLCMS.cmake \ From srinivas.adicherla at gmail.com Thu Jun 10 03:13:25 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Thu, 10 Jun 2010 15:43:25 +0530 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary, get page labels . Message-ID: Hi, This Patch does the following: 1) gets and set the pdf IDs in the trailer dictionary. 2) get all page labels & get page labels by index. Kindly let me know if You commit this patch. Thanks A Srinivas -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler.patch Type: text/x-patch Size: 4859 bytes Desc: not available URL: From pino at kde.org Thu Jun 10 04:01:58 2010 From: pino at kde.org (Pino Toscano) Date: Thu, 10 Jun 2010 13:01:58 +0200 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary, get page labels . In-Reply-To: References: Message-ID: <201006101302.07643.pino@kde.org> Hi, I'm not a poppler-glib developer, but there are few notes below. Alle gioved? 10 giugno 2010, srinivas adicherla ha scritto: > +/* following three functions has added to get and set pdf ID stored > in Trailer Dictionary*/ > +static void > +get_id(char* id,char *buff) { > + > + int i; > + for( i = 0; i < 16; i++ ) { > + > + char *buf = (char*)malloc(3*sizeof(char)); > + sprintf(buf,"%02x",id[i] & 0xff); > + > + if(i == 0) strcpy(buff,buf); > + else strcat(buff,buf); > + > + free (buf); > + } > +} This is pretty inefficient: you are allocating on the heap 3 bytes 16 times (!). It would be much better if you could just use an array of 3 chars on stack, and reuse it at every iteration. (Minor: a better naming than 'buf' and 'buff' would help a lot to distinguish them.) > + > +gboolean > +poppler_document_get_trailer_id(char *uri,char *password,char > *id[2]) { > [...] > + for(int i=0; i<2; i++) { > + id[i] = (char*)malloc(32*sizeof(char)); > + } Excluding the fact that such for loop is useless (just manually do the two calls it does), why do you dynamically malloc the two result strings if you already know they will be 32 chars long? Then, instead of a out parameter of a two-strings array, just use two out parameters of 32 bytes. > +void * > +poppler_document_generate_and_set_id(char *uri,char *password) { If this function returns nothing, then declare it as void, not as void*. > +char* > +poppler_document_get_page_label_by_index(PopplerDocument *document, > + int index) > +{ > + GooString *string = new GooString(); > + Catalog *catalog = document->doc->getCatalog (); > + > + catalog->indexToLabel(index,string); > + > + char *label = string->getCString(); > + return label; > +} 'string' is leaked here, just put it on stack. > +char** > +poppler_document_get_page_labels(PopplerDocument *document) > +{ > + > + char **labels; > + Catalog *catalog= document->doc->getCatalog (); > + int npages = poppler_document_get_n_pages(document); > + > + labels = (char**)malloc(sizeof(char*)*npages); > + > + int i; > + for(i = 0; i < npages; i++) { > + > + GooString *label = new GooString(); > + catalog->indexToLabel(i,label); > + labels[i] = label->getCString(); > + } > + return labels; > +} This is tricker: the 'label' allocated at each loop is leaked, but you use its internal storage as return value. As before, put the GooString on stack, but strdup its storage. > +/* Labels */ > +char* > +poppler_document_get_page_label_by_index(PopplerDocument *document, > + int index); > +char** > +poppler_document_get_page_labels(PopplerDocument *document); A label is specific to every page, so I guess these two functions would quite more suited as part of the PopplerPage API. Also, they miss they are not documented with gtk-doc, just like the rest of the glib API. > +/*Get the PDF ID from the trailer dictionary. Pdf Id contains two > strings of length 16 bytes each, represented in Hex*/ > +gboolean poppler_document_get_trailer_id(char *uri,char > *password,char *id[2]); > + > +/*Generate the Pdf Id and set it in the Pdf file*/ > +void *poppler_document_generate_and_set_id(char *uri,char > *password); Most probably they should not be just "free functions", but be part of the PopplerDocument API, so you first open a document as usual, then get its trailer and then free the document. Also, the uri and password parameters should be 'const', to indicate they won't be changed in the functions. And as above, they miss gtk-doc API documentation. -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 190 bytes Desc: This is a digitally signed message part. URL: From srinivas.adicherla at gmail.com Thu Jun 10 22:04:23 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Fri, 11 Jun 2010 10:34:23 +0530 Subject: [poppler] poppler Digest, Vol 64, Issue 7 In-Reply-To: References: Message-ID: Hi Pino Toscano, Thank you for your valuable suggestions, I will make those changes and send the patch again. Thanks & Regards A Srinivas On Fri, Jun 11, 2010 at 12:30 AM, wrote: > Send poppler mailing list submissions to > poppler at lists.freedesktop.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freedesktop.org/mailman/listinfo/poppler > or, via email, send a message with subject or body 'help' to > poppler-request at lists.freedesktop.org > > You can reach the person managing the list at > poppler-owner at lists.freedesktop.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of poppler digest..." > > > Today's Topics: > > 1. Patch to Get/Set PDF ID in the trailer dictionary, get page > labels . (srinivas adicherla) > 2. Re: Patch to Get/Set PDF ID in the trailer dictionary, get > page labels . (Pino Toscano) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Thu, 10 Jun 2010 15:43:25 +0530 > From: srinivas adicherla > Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary, > get page labels . > To: poppler at lists.freedesktop.org > Message-ID: > > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > > This Patch does the following: > > 1) gets and set the pdf IDs in the trailer dictionary. > 2) get all page labels & get page labels by index. > > Kindly let me know if You commit this patch. > > > Thanks > A Srinivas > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: < > http://lists.freedesktop.org/archives/poppler/attachments/20100610/61154402/attachment.htm > > > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: srinivas_poppler.patch > Type: text/x-patch > Size: 4859 bytes > Desc: not available > URL: < > http://lists.freedesktop.org/archives/poppler/attachments/20100610/61154402/attachment-0001.bin > > > > ------------------------------ > > Message: 2 > Date: Thu, 10 Jun 2010 13:01:58 +0200 > From: Pino Toscano > Subject: Re: [poppler] Patch to Get/Set PDF ID in the trailer > dictionary, get page labels . > To: poppler at lists.freedesktop.org > Message-ID: <201006101302.07643.pino at kde.org> > Content-Type: text/plain; charset="iso-8859-1" > > Hi, > > I'm not a poppler-glib developer, but there are few notes below. > > Alle gioved? 10 giugno 2010, srinivas adicherla ha scritto: > > +/* following three functions has added to get and set pdf ID stored > > in Trailer Dictionary*/ > > +static void > > +get_id(char* id,char *buff) { > > + > > + int i; > > + for( i = 0; i < 16; i++ ) { > > + > > + char *buf = (char*)malloc(3*sizeof(char)); > > + sprintf(buf,"%02x",id[i] & 0xff); > > + > > + if(i == 0) strcpy(buff,buf); > > + else strcat(buff,buf); > > + > > + free (buf); > > + } > > +} > > This is pretty inefficient: you are allocating on the heap 3 bytes 16 > times (!). It would be much better if you could just use an array of 3 > chars on stack, and reuse it at every iteration. > (Minor: a better naming than 'buf' and 'buff' would help a lot to > distinguish them.) > > > + > > +gboolean > > +poppler_document_get_trailer_id(char *uri,char *password,char > > *id[2]) { > > [...] > > + for(int i=0; i<2; i++) { > > + id[i] = (char*)malloc(32*sizeof(char)); > > + } > > Excluding the fact that such for loop is useless (just manually do the > two calls it does), why do you dynamically malloc the two result strings > if you already know they will be 32 chars long? Then, instead of a out > parameter of a two-strings array, just use two out parameters of 32 > bytes. > > > +void * > > +poppler_document_generate_and_set_id(char *uri,char *password) { > > If this function returns nothing, then declare it as void, not as void*. > > > +char* > > +poppler_document_get_page_label_by_index(PopplerDocument *document, > > + int index) > > +{ > > + GooString *string = new GooString(); > > + Catalog *catalog = document->doc->getCatalog (); > > + > > + catalog->indexToLabel(index,string); > > + > > + char *label = string->getCString(); > > + return label; > > +} > > 'string' is leaked here, just put it on stack. > > > +char** > > +poppler_document_get_page_labels(PopplerDocument *document) > > +{ > > + > > + char **labels; > > + Catalog *catalog= document->doc->getCatalog (); > > + int npages = poppler_document_get_n_pages(document); > > + > > + labels = (char**)malloc(sizeof(char*)*npages); > > + > > + int i; > > + for(i = 0; i < npages; i++) { > > + > > + GooString *label = new GooString(); > > + catalog->indexToLabel(i,label); > > + labels[i] = label->getCString(); > > + } > > + return labels; > > +} > > This is tricker: the 'label' allocated at each loop is leaked, but you > use its internal storage as return value. As before, put the GooString > on stack, but strdup its storage. > > > +/* Labels */ > > +char* > > +poppler_document_get_page_label_by_index(PopplerDocument *document, > > + int index); > > +char** > > +poppler_document_get_page_labels(PopplerDocument *document); > > A label is specific to every page, so I guess these two functions would > quite more suited as part of the PopplerPage API. > Also, they miss they are not documented with gtk-doc, just like the rest > of the glib API. > > > +/*Get the PDF ID from the trailer dictionary. Pdf Id contains two > > strings of length 16 bytes each, represented in Hex*/ > > +gboolean poppler_document_get_trailer_id(char *uri,char > > *password,char *id[2]); > > + > > +/*Generate the Pdf Id and set it in the Pdf file*/ > > +void *poppler_document_generate_and_set_id(char *uri,char > > *password); > > Most probably they should not be just "free functions", but be part of > the PopplerDocument API, so you first open a document as usual, then get > its trailer and then free the document. > Also, the uri and password parameters should be 'const', to indicate > they won't be changed in the functions. And as above, they miss gtk-doc > API documentation. > > -- > Pino Toscano > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: not available > Type: application/pgp-signature > Size: 190 bytes > Desc: This is a digitally signed message part. > URL: < > http://lists.freedesktop.org/archives/poppler/attachments/20100610/36cd404b/attachment-0001.pgp > > > > ------------------------------ > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > > > End of poppler Digest, Vol 64, Issue 7 > ************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From leenagour at gmail.com Fri Jun 11 02:41:11 2010 From: leenagour at gmail.com (leena chourey) Date: Fri, 11 Jun 2010 15:11:11 +0530 Subject: [poppler] Accessibility of PDF documents In-Reply-To: References: Message-ID: Dear all, This is in continuation to our last communication related with *Accessibility of Pdf document.* As discussed last time, we have now completed the first prototype version of the same and we are making it available for your testing and valuable comments/feedback. As mentioned last time, we convert the PDF file into HTML format and open the same automatically in Firefox. Enclosed with this email is the ReadMe file which explains the steps to download, install and run this enhancement. Please try out the same and give us your valuable feedback. We have tested it at our end by different teams and have found that it works well in most cases. Some places where we feel work is required are as follows: - Sometimes Orca in not able to read header and footer of page - Some character combinations are displayed as garbage like 'ft', 'tt' - Content in table format is spoken by orca but it does not say the row and column reference. Means a user can not find out that orca is reading table content. (as orca does table reading in openoffice writer) We are working on these. Waiting to hear more from all. With regards Leena C -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ReadMe.odt Type: application/vnd.oasis.opendocument.text Size: 27815 bytes Desc: not available URL: From carlosgc at gnome.org Fri Jun 11 03:31:47 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Fri, 11 Jun 2010 12:31:47 +0200 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary, get page labels . In-Reply-To: References: Message-ID: <1276251137-sup-4795@charmaleon> Excerpts from srinivas adicherla's message of jue jun 10 12:13:25 +0200 2010: > Hi, Hi srinivas, > This Patch does the following: Thanks for the patch, I some comments: > 1) gets and set the pdf IDs in the trailer dictionary. The code to get ID could be moved to the core, so that it can be used by other frontends, someting like PDFDoc::getID(). In the glib frontend, instead of returning an array we could use a struct so that we can also give names to the fields, since the first id is the permanent id and the second one is the id that changes when the document is updated. Something like typedef struct _PopplerDocumentId { gchar permanent_id[32]; gchar update_id[32]; } PopplerDocumentId; The method generate_and_set_id() shouldn't be necessary since PDFDoc::saveAS() already generates a new id. > 2) get all page labels & get page labels by index. We already have labels in the glib frontend, it's property of PopplerPage that can be obtained with g_object_get (page, "label", &label, NULL); I don't think we need that API in PopplerDocument, but we should probably expose it in the PopplerPage API to make it easier to find. > Kindly let me know if You commit this patch. > > > Thanks > A Srinivas -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aacid at kde.org Fri Jun 11 15:04:47 2010 From: aacid at kde.org (Albert Astals Cid) Date: Fri, 11 Jun 2010 23:04:47 +0100 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary, get page labels . In-Reply-To: <1276251137-sup-4795@charmaleon> References: <1276251137-sup-4795@charmaleon> Message-ID: <201006112304.47162.aacid@kde.org> A Divendres, 11 de juny de 2010, Carlos Garcia Campos va escriure: > Excerpts from srinivas adicherla's message of jue jun 10 12:13:25 +0200 2010: > > Hi, > > Hi srinivas, > > > This Patch does the following: > Thanks for the patch, I some comments: > > 1) gets and set the pdf IDs in the trailer dictionary. > > The code to get ID could be moved to the core, so that it can be used > by other frontends, someting like PDFDoc::getID(). I'd like the more code in the core as possible. Albert From gamaral at kdab.com Fri Jun 11 21:35:15 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Fri, 11 Jun 2010 21:35:15 -0700 Subject: [poppler] Form-Reset and Print [patches] Message-ID: <20100612043514.GA9180@daedalus.localdomain> Hi Guys, I wanted to send in these patches, they allow handling of reset-form and print actions respectably. Please check them out, and if you have any questions please don't hesitate to ask. Cheers, GA -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions -------------- next part -------------- diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..48b558d 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -357,7 +357,8 @@ class POPPLER_QT4_EXPORT LinkAction : public Link EndPresentation = 9, Find = 10, GoToPage = 11, - Close = 12 }; + Close = 12, + Print = 13 }; /** * The action of the current LinkAction diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..8aea6ce 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -129,6 +129,8 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo popplerLink = new LinkAction( linkArea, LinkAction::Find ); else if ( !strcmp( name, "FullScreen" ) ) popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); + else if ( !strcmp( name, "Print" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Print ); else if ( !strcmp( name, "Close" ) ) { // acroread closes the document always, doesnt care whether -------------- next part -------------- diff --git a/poppler/Link.cc b/poppler/Link.cc index 5d7b779..9c51f27 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { } else if (obj2.isName("SetOCGState")) { action = new LinkOCGState(obj); + // ResetForm action + } else if (obj2.isName("ResetForm")) { + action = new LinkResetForm(obj2.getName()); + // unknown action } else if (obj2.isName()) { action = new LinkUnknown(obj2.getName()); @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { } //------------------------------------------------------------------------ +// LinkFormClear +//------------------------------------------------------------------------ + +LinkResetForm::LinkResetForm(char *actionA) { + action = new GooString(actionA); +} + +LinkResetForm::~LinkResetForm() { + delete action; +} + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/poppler/Link.h b/poppler/Link.h index ea10375..962d596 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -53,6 +53,7 @@ enum LinkActionKind { actionSound, // sound action actionJavaScript, // JavaScript action actionOCGState, // Set-OCG-State action + actionResetForm, // Reset form action actionUnknown // anything else }; @@ -429,6 +430,31 @@ private: }; //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +class LinkResetForm: public LinkAction { +public: + + // Build a LinkResetForm with the specified action type. + LinkResetForm(char *actionA); + + // Destructor. + virtual ~LinkResetForm(); + + // Was the LinkResetForm create successfully? + virtual GBool isOk() { return action != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionResetForm; } + GooString *getAction() { return action; } + +private: + + GooString *action; // action subtype +}; + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc index 6224b68..4ce4465 100644 --- a/qt4/src/poppler-form.cc +++ b/qt4/src/poppler-form.cc @@ -139,14 +139,24 @@ Link* FormField::activationAction() const Object tmp; Object *obj = m_formData->fm->getObj(); Link* action = 0; + ::LinkAction *act = 0; + if (obj->dictLookup("A", &tmp)->isDict()) { - ::LinkAction *act = ::LinkAction::parseAction(&tmp, m_formData->doc->doc->getCatalog()->getBaseURI()); - if (act) - { - action = PageData::convertLinkActionToLink(act, m_formData->doc, QRectF()); - delete act; - } + act = ::LinkAction::parseAction(&tmp, m_formData->doc->doc->getCatalog()->getBaseURI()); + } + else if (obj->dictLookup("AA", &tmp)->isDict()) + { + Object tmp1; + if (tmp.dictLookup("D", &tmp1)->isDict()) + act = ::LinkAction::parseAction(&tmp1, m_formData->doc->doc->getCatalog()->getBaseURI()); + tmp1.free(); + } + + if (act) + { + action = PageData::convertLinkActionToLink(act, m_formData->doc, QRectF()); + delete act; } tmp.free(); return action; diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc index de06242..80c390c 100644 --- a/qt4/src/poppler-link.cc +++ b/qt4/src/poppler-link.cc @@ -179,6 +179,19 @@ class LinkMoviePrivate : public LinkPrivate } #endif +class LinkFormActionPrivate : public LinkPrivate +{ + public: + LinkFormActionPrivate( const QRectF &area ); + + LinkFormAction::ActionType type; +}; + + LinkFormActionPrivate::LinkFormActionPrivate( const QRectF &area ) + : LinkPrivate( area ) + { + } + static void cvtUserToDev(::Page *page, double xu, double yu, int *xd, int *yd) { double ctm[6]; @@ -581,4 +594,27 @@ class LinkMoviePrivate : public LinkPrivate } #endif + // LinkFormAction + LinkFormAction::LinkFormAction( const QRectF &linkArea, ActionType actionType ) + : Link( *new LinkFormActionPrivate( linkArea ) ) + { + Q_D( LinkFormAction ); + d->type = actionType; + } + + LinkFormAction::~LinkFormAction() + { + } + + LinkFormAction::ActionType LinkFormAction::actionType() const + { + Q_D( const LinkFormAction ); + return d->type; + } + + Link::LinkType LinkFormAction::linkType() const + { + return FormAction; + } + } diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..f037642 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -39,6 +39,7 @@ class LinkJavaScriptPrivate; class LinkMoviePrivate; class LinkDestinationData; class LinkDestinationPrivate; +class LinkFormActionPrivate; class SoundObject; /** @@ -182,7 +183,8 @@ class POPPLER_QT4_EXPORT Link Action, ///< A "standard" action to be executed in the viewer Sound, ///< A link representing a sound to be played Movie, ///< An action to be executed on a movie - JavaScript ///< A JavaScript code to be interpreted \since 0.10 + JavaScript, ///< A JavaScript code to be interpreted \since 0.10 + FormAction ///< A "form" action to be executed in the viewer }; /** @@ -484,6 +486,46 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link }; #endif +/** + * \brief "Form" action request. + * + * The LinkFormAction class represents a link that request a "form" action + * to be performed by the viewer on the displayed document. + */ +class POPPLER_QT4_EXPORT LinkFormAction : public Link +{ + public: + /** + * The possible types of actions + */ + enum ActionType { Submit = 1, + Reset = 2, + ImportData = 3 }; + + /** + * The action of the current LinkFormAction + */ + ActionType actionType() const; + + /** + * Create a new Action link, that executes a specified action + * on the document. + * + * \param linkArea the active area of the link + * \param actionType which action should be executed + */ + LinkFormAction( const QRectF &linkArea, ActionType actionType ); + /** + * Destructor. + */ + ~LinkFormAction(); + LinkType linkType() const; + + private: + Q_DECLARE_PRIVATE( LinkFormAction ) + Q_DISABLE_COPY( LinkFormAction ) +}; + } #endif diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..b0b2871 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -174,6 +174,10 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo copyString( m_uri, m->getTitle()->getCString() ); */ break; + case actionResetForm: + popplerLink = new LinkFormAction( linkArea, LinkFormAction::Reset ); + break; + case actionUnknown: break; } From hib at hiberis.nl Sat Jun 12 03:37:24 2010 From: hib at hiberis.nl (Hib Eris) Date: Sat, 12 Jun 2010 12:37:24 +0200 Subject: [poppler] Linearization support Message-ID: Hi all, Now that 0.14.0 is out and feature freeze is over, I have updated my linearization patches (see http://lists.freedesktop.org/archives/poppler/2010-April/005760.html) to current master. Any comments on it are very welcome. Cheers, Hib Eris -------------- next part -------------- From 1a6b5893f3c24f7fa24c7356f90d70612e1a3f85 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 6 Apr 2010 19:24:42 +0200 Subject: [PATCH 01/12] Cleanup XRef constructors --- poppler/XRef.cc | 14 ++++++-------- poppler/XRef.h | 1 + 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 9d0cd3b..8aeaee7 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -226,7 +226,7 @@ Object *ObjectStream::getObject(int objIdx, int objNum, Object *obj) { // XRef //------------------------------------------------------------------------ -XRef::XRef() { +void XRef::init() { ok = gTrue; errCode = errNone; entries = NULL; @@ -236,17 +236,15 @@ XRef::XRef() { objStr = NULL; } +XRef::XRef() { + init(); +} + XRef::XRef(BaseStream *strA) { Guint pos; Object obj; - ok = gTrue; - errCode = errNone; - size = 0; - entries = NULL; - streamEnds = NULL; - streamEndsLen = 0; - objStr = NULL; + init(); encrypted = gFalse; permFlags = defPermFlags; diff --git a/poppler/XRef.h b/poppler/XRef.h index 36546fc..b03ff73 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -156,6 +156,7 @@ private: Guchar fileKey[16]; // file decryption key GBool ownerPasswordOk; // true if owner password is correct + void init(); Guint getStartXref(); GBool readXRef(Guint *pos, GooVector *followedXRefStm); GBool readXRefTable(Parser *parser, Guint *pos, GooVector *followedXRefStm); -- 1.6.4.2 From dba695175b8caa35569cb925218dec4fc5a95a7b Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 6 Apr 2010 19:16:45 +0200 Subject: [PATCH 02/12] Create no more XRef entries than specified --- poppler/XRef.cc | 136 ++++++++++++++++++++++++++++--------------------------- poppler/XRef.h | 5 ++- 2 files changed, 73 insertions(+), 68 deletions(-) diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 8aeaee7..9ca8d5a 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -230,6 +230,7 @@ void XRef::init() { ok = gTrue; errCode = errNone; entries = NULL; + capacity = 0; size = 0; streamEnds = NULL; streamEndsLen = 0; @@ -312,6 +313,56 @@ XRef::~XRef() { } } +int XRef::reserve(int newSize) +{ + if (newSize > capacity) { + + int realNewSize; + for (realNewSize = capacity ? 2 * capacity : 1024; + newSize > realNewSize && realNewSize > 0; + realNewSize <<= 1) ; + if ((realNewSize < 0) || + (realNewSize >= INT_MAX / (int)sizeof(XRefEntry))) { + return 0; + } + + void *p = greallocn_checkoverflow(entries, realNewSize, sizeof(XRefEntry)); + if (p == NULL) { + return 0; + } + + entries = (XRefEntry *) p; + capacity = realNewSize; + + } + + return capacity; +} + +int XRef::resize(int newSize) +{ + if (newSize > size) { + + if (reserve(newSize) < newSize) return size; + + for (int i = size; i < newSize; ++i) { + entries[i].offset = 0xffffffff; + entries[i].type = xrefEntryFree; + entries[i].obj.initNull (); + entries[i].updated = false; + entries[i].gen = 0; + } + } else { + for (int i = newSize; i < size; i++) { + entries[i].obj.free (); + } + } + + size = newSize; + + return size; +} + // Read the 'startxref' position. Guint XRef::getStartXref() { char buf[xrefSearchSize+1]; @@ -399,7 +450,7 @@ GBool XRef::readXRefTable(Parser *parser, Guint *pos, GooVector *followed GBool more; Object obj, obj2; Guint pos2; - int first, n, newSize, i; + int first, n, i; while (1) { parser->getObj(&obj); @@ -418,29 +469,13 @@ GBool XRef::readXRefTable(Parser *parser, Guint *pos, GooVector *followed n = obj.getInt(); obj.free(); if (first < 0 || n < 0 || first + n < 0) { - goto err1; + goto err0; } if (first + n > size) { - for (newSize = size ? 2 * size : 1024; - first + n > newSize && newSize > 0; - newSize <<= 1) ; - if (newSize < 0) { - goto err1; - } - if (newSize >= INT_MAX / (int)sizeof(XRefEntry)) { + if (resize(first + n) != first + n) { error(-1, "Invalid 'obj' parameters'"); - goto err1; + goto err0; } - - entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry)); - for (i = size; i < newSize; ++i) { - entries[i].offset = 0xffffffff; - entries[i].type = xrefEntryFree; - entries[i].obj.initNull (); - entries[i].updated = false; - entries[i].gen = 0; - } - size = newSize; } for (i = first; i < first + n; ++i) { if (!parser->getObj(&obj)->isInt()) { @@ -529,6 +564,7 @@ GBool XRef::readXRefTable(Parser *parser, Guint *pos, GooVector *followed err1: obj.free(); + err0: ok = gFalse; return gFalse; } @@ -551,19 +587,10 @@ GBool XRef::readXRefStream(Stream *xrefStr, Guint *pos) { goto err1; } if (newSize > size) { - if (newSize >= INT_MAX / (int)sizeof(XRefEntry)) { - error(-1, "Invalid 'size' parameter."); - return gFalse; - } - entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry)); - for (i = size; i < newSize; ++i) { - entries[i].offset = 0xffffffff; - entries[i].type = xrefEntryFree; - entries[i].obj.initNull (); - entries[i].updated = false; - entries[i].gen = 0; + if (resize(newSize) != newSize) { + error(-1, "Invalid 'size' parameter"); + goto err0; } - size = newSize; } if (!dict->lookupNF("W", &obj)->isArray() || @@ -636,31 +663,16 @@ GBool XRef::readXRefStream(Stream *xrefStr, Guint *pos) { GBool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) { Guint offset; - int type, gen, c, newSize, i, j; + int type, gen, c, i, j; if (first + n < 0) { return gFalse; } if (first + n > size) { - for (newSize = size ? 2 * size : 1024; - first + n > newSize && newSize > 0; - newSize <<= 1) ; - if (newSize < 0) { - return gFalse; - } - if (newSize >= INT_MAX / (int)sizeof(XRefEntry)) { - error(-1, "Invalid 'size' inside xref table."); + if (resize(first + n) != size) { + error(-1, "Invalid 'size' inside xref table"); return gFalse; } - entries = (XRefEntry *)greallocn(entries, newSize, sizeof(XRefEntry)); - for (i = size; i < newSize; ++i) { - entries[i].offset = 0xffffffff; - entries[i].type = xrefEntryFree; - entries[i].obj.initNull (); - entries[i].updated = false; - entries[i].gen = 0; - } - size = newSize; } for (i = first; i < first + n; ++i) { if (w[0] == 0) { @@ -721,13 +733,13 @@ GBool XRef::constructXRef() { int newSize; int streamEndsSize; char *p; - int i; GBool gotRoot; char* token = NULL; bool oneCycle = true; int offset = 0; gfree(entries); + capacity = 0; size = 0; entries = NULL; @@ -809,23 +821,10 @@ GBool XRef::constructXRef() { error(-1, "Bad object number"); return gFalse; } - if (newSize >= INT_MAX / (int)sizeof(XRefEntry)) { - error(-1, "Invalid 'obj' parameters."); + if (resize(newSize) != newSize) { + error(-1, "Invalid 'obj' parameters"); return gFalse; } - entries = (XRefEntry *) - greallocn_checkoverflow(entries, newSize, sizeof(XRefEntry)); - if (entries == NULL) { - size = 0; - return gFalse; - } - for (i = size; i < newSize; ++i) { - entries[i].offset = 0xffffffff; - entries[i].type = xrefEntryFree; - entries[i].obj.initNull (); - entries[i].updated = false; - } - size = newSize; } if (entries[num].type == xrefEntryFree || gen >= entries[num].gen) { @@ -1102,7 +1101,10 @@ Guint XRef::strToUnsigned(char *s) { void XRef::add(int num, int gen, Guint offs, GBool used) { if (num >= size) { - entries = (XRefEntry *)greallocn(entries, num + 1, sizeof(XRefEntry)); + if (num >= capacity) { + entries = (XRefEntry *)greallocn(entries, num + 1, sizeof(XRefEntry)); + capacity = num + 1; + } for (int i = size; i < num + 1; ++i) { entries[i].offset = 0xffffffff; entries[i].type = xrefEntryFree; diff --git a/poppler/XRef.h b/poppler/XRef.h index b03ff73..2fd1622 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -137,7 +137,8 @@ private: Guint start; // offset in file (to allow for garbage // at beginning of file) XRefEntry *entries; // xref entries - int size; // size of array + int capacity; // size of array + int size; // number of entries int rootNum, rootGen; // catalog dict GBool ok; // true if xref table is valid int errCode; // error code (if is false) @@ -157,6 +158,8 @@ private: GBool ownerPasswordOk; // true if owner password is correct void init(); + int reserve(int newSize); + int resize(int newSize); Guint getStartXref(); GBool readXRef(Guint *pos, GooVector *followedXRefStm); GBool readXRefTable(Parser *parser, Guint *pos, GooVector *followedXRefStm); -- 1.6.4.2 From 29300887d558d9ef0461caca6df39815141317b7 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 28 Apr 2010 12:45:42 +0200 Subject: [PATCH 03/12] Use XRef::add() in XRef::addIndirectObject() --- poppler/XRef.cc | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-) diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 9ca8d5a..5de0ba9 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -1146,10 +1146,8 @@ Ref XRef::addIndirectObject (Object* o) { XRefEntry *e; if (entryIndexToUse == -1) { entryIndexToUse = size; - size++; - entries = (XRefEntry *)greallocn(entries, size, sizeof(XRefEntry)); + add(entryIndexToUse, 0, 0, gFalse); e = &entries[entryIndexToUse]; - e->gen = 0; } else { //reuse a free entry e = &entries[entryIndexToUse]; -- 1.6.4.2 From 6928a384267e770274e5201ef5dc2759ca73a660 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 14 Apr 2010 12:20:49 +0200 Subject: [PATCH 04/12] Use XRef::getEntry() to access entries --- poppler/XRef.cc | 49 +++++++++++++++++++++++++------------------------ poppler/XRef.h | 2 +- 2 files changed, 26 insertions(+), 25 deletions(-) diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 5de0ba9..619b993 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -946,7 +946,7 @@ Object *XRef::fetch(int num, int gen, Object *obj) { goto err; } - e = &entries[num]; + e = getEntry(num); if(!e->obj.isNull ()) { //check for updated object obj = e->obj.copy(obj); return obj; @@ -1066,20 +1066,20 @@ GBool XRef::getStreamEnd(Guint streamStart, Guint *streamEnd) { return gTrue; } -int XRef::getNumEntry(Guint offset) const +int XRef::getNumEntry(Guint offset) { if (size > 0) { int res = 0; - Guint resOffset = entries[0].offset; - XRefEntry e; + Guint resOffset = getEntry(0)->offset; + XRefEntry *e; for (int i = 1; i < size; ++i) { - e = entries[i]; - if (e.offset < offset && e.offset >= resOffset) + e = getEntry(i); + if (e->offset < offset && e->offset >= resOffset) { res = i; - resOffset = e.offset; + resOffset = e->offset; } } return res; @@ -1114,7 +1114,7 @@ void XRef::add(int num, int gen, Guint offs, GBool used) { } size = num + 1; } - XRefEntry *e = &entries[num]; + XRefEntry *e = getEntry(num); e->gen = gen; e->obj.initNull (); e->updated = false; @@ -1132,25 +1132,26 @@ void XRef::setModifiedObject (Object* o, Ref r) { error(-1,"XRef::setModifiedObject on unknown ref: %i, %i\n", r.num, r.gen); return; } - entries[r.num].obj.free(); - o->copy(&entries[r.num].obj); - entries[r.num].updated = true; + XRefEntry *e = getEntry(r.num); + e->obj.free(); + o->copy(&(e->obj)); + e->updated = true; } Ref XRef::addIndirectObject (Object* o) { int entryIndexToUse = -1; for (int i = 1; entryIndexToUse == -1 && i < size; ++i) { - if (entries[i].type == xrefEntryFree) entryIndexToUse = i; + if (getEntry(i)->type == xrefEntryFree) entryIndexToUse = i; } XRefEntry *e; if (entryIndexToUse == -1) { entryIndexToUse = size; add(entryIndexToUse, 0, 0, gFalse); - e = &entries[entryIndexToUse]; + e = getEntry(entryIndexToUse); } else { //reuse a free entry - e = &entries[entryIndexToUse]; + e = getEntry(entryIndexToUse); //we don't touch gen number, because it should have been //incremented when the object was deleted } @@ -1166,13 +1167,13 @@ Ref XRef::addIndirectObject (Object* o) { void XRef::writeToFile(OutStream* outStr, GBool writeAllEntries) { //create free entries linked-list - if (entries[0].gen != 65535) { + if (getEntry(0)->gen != 65535) { error(-1, "XRef::writeToFile, entry 0 of the XRef is invalid (gen != 65535)\n"); } int lastFreeEntry = 0; for (int i=0; itype == xrefEntryFree) { + getEntry(lastFreeEntry)->offset = i; lastFreeEntry = i; } } @@ -1182,10 +1183,10 @@ void XRef::writeToFile(OutStream* outStr, GBool writeAllEntries) { outStr->printf("xref\r\n"); outStr->printf("%i %i\r\n", 0, size); for (int i=0; i 65535) e.gen = 65535; //cap generation number to 65535 (required by PDFReference) - outStr->printf("%010i %05i %c\r\n", e.offset, e.gen, (e.type==xrefEntryFree)?'f':'n'); + if(e->gen > 65535) e->gen = 65535; //cap generation number to 65535 (required by PDFReference) + outStr->printf("%010i %05i %c\r\n", e->offset, e->gen, (e->type==xrefEntryFree)?'f':'n'); } } else { //write the new xref @@ -1194,16 +1195,16 @@ void XRef::writeToFile(OutStream* outStr, GBool writeAllEntries) { while (i < size) { int j; for(j=i; jtype == xrefEntryFree) && (getEntry(j)->gen == 0)) break; } if (j-i != 0) { outStr->printf("%i %i\r\n", i, j-i); for (int k=i; k 65535) e.gen = 65535; //cap generation number to 65535 (required by PDFReference) - outStr->printf("%010i %05i %c\r\n", e.offset, e.gen, (e.type==xrefEntryFree)?'f':'n'); + XRefEntry *e = getEntry(k); + if(e->gen > 65535) e->gen = 65535; //cap generation number to 65535 (required by PDFReference) + outStr->printf("%010i %05i %c\r\n", e->offset, e->gen, (e->type==xrefEntryFree)?'f':'n'); } i = j; } diff --git a/poppler/XRef.h b/poppler/XRef.h index 2fd1622..e029634 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -118,7 +118,7 @@ public: GBool getStreamEnd(Guint streamStart, Guint *streamEnd); // Retuns the entry that belongs to the offset - int getNumEntry(Guint offset) const; + int getNumEntry(Guint offset); // Direct access. int getSize() { return size; } -- 1.6.4.2 From b7c98b14a1efd128a960b6f4b014475bb9b90505 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 15 Apr 2010 17:34:13 +0200 Subject: [PATCH 05/12] Read XRef table sections on demand --- poppler/XRef.cc | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++---- poppler/XRef.h | 6 +++- 2 files changed, 59 insertions(+), 7 deletions(-) diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 619b993..81fd63f 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -242,7 +242,6 @@ XRef::XRef() { } XRef::XRef(BaseStream *strA) { - Guint pos; Object obj; init(); @@ -254,11 +253,11 @@ XRef::XRef(BaseStream *strA) { // read the trailer str = strA; start = str->getStart(); - pos = getStartXref(); + prevXRefOffset = pos; // if there was a problem with the 'startxref' position, try to // reconstruct the xref table - if (pos == 0) { + if (prevXRefOffset == 0) { if (!(ok = constructXRef())) { errCode = errDamaged; return; @@ -267,7 +266,7 @@ XRef::XRef(BaseStream *strA) { // read the xref table } else { GooVector followedXRefStm; - while (readXRef(&pos, &followedXRefStm)) ; + readXRef(&prevXRefOffset, &followedXRefStm); // if there was a problem with the xref table, // try to reconstruct it @@ -279,6 +278,18 @@ XRef::XRef(BaseStream *strA) { } } + // set size according to trailer dict + trailerDict.dictLookupNF("Size", &obj); + if (obj.isInt() && (resize(obj.getInt()) == obj.getInt())) { + obj.free(); + } else { + obj.free(); + if (!(ok = constructXRef())) { + errCode = errDamaged; + return; + } + } + // get the root dictionary (catalog) object trailerDict.dictLookupNF("Root", &obj); if (obj.isRef()) { @@ -347,7 +358,7 @@ int XRef::resize(int newSize) for (int i = size; i < newSize; ++i) { entries[i].offset = 0xffffffff; - entries[i].type = xrefEntryFree; + entries[i].type = xrefEntryNone; entries[i].obj.initNull (); entries[i].updated = false; entries[i].gen = 0; @@ -1213,3 +1224,42 @@ void XRef::writeToFile(OutStream* outStr, GBool writeAllEntries) { } } +XRefEntry *XRef::getEntry(int i) +{ + if (entries[i].type == xrefEntryNone) { + + GooVector followedPrev; + while (prevXRefOffset && entries[i].type == xrefEntryNone) { + bool ok = true; + for (size_t j = 0; j < followedPrev.size(); j++) { + if (followedPrev.at(j) == prevXRefOffset) { + ok = false; + break; + } + } + if (!ok) { + error(-1, "Circular XRef"); + if (!(ok = constructXRef())) { + errCode = errDamaged; + } + break; + } + + followedPrev.push_back (prevXRefOffset); + + GooVector followedXRefStm; + if (!readXRef(&prevXRefOffset, &followedXRefStm)) { + prevXRefOffset = 0; + } + } + + if (entries[i].type == xrefEntryNone) { + error(-1, "Invalid XRef entry"); + entries[i].type = xrefEntryFree; + } + } + + return &entries[i]; +} + + diff --git a/poppler/XRef.h b/poppler/XRef.h index e029634..5f34d36 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -46,7 +46,8 @@ class ObjectStream; enum XRefEntryType { xrefEntryFree, xrefEntryUncompressed, - xrefEntryCompressed + xrefEntryCompressed, + xrefEntryNone }; struct XRefEntry { @@ -122,7 +123,7 @@ public: // Direct access. int getSize() { return size; } - XRefEntry *getEntry(int i) { return &entries[i]; } + XRefEntry *getEntry(int i); Object *getTrailerDict() { return &trailerDict; } // Write access @@ -156,6 +157,7 @@ private: int permFlags; // permission bits Guchar fileKey[16]; // file decryption key GBool ownerPasswordOk; // true if owner password is correct + Guint prevXRefOffset; // position of prev XRef section (= next to read) void init(); int reserve(int newSize); -- 1.6.4.2 From 03f1f40645d484cfcf936f63535df4ca437511a5 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 24 Mar 2010 18:26:17 +0100 Subject: [PATCH 06/12] Add Linearization dictionary support --- CMakeLists.txt | 2 + poppler/Linearization.cc | 225 ++++++++++++++++++++++++++++++++++++++++++++++ poppler/Linearization.h | 45 +++++++++ poppler/Makefile.am | 2 + poppler/PDFDoc.cc | 13 +++ poppler/PDFDoc.h | 5 + 6 files changed, 292 insertions(+), 0 deletions(-) create mode 100644 poppler/Linearization.cc create mode 100644 poppler/Linearization.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8a47a..8f5fba9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,6 +249,7 @@ set(poppler_SRCS poppler/JBIG2Stream.cc poppler/Lexer.cc poppler/Link.cc + poppler/Linearization.cc poppler/LocalPDFDocBuilder.cc poppler/NameToCharCode.cc poppler/Object.cc @@ -395,6 +396,7 @@ if(ENABLE_XPDF_HEADERS) poppler/JBIG2Stream.h poppler/Lexer.h poppler/Link.h + poppler/Linearization.h poppler/LocalPDFDocBuilder.h poppler/Movie.h poppler/NameToCharCode.h diff --git a/poppler/Linearization.cc b/poppler/Linearization.cc new file mode 100644 index 0000000..d63e5ad --- /dev/null +++ b/poppler/Linearization.cc @@ -0,0 +1,225 @@ +//======================================================================== +// +// Linearization.cc +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2010 Hib Eris +// +//======================================================================== + +#include "Linearization.h" +#include "Parser.h" +#include "Lexer.h" + +//------------------------------------------------------------------------ +// Linearization +//------------------------------------------------------------------------ + +Linearization::Linearization (BaseStream *str) +{ + Parser *parser; + Object obj1, obj2, obj3, obj4, obj5; + + linDict.initNull(); + + str->reset(); + obj1.initNull(); + parser = new Parser(NULL, + new Lexer(NULL, str->makeSubStream(str->getStart(), gFalse, 0, &obj1)), + gTrue); + parser->getObj(&obj1); + parser->getObj(&obj2); + parser->getObj(&obj3); + parser->getObj(&linDict); + parser->getObj(&obj4); + if (obj1.isInt() && obj2.isInt() && obj3.isCmd("obj") && linDict.isDict()) { + linDict.dictLookup("Linearized", &obj5); + if (!(obj5.isNum() && obj5.getNum() > 0)) { + linDict.free(); + linDict.initNull(); + } + obj5.free(); + } + obj4.free(); + obj4.free(); + obj3.free(); + obj2.free(); + obj1.free(); + delete parser; +} + +Linearization:: ~Linearization() +{ + linDict.free(); +} + +Guint Linearization::getLength() +{ + if (!linDict.isDict()) return 0; + + int length; + if (linDict.getDict()->lookupInt("L", NULL, &length) && + length > 0) { + return length; + } else { + error(-1, "Length in linearization table is invalid"); + return 0; + } +} + +Guint Linearization::getHintsOffset() +{ + int hintsOffset; + + Object obj1, obj2; + if (linDict.isDict() && + linDict.dictLookup("H", &obj1)->isArray() && + obj1.arrayGetLength()>=2 && + obj1.arrayGet(0, &obj2)->isInt() && + obj2.getInt() > 0) { + hintsOffset = obj2.getInt(); + } else { + error(-1, "Hints table offset in linearization table is invalid"); + hintsOffset = 0; + } + obj2.free(); + obj1.free(); + + return hintsOffset; +} + +Guint Linearization::getHintsLength() +{ + int hintsLength; + + Object obj1, obj2; + if (linDict.isDict() && + linDict.dictLookup("H", &obj1)->isArray() && + obj1.arrayGetLength()>=2 && + obj1.arrayGet(1, &obj2)->isInt() && + obj2.getInt() > 0) { + hintsLength = obj2.getInt(); + } else { + error(-1, "Hints table length in linearization table is invalid"); + hintsLength = 0; + } + obj2.free(); + obj1.free(); + + return hintsLength; +} + +Guint Linearization::getHintsOffset2() +{ + int hintsOffset2 = 0; // default to 0 + + Object obj1, obj2; + if (linDict.isDict() && + linDict.dictLookup("H", &obj1)->isArray() && + obj1.arrayGetLength()>=4) { + if (obj1.arrayGet(2, &obj2)->isInt() && + obj2.getInt() > 0) { + hintsOffset2 = obj2.getInt(); + } else { + error(-1, "Second hints table offset in linearization table is invalid"); + hintsOffset2 = 0; + } + } + obj2.free(); + obj1.free(); + + return hintsOffset2; +} + +Guint Linearization::getHintsLength2() +{ + int hintsLength2 = 0; // default to 0 + + Object obj1, obj2; + if (linDict.isDict() && + linDict.dictLookup("H", &obj1)->isArray() && + obj1.arrayGetLength()>=4) { + if (obj1.arrayGet(3, &obj2)->isInt() && + obj2.getInt() > 0) { + hintsLength2 = obj2.getInt(); + } else { + error(-1, "Second hints table length in linearization table is invalid"); + hintsLength2 = 0; + } + } + obj2.free(); + obj1.free(); + + return hintsLength2; +} + +int Linearization::getObjectNumberFirst() +{ + int objectNumberFirst = 0; + if (linDict.isDict() && + linDict.getDict()->lookupInt("O", NULL, &objectNumberFirst) && + objectNumberFirst > 0) { + return objectNumberFirst; + } else { + error(-1, "Object number of first page in linearization table is invalid"); + return 0; + } +} + +Guint Linearization::getEndFirst() +{ + int pageEndFirst = 0; + if (linDict.isDict() && + linDict.getDict()->lookupInt("E", NULL, &pageEndFirst) && + pageEndFirst > 0) { + return pageEndFirst; + } else { + error(-1, "First page end offset in linearization table is invalid"); + return 0; + } +} + +int Linearization::getNumPages() +{ + int numPages = 0; + if (linDict.isDict() && + linDict.getDict()->lookupInt("N", NULL, &numPages) && + numPages > 0) { + return numPages; + } else { + error(-1, "Page count in linearization table is invalid"); + return 0; + } +} + +Guint Linearization::getMainXRefEntriesOffset() +{ + int mainXRefEntriesOffset = 0; + if (linDict.isDict() && + linDict.getDict()->lookupInt("T", NULL, &mainXRefEntriesOffset) && + mainXRefEntriesOffset > 0) { + return mainXRefEntriesOffset; + } else { + error(-1, "Main Xref offset in linearization table is invalid"); + return 0; + } +} + +int Linearization::getPageFirst() +{ + int pageFirst = 0; // Optional, defaults to 0. + + if (linDict.isDict()) { + linDict.getDict()->lookupInt("P", NULL, &pageFirst); + } + + if (pageFirst < 0) { + error(-1, "First page in linearization table is invalid"); + return 0; + } + + return pageFirst; +} + + diff --git a/poppler/Linearization.h b/poppler/Linearization.h new file mode 100644 index 0000000..6728a75 --- /dev/null +++ b/poppler/Linearization.h @@ -0,0 +1,45 @@ +//======================================================================== +// +// Linearization.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2010 Hib Eris +// +//======================================================================== + +#ifndef LINEARIZATION_H +#define LINEARIZATION_H + +#include "goo/gtypes.h" +#include "Object.h" +class BaseStream; + +//------------------------------------------------------------------------ +// Linearization +//------------------------------------------------------------------------ + +class Linearization { +public: + + Linearization(BaseStream *str); + ~Linearization(); + + Guint getLength(); + Guint getHintsOffset(); + Guint getHintsLength(); + Guint getHintsOffset2(); + Guint getHintsLength2(); + int getObjectNumberFirst(); + Guint getEndFirst(); + int getNumPages(); + Guint getMainXRefEntriesOffset(); + int getPageFirst(); + +private: + + Object linDict; + +}; + +#endif diff --git a/poppler/Makefile.am b/poppler/Makefile.am index 3affce8..72bafd8 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -209,6 +209,7 @@ poppler_include_HEADERS = \ JArithmeticDecoder.h \ JBIG2Stream.h \ Lexer.h \ + Linearization.h \ Link.h \ LocalPDFDocBuilder.h \ Movie.h \ @@ -287,6 +288,7 @@ libpoppler_la_SOURCES = \ JArithmeticDecoder.cc \ JBIG2Stream.cc \ Lexer.cc \ + Linearization.cc \ Link.cc \ LocalPDFDocBuilder.cc \ Movie.cc \ diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index b650480..3787ef5 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -53,6 +53,7 @@ #include "Catalog.h" #include "Stream.h" #include "XRef.h" +#include "Linearization.h" #include "Link.h" #include "OutputDev.h" #include "Error.h" @@ -83,6 +84,7 @@ void PDFDoc::init() file = NULL; str = NULL; xref = NULL; + linearization = NULL; catalog = NULL; #ifndef DISABLE_OUTLINE outline = NULL; @@ -243,6 +245,9 @@ PDFDoc::~PDFDoc() { if (xref) { delete xref; } + if (linearization) { + delete linearization; + } if (str) { delete str; } @@ -414,6 +419,14 @@ void PDFDoc::processLinks(OutputDev *out, int page) { catalog->getPage(page)->processLinks(out, catalog); } +Linearization *PDFDoc::getLinearization() +{ + if (!linearization) { + linearization = new Linearization(str); + } + return linearization; +} + GBool PDFDoc::isLinearized() { Parser *parser; Object obj1, obj2, obj3, obj4, obj5; diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 6d7dea2..011f4c0 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -48,6 +48,7 @@ class Links; class LinkAction; class LinkDest; class Outline; +class Linearization; enum PDFWriteMode { writeStandard, @@ -89,6 +90,9 @@ public: // Get file name. GooString *getFileName() { return fileName; } + // Get the linearization table. + Linearization *getLinearization(); + // Get the xref table. XRef *getXRef() { return xref; } @@ -242,6 +246,7 @@ private: void *guiData; int pdfMajorVersion; int pdfMinorVersion; + Linearization *linearization; XRef *xref; Catalog *catalog; #ifndef DISABLE_OUTLINE -- 1.6.4.2 From 57af40492e3655c7f69af599bc9b19acadf19d5b Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 13 Apr 2010 18:51:40 +0200 Subject: [PATCH 07/12] Add getLength() to BaseStream --- poppler/Stream.cc | 11 ++++++----- poppler/Stream.h | 11 ++++++----- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/poppler/Stream.cc b/poppler/Stream.cc index 0771e25..f4f9351 100644 --- a/poppler/Stream.cc +++ b/poppler/Stream.cc @@ -363,8 +363,9 @@ void FileOutStream::printf(const char *format, ...) // BaseStream //------------------------------------------------------------------------ -BaseStream::BaseStream(Object *dictA) { +BaseStream::BaseStream(Object *dictA, Guint lengthA) { dict = *dictA; + length = lengthA; } BaseStream::~BaseStream() { @@ -677,7 +678,7 @@ GBool StreamPredictor::getNextLine() { FileStream::FileStream(FILE *fA, Guint startA, GBool limitedA, Guint lengthA, Object *dictA): - BaseStream(dictA) { + BaseStream(dictA, lengthA) { f = fA; start = startA; limited = limitedA; @@ -802,7 +803,7 @@ void FileStream::moveStart(int delta) { CachedFileStream::CachedFileStream(CachedFile *ccA, Guint startA, GBool limitedA, Guint lengthA, Object *dictA) - : BaseStream(dictA) + : BaseStream(dictA, lengthA) { cc = ccA; start = startA; @@ -900,7 +901,7 @@ void CachedFileStream::moveStart(int delta) //------------------------------------------------------------------------ MemStream::MemStream(char *bufA, Guint startA, Guint lengthA, Object *dictA): - BaseStream(dictA) { + BaseStream(dictA, lengthA) { buf = bufA; start = startA; length = lengthA; @@ -964,7 +965,7 @@ void MemStream::moveStart(int delta) { EmbedStream::EmbedStream(Stream *strA, Object *dictA, GBool limitedA, Guint lengthA): - BaseStream(dictA) { + BaseStream(dictA, lengthA) { str = strA; limited = limitedA; length = lengthA; diff --git a/poppler/Stream.h b/poppler/Stream.h index 49ae8fb..6896d20 100644 --- a/poppler/Stream.h +++ b/poppler/Stream.h @@ -240,7 +240,7 @@ private: class BaseStream: public Stream { public: - BaseStream(Object *dictA); + BaseStream(Object *dictA, Guint lengthA); virtual ~BaseStream(); virtual Stream *makeSubStream(Guint start, GBool limited, Guint length, Object *dict) = 0; @@ -250,11 +250,16 @@ public: virtual Stream *getUndecodedStream() { return this; } virtual Dict *getDict() { return dict.getDict(); } virtual GooString *getFileName() { return NULL; } + virtual Guint getLength() { return length; } // Get/set position of first byte of stream within the file. virtual Guint getStart() = 0; virtual void moveStart(int delta) = 0; +protected: + + Guint length; + private: Object dict; @@ -401,7 +406,6 @@ private: FILE *f; Guint start; GBool limited; - Guint length; char buf[fileStreamBufSize]; char *bufPtr; char *bufEnd; @@ -446,7 +450,6 @@ private: CachedFile *cc; Guint start; GBool limited; - Guint length; char buf[cachedStreamBufSize]; char *bufPtr; char *bufEnd; @@ -490,7 +493,6 @@ private: char *buf; Guint start; - Guint length; char *bufEnd; char *bufPtr; GBool needFree; @@ -530,7 +532,6 @@ private: Stream *str; GBool limited; - Guint length; }; //------------------------------------------------------------------------ -- 1.6.4.2 From f7362062e8f682089f516bf61aa9aa3793f96438 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 24 Mar 2010 19:16:14 +0100 Subject: [PATCH 08/12] Pass size of file when creating FileStream --- poppler/PDFDoc.cc | 19 +++++++++++++++++-- 1 files changed, 17 insertions(+), 2 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 3787ef5..c0da493 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -45,6 +45,7 @@ #ifdef _WIN32 # include #endif +#include #include "goo/gstrtod.h" #include "goo/GooString.h" #include "poppler-config.h" @@ -99,12 +100,18 @@ PDFDoc::PDFDoc() PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword, GooString *userPassword, void *guiDataA) { Object obj; + int size = 0; init(); fileName = fileNameA; guiData = guiDataA; + struct stat buf; + if (stat(fileName->getCString(), &buf) == 0) { + size = buf.st_size; + } + // try to open file #ifdef VMS file = fopen(fileName->getCString(), "rb", "ctx=stm"); @@ -124,7 +131,7 @@ PDFDoc::PDFDoc(GooString *fileNameA, GooString *ownerPassword, // create stream obj.initNull(); - str = new FileStream(file, 0, gFalse, 0, &obj); + str = new FileStream(file, 0, gFalse, size, &obj); ok = setup(ownerPassword, userPassword); } @@ -155,11 +162,19 @@ PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword, // try to open file // NB: _wfopen is only available in NT + struct stat buf; + int size; version.dwOSVersionInfoSize = sizeof(version); GetVersionEx(&version); if (version.dwPlatformId == VER_PLATFORM_WIN32_NT) { + if (_wstat(fileName2, &buf) == 0) { + size = buf.st_size; + } file = _wfopen(fileName2, L"rb"); } else { + if (_wstat(fileName->getCString(), &buf) == 0) { + size = buf.st_size; + } file = fopen(fileName->getCString(), "rb"); } if (!file) { @@ -170,7 +185,7 @@ PDFDoc::PDFDoc(wchar_t *fileNameA, int fileNameLen, GooString *ownerPassword, // create stream obj.initNull(); - str = new FileStream(file, 0, gFalse, 0, &obj); + str = new FileStream(file, 0, gFalse, size, &obj); ok = setup(ownerPassword, userPassword); } -- 1.6.4.2 From 5dee1edf6fecb1e3001942ee37e7b17ecdcd3509 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 24 Mar 2010 19:32:59 +0100 Subject: [PATCH 09/12] Improve linearization check --- poppler/PDFDoc.cc | 33 +++++---------------------------- 1 files changed, 5 insertions(+), 28 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index c0da493..aaf0de1 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -443,34 +443,11 @@ Linearization *PDFDoc::getLinearization() } GBool PDFDoc::isLinearized() { - Parser *parser; - Object obj1, obj2, obj3, obj4, obj5; - GBool lin; - - lin = gFalse; - obj1.initNull(); - parser = new Parser(xref, - new Lexer(xref, - str->makeSubStream(str->getStart(), gFalse, 0, &obj1)), - gTrue); - parser->getObj(&obj1); - parser->getObj(&obj2); - parser->getObj(&obj3); - parser->getObj(&obj4); - if (obj1.isInt() && obj2.isInt() && obj3.isCmd("obj") && - obj4.isDict()) { - obj4.dictLookup("Linearized", &obj5); - if (obj5.isNum() && obj5.getNum() > 0) { - lin = gTrue; - } - obj5.free(); - } - obj4.free(); - obj3.free(); - obj2.free(); - obj1.free(); - delete parser; - return lin; + if ((str->getLength()) && + (getLinearization()->getLength() == str->getLength())) + return gTrue; + else + return gFalse; } int PDFDoc::saveAs(GooString *name, PDFWriteMode mode) { -- 1.6.4.2 From 3f034ff50bb797540a291dc054ba4d1b1d083b9e Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 7 Apr 2010 12:05:56 +0200 Subject: [PATCH 10/12] Move getStartXref from XRef to PDFDoc --- poppler/PDFDoc.cc | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++- poppler/PDFDoc.h | 5 ++++ poppler/XRef.cc | 50 +------------------------------------------ poppler/XRef.h | 6 +---- 4 files changed, 66 insertions(+), 56 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index aaf0de1..bb1eee7 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -35,6 +35,7 @@ #pragma implementation #endif +#include #include #include #include @@ -73,6 +74,9 @@ #define headerSearchSize 1024 // read this many bytes at beginning of // file to look for '%PDF' +#define xrefSearchSize 1024 // read this many bytes at end of file + // to look for 'startxref' + //------------------------------------------------------------------------ // PDFDoc //------------------------------------------------------------------------ @@ -90,6 +94,7 @@ void PDFDoc::init() #ifndef DISABLE_OUTLINE outline = NULL; #endif + startXRefPos = ~(Guint)0; } PDFDoc::PDFDoc() @@ -223,7 +228,7 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) { checkHeader(); // read xref table - xref = new XRef(str); + xref = new XRef(str, getStartXRef()); if (!xref->isOk()) { error(-1, "Couldn't read xref table"); errCode = xref->getErrorCode(); @@ -891,7 +896,7 @@ void PDFDoc::writeTrailer (Guint uxrefOffset, int uxrefSize, OutStream* outStr, trailerDict->set("Root", &obj1); if (incrUpdate) { - obj1.initInt(xref->getLastXRefPos()); + obj1.initInt(getStartXRef()); trailerDict->set("Prev", &obj1); } @@ -929,3 +934,55 @@ PDFDoc *PDFDoc::ErrorPDFDoc(int errorCode, GooString *fileNameA) return doc; } + +Guint PDFDoc::strToUnsigned(char *s) { + Guint x; + char *p; + int i; + + x = 0; + for (p = s, i = 0; *p && isdigit(*p) && i < 10; ++p, ++i) { + x = 10 * x + (*p - '0'); + } + return x; +} + +// Read the 'startxref' position. +Guint PDFDoc::getStartXRef() +{ + if (startXRefPos == ~(Guint)0) { + + { + char buf[xrefSearchSize+1]; + char *p; + int c, n, i; + + // read last xrefSearchSize bytes + str->setPos(xrefSearchSize, -1); + for (n = 0; n < xrefSearchSize; ++n) { + if ((c = str->getChar()) == EOF) { + break; + } + buf[n] = c; + } + buf[n] = '\0'; + + // find startxref + for (i = n - 9; i >= 0; --i) { + if (!strncmp(&buf[i], "startxref", 9)) { + break; + } + } + if (i < 0) { + startXRefPos = 0; + } + for (p = &buf[i+9]; isspace(*p); ++p) ; + startXRefPos = strToUnsigned(p); + } + + } + + return startXRefPos; +} + + diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 011f4c0..d093b59 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -239,6 +239,9 @@ private: GBool checkFooter(); void checkHeader(); GBool checkEncryption(GooString *ownerPassword, GooString *userPassword); + // Get the offset of the start xref table. + Guint getStartXRef(); + Guint strToUnsigned(char *s); GooString *fileName; FILE *file; @@ -258,6 +261,8 @@ private: //If there is an error opening the PDF file with fopen() in the constructor, //then the POSIX errno will be here. int fopenErrno; + + Guint startXRefPos; // offset of last xref table }; #endif diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 81fd63f..ead8b55 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -47,11 +47,6 @@ #include "XRef.h" //------------------------------------------------------------------------ - -#define xrefSearchSize 1024 // read this many bytes at end of file - // to look for 'startxref' - -//------------------------------------------------------------------------ // Permission bits // Note that the PDF spec uses 1 base (eg bit 3 is 1<<2) //------------------------------------------------------------------------ @@ -241,7 +236,7 @@ XRef::XRef() { init(); } -XRef::XRef(BaseStream *strA) { +XRef::XRef(BaseStream *strA, Guint pos) { Object obj; init(); @@ -374,37 +369,6 @@ int XRef::resize(int newSize) return size; } -// Read the 'startxref' position. -Guint XRef::getStartXref() { - char buf[xrefSearchSize+1]; - char *p; - int c, n, i; - - // read last xrefSearchSize bytes - str->setPos(xrefSearchSize, -1); - for (n = 0; n < xrefSearchSize; ++n) { - if ((c = str->getChar()) == EOF) { - break; - } - buf[n] = c; - } - buf[n] = '\0'; - - // find startxref - for (i = n - 9; i >= 0; --i) { - if (!strncmp(&buf[i], "startxref", 9)) { - break; - } - } - if (i < 0) { - return 0; - } - for (p = &buf[i+9]; isspace(*p); ++p) ; - lastXRefPos = strToUnsigned(p); - - return lastXRefPos; -} - // Read one xref table section. Also reads the associated trailer // dictionary, and returns the prev pointer (if any). GBool XRef::readXRef(Guint *pos, GooVector *followedXRefStm) { @@ -1098,18 +1062,6 @@ int XRef::getNumEntry(Guint offset) else return -1; } -Guint XRef::strToUnsigned(char *s) { - Guint x; - char *p; - int i; - - x = 0; - for (p = s, i = 0; *p && isdigit(*p) && i < 10; ++p, ++i) { - x = 10 * x + (*p - '0'); - } - return x; -} - void XRef::add(int num, int gen, Guint offs, GBool used) { if (num >= size) { if (num >= capacity) { diff --git a/poppler/XRef.h b/poppler/XRef.h index 5f34d36..45f7f57 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -64,7 +64,7 @@ public: // Constructor, create an empty XRef, used for PDF writing XRef(); // Constructor. Read xref table from stream. - XRef(BaseStream *strA); + XRef(BaseStream *strA, Guint pos); // Destructor. ~XRef(); @@ -107,9 +107,6 @@ public: // Return the number of objects in the xref table. int getNumObjects() { return size; } - // Return the offset of the last xref table. - Guint getLastXRefPos() { return lastXRefPos; } - // Return the catalog object reference. int getRootNum() { return rootNum; } int getRootGen() { return rootGen; } @@ -144,7 +141,6 @@ private: GBool ok; // true if xref table is valid int errCode; // error code (if is false) Object trailerDict; // trailer dictionary - Guint lastXRefPos; // offset of last xref table Guint *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds -- 1.6.4.2 From b8ba587657e2e69fa82d5a60638a48a194162e0d Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 7 Apr 2010 12:35:05 +0200 Subject: [PATCH 11/12] Use XRef table at start of linearized document --- poppler/PDFDoc.cc | 27 ++++++++++++++++++++++++++- 1 files changed, 26 insertions(+), 1 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index bb1eee7..9ec7831 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -74,6 +74,10 @@ #define headerSearchSize 1024 // read this many bytes at beginning of // file to look for '%PDF' +#define linearizationSearchSize 1024 // read this many bytes at beginning of + // file to look for linearization + // dictionary + #define xrefSearchSize 1024 // read this many bytes at end of file // to look for 'startxref' @@ -952,7 +956,28 @@ Guint PDFDoc::getStartXRef() { if (startXRefPos == ~(Guint)0) { - { + if (isLinearized()) { + char buf[linearizationSearchSize+1]; + int c, n, i; + + str->setPos(0); + for (n = 0; n < linearizationSearchSize; ++n) { + if ((c = str->getChar()) == EOF) { + break; + } + buf[n] = c; + } + buf[n] = '\0'; + + // find end of first obj + startXRefPos = 0; + for (i = 0; i < n; i++) { + if (!strncmp("endobj", &buf[i], 6)) { + startXRefPos = i+6; + break; + } + } + } else { char buf[xrefSearchSize+1]; char *p; int c, n, i; -- 1.6.4.2 From f58e0037bf45ae0836b14e4d6e88e5d90f1ae78c Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Sun, 25 Apr 2010 17:34:49 +0200 Subject: [PATCH 12/12] Use linearization data to parse XRef entries --- poppler/PDFDoc.cc | 12 +++++++++++- poppler/PDFDoc.h | 3 +++ poppler/XRef.cc | 43 ++++++++++++++++++++++++++++++++++++++++++- poppler/XRef.h | 6 +++++- 4 files changed, 61 insertions(+), 3 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 9ec7831..1420b39 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -232,7 +232,7 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) { checkHeader(); // read xref table - xref = new XRef(str, getStartXRef()); + xref = new XRef(str, getStartXRef(), getMainXRefEntriesOffset()); if (!xref->isOk()) { error(-1, "Couldn't read xref table"); errCode = xref->getErrorCode(); @@ -1010,4 +1010,14 @@ Guint PDFDoc::getStartXRef() return startXRefPos; } +Guint PDFDoc::getMainXRefEntriesOffset() +{ + Guint mainXRefEntriesOffset = 0; + + if (isLinearized()) { + mainXRefEntriesOffset = getLinearization()->getMainXRefEntriesOffset(); + } + + return mainXRefEntriesOffset; +} diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index d093b59..f6f8c8f 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -241,6 +241,9 @@ private: GBool checkEncryption(GooString *ownerPassword, GooString *userPassword); // Get the offset of the start xref table. Guint getStartXRef(); + // Get the offset of the entries in the main XRef table of a + // linearized document (0 for non linearized documents). + Guint getMainXRefEntriesOffset(); Guint strToUnsigned(char *s); GooString *fileName; diff --git a/poppler/XRef.cc b/poppler/XRef.cc index ead8b55..25d4e99 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -230,16 +230,19 @@ void XRef::init() { streamEnds = NULL; streamEndsLen = 0; objStr = NULL; + mainXRefEntriesOffset = 0; + xRefStream = gFalse; } XRef::XRef() { init(); } -XRef::XRef(BaseStream *strA, Guint pos) { +XRef::XRef(BaseStream *strA, Guint pos, Guint mainXRefEntriesOffsetA) { Object obj; init(); + mainXRefEntriesOffset = mainXRefEntriesOffsetA; encrypted = gFalse; permFlags = defPermFlags; @@ -403,6 +406,9 @@ GBool XRef::readXRef(Guint *pos, GooVector *followedXRefStm) { if (!parser->getObj(&obj)->isStream()) { goto err1; } + if (trailerDict.isNone()) { + xRefStream = gTrue; + } more = readXRefStream(obj.getStream(), pos); obj.free(); @@ -1176,10 +1182,44 @@ void XRef::writeToFile(OutStream* outStr, GBool writeAllEntries) { } } +GBool XRef::parseEntry(Guint offset, XRefEntry *entry) +{ + GBool r; + + Object obj; + obj.initNull(); + Parser parser = Parser(NULL, new Lexer(NULL, + str->makeSubStream(offset, gFalse, 20, &obj)), gTrue); + + Object obj1, obj2, obj3; + if ((parser.getObj(&obj1)->isInt()) && + (parser.getObj(&obj2)->isInt()) && + (parser.getObj(&obj3)->isCmd("n") || obj3.isCmd("f"))) { + entry->offset = (Guint) obj1.getInt(); + entry->gen = obj2.getInt(); + entry->type = obj3.isCmd("n") ? xrefEntryUncompressed : xrefEntryFree; + entry->obj.initNull (); + entry->updated = false; + r = gTrue; + } else { + r = gFalse; + } + obj1.free(); + obj2.free(); + obj3.free(); + + return r; +} + XRefEntry *XRef::getEntry(int i) { if (entries[i].type == xrefEntryNone) { + if ((!xRefStream) && mainXRefEntriesOffset) { + if (!parseEntry(mainXRefEntriesOffset + 20*i, &entries[i])) { + error(-1, "Failed to parse XRef entry [%d].", i); + } + } else { GooVector followedPrev; while (prevXRefOffset && entries[i].type == xrefEntryNone) { bool ok = true; @@ -1209,6 +1249,7 @@ XRefEntry *XRef::getEntry(int i) error(-1, "Invalid XRef entry"); entries[i].type = xrefEntryFree; } + } } return &entries[i]; diff --git a/poppler/XRef.h b/poppler/XRef.h index 45f7f57..31cc731 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -64,7 +64,7 @@ public: // Constructor, create an empty XRef, used for PDF writing XRef(); // Constructor. Read xref table from stream. - XRef(BaseStream *strA, Guint pos); + XRef(BaseStream *strA, Guint pos, Guint mainXRefEntriesOffsetA = 0); // Destructor. ~XRef(); @@ -154,6 +154,8 @@ private: Guchar fileKey[16]; // file decryption key GBool ownerPasswordOk; // true if owner password is correct Guint prevXRefOffset; // position of prev XRef section (= next to read) + Guint mainXRefEntriesOffset; // offset of entries in main XRef table + GBool xRefStream; // true if last XRef section is a stream void init(); int reserve(int newSize); @@ -165,6 +167,8 @@ private: GBool readXRefStream(Stream *xrefStr, Guint *pos); GBool constructXRef(); Guint strToUnsigned(char *s); + GBool parseEntry(Guint offset, XRefEntry *entry); + }; #endif -- 1.6.4.2 -------------- next part -------------- From f8c0264dc39e7e9356abfedf0061ea3d5de88a3d Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 20 Apr 2010 19:03:54 +0200 Subject: [PATCH 01/15] add PDFDoc::getPage() --- poppler/PDFDoc.cc | 8 ++++++++ poppler/PDFDoc.h | 3 +++ 2 files changed, 11 insertions(+), 0 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 1420b39..bd84661 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1021,3 +1021,11 @@ Guint PDFDoc::getMainXRefEntriesOffset() return mainXRefEntriesOffset; } +Page *PDFDoc::getPage(int page) +{ + if ((page < 1) || page > getNumPages()) return NULL; + + { + return catalog->getPage(page); + } +} diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index f6f8c8f..011e6e1 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -127,6 +127,9 @@ public: // Return the structure tree root object. Object *getStructTreeRoot() { return catalog->getStructTreeRoot(); } + // Get page. + Page *getPage(int page); + // Display a page. void displayPage(OutputDev *out, int page, double hDPI, double vDPI, int rotate, -- 1.6.4.2 From a79d0c6e4aee8935d071a519e12761bcb055b070 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 20 Apr 2010 19:36:08 +0200 Subject: [PATCH 02/15] Use PDFDoc::getPage() in PDFDoc --- poppler/PDFDoc.cc | 28 +++++++++++++++++++++------- poppler/PDFDoc.h | 10 +++++----- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index bd84661..7de1b99 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -397,8 +397,11 @@ void PDFDoc::displayPage(OutputDev *out, int page, if (globalParams->getPrintCommands()) { printf("***** page %d *****\n", page); } - catalog->getPage(page)->display(out, hDPI, vDPI, - rotate, useMediaBox, crop, printing, catalog, + + Page *p = getPage(page); + if (!p) return; + + p->display(out, hDPI, vDPI, rotate, useMediaBox, crop, printing, catalog, abortCheckCbk, abortCheckCbkData, annotDisplayDecideCbk, annotDisplayDecideCbkData); } @@ -427,8 +430,11 @@ void PDFDoc::displayPageSlice(OutputDev *out, int page, void *abortCheckCbkData, GBool (*annotDisplayDecideCbk)(Annot *annot, void *user_data), void *annotDisplayDecideCbkData) { - catalog->getPage(page)->displaySlice(out, hDPI, vDPI, - rotate, useMediaBox, crop, + + Page *p = getPage(page); + if (!p) return; + + p->displaySlice(out, hDPI, vDPI, rotate, useMediaBox, crop, sliceX, sliceY, sliceW, sliceH, printing, catalog, abortCheckCbk, abortCheckCbkData, @@ -436,11 +442,19 @@ void PDFDoc::displayPageSlice(OutputDev *out, int page, } Links *PDFDoc::getLinks(int page) { - return catalog->getPage(page)->getLinks(catalog); + Page *p = getPage(page); + if (!p) { + Object obj; + obj.initNull(); + return new Links (&obj, NULL); + } + return p->getLinks(catalog); } - + void PDFDoc::processLinks(OutputDev *out, int page) { - catalog->getPage(page)->processLinks(out, catalog); + Page *p = getPage(page); + if (!p) return; + p->processLinks(out, catalog); } Linearization *PDFDoc::getLinearization() diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 011e6e1..8de139f 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -107,15 +107,15 @@ public: // Get page parameters. double getPageMediaWidth(int page) - { return catalog->getPage(page)->getMediaWidth(); } + { return getPage(page) ? getPage(page)->getMediaWidth() : 0.0 ; } double getPageMediaHeight(int page) - { return catalog->getPage(page)->getMediaHeight(); } + { return getPage(page) ? getPage(page)->getMediaHeight() : 0.0 ; } double getPageCropWidth(int page) - { return catalog->getPage(page)->getCropWidth(); } + { return getPage(page) ? getPage(page)->getCropWidth() : 0.0 ; } double getPageCropHeight(int page) - { return catalog->getPage(page)->getCropHeight(); } + { return getPage(page) ? getPage(page)->getCropHeight() : 0.0 ; } int getPageRotate(int page) - { return catalog->getPage(page)->getRotate(); } + { return getPage(page) ? getPage(page)->getRotate() : 0 ; } // Get number of pages. int getNumPages() { return catalog->getNumPages(); } -- 1.6.4.2 From cef63cfdf775f9aa84e23c371577b7343b5d3bc5 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 20 Apr 2010 20:48:30 +0200 Subject: [PATCH 03/15] Use PDFDoc::getPage() in FontInfo --- poppler/FontInfo.cc | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/poppler/FontInfo.cc b/poppler/FontInfo.cc index 0037e07..c348d14 100644 --- a/poppler/FontInfo.cc +++ b/poppler/FontInfo.cc @@ -70,7 +70,9 @@ GooList *FontInfoScanner::scan(int nPages) { } for (int pg = currentPage; pg < lastPage; ++pg) { - page = doc->getCatalog()->getPage(pg); + page = doc->getPage(pg); + if (!page) continue; + if ((resDict = page->getResourceDict())) { scanFonts(resDict, result); } -- 1.6.4.2 From 38fc1c96526e614062ecfe57dcde26a818117c4e Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 22 Apr 2010 11:11:11 +0200 Subject: [PATCH 04/15] Use PDFDoc::getPage() in pdfinfo --- utils/pdfinfo.cc | 22 +++++++++++++++------- 1 files changed, 15 insertions(+), 7 deletions(-) diff --git a/utils/pdfinfo.cc b/utils/pdfinfo.cc index 2abe8b4..a94e4e8 100644 --- a/utils/pdfinfo.cc +++ b/utils/pdfinfo.cc @@ -257,7 +257,11 @@ int main(int argc, char *argv[]) { if (printBoxes) { if (multiPage) { for (pg = firstPage; pg <= lastPage; ++pg) { - page = doc->getCatalog()->getPage(pg); + page = doc->getPage(pg); + if (!page) { + error(-1, "Failed to print boxes for page %d", pg); + continue; + } sprintf(buf, "Page %4d MediaBox: ", pg); printBox(buf, page->getMediaBox()); sprintf(buf, "Page %4d CropBox: ", pg); @@ -270,12 +274,16 @@ int main(int argc, char *argv[]) { 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()); + page = doc->getPage(firstPage); + if (!page) { + error(-1, "Failed to print boxes for page %d", firstPage); + } else { + printBox("MediaBox: ", page->getMediaBox()); + printBox("CropBox: ", page->getCropBox()); + printBox("BleedBox: ", page->getBleedBox()); + printBox("TrimBox: ", page->getTrimBox()); + printBox("ArtBox: ", page->getArtBox()); + } } } -- 1.6.4.2 From a489084ea8da8477f4a5bf4f585e2f3bc39497b7 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 22 Apr 2010 11:19:53 +0200 Subject: [PATCH 05/15] Use PDFDoc::getPage() in pdffonts --- utils/pdffonts.cc | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/utils/pdffonts.cc b/utils/pdffonts.cc index 81b20e4..30e25dc 100644 --- a/utils/pdffonts.cc +++ b/utils/pdffonts.cc @@ -166,7 +166,11 @@ int main(int argc, char *argv[]) { fonts = NULL; fontsLen = fontsSize = 0; for (pg = firstPage; pg <= lastPage; ++pg) { - page = doc->getCatalog()->getPage(pg); + page = doc->getPage(pg); + if (!page) { + error(-1, "Failed to read fonts from page %d", pg); + continue; + } if ((resDict = page->getResourceDict())) { scanFonts(resDict, doc); } -- 1.6.4.2 From 54488cc82a5ae244524aefdf4743b702a8ff63a2 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 22 Apr 2010 15:52:20 +0200 Subject: [PATCH 06/15] Use PDFDoc::getPage() in glib --- glib/poppler-action.cc | 4 ++-- glib/poppler-document.cc | 17 ++++++++++------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index ffc1842..a0f8576 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -422,13 +422,13 @@ find_annot_movie_for_action (PopplerDocument *document, xref->fetch (ref->num, ref->gen, &annotObj); } else if (link->hasAnnotTitle ()) { - Catalog *catalog = document->doc->getCatalog (); Object annots; GooString *title = link->getAnnotTitle (); int i; for (i = 1; i <= document->doc->getNumPages (); ++i) { - Page *p = catalog->getPage (i); + Page *p = document->doc->getPage (i); + if (!p) continue; if (p->getAnnots (&annots)->isArray ()) { int j; diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index cd6794a..ccb0f1c 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -379,15 +379,14 @@ PopplerPage * poppler_document_get_page (PopplerDocument *document, int index) { - Catalog *catalog; Page *page; g_return_val_if_fail (0 <= index && index < poppler_document_get_n_pages (document), NULL); - catalog = document->doc->getCatalog(); - page = catalog->getPage (index + 1); + page = document->doc->getPage (index + 1); + if (!page) return NULL; return _poppler_page_new (document, page, index); } @@ -1909,18 +1908,22 @@ PopplerFormField * poppler_document_get_form_field (PopplerDocument *document, gint id) { - Catalog *catalog = document->doc->getCatalog(); + Page *page; unsigned pageNum; unsigned fieldNum; FormPageWidgets *widgets; FormWidget *field; FormWidget::decodeID (id, &pageNum, &fieldNum); - - widgets = catalog->getPage (pageNum)->getPageWidgets (); + + page = document->doc->getPage (pageNum); + if (!page) + return NULL; + + widgets = page->getPageWidgets (); if (!widgets) return NULL; - + field = widgets->getWidget (fieldNum); if (field) return _poppler_form_field_new (document, field); -- 1.6.4.2 From f4b803d58270fba7a61133f2e1c0a0eb5b394da5 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 22 Apr 2010 17:59:01 +0200 Subject: [PATCH 07/15] Use PDFDoc::getPage() in qt4 Note API change: With this patch, Document::Page(int index) can now return NULL when poppler fails to create a page. Any application using these bindings should check the return value. --- qt4/src/poppler-document.cc | 8 +++++++- qt4/src/poppler-link.cc | 6 ++++-- qt4/src/poppler-page.cc | 3 ++- qt4/src/poppler-qt4.h | 3 +++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/qt4/src/poppler-document.cc b/qt4/src/poppler-document.cc index 41d35b6..dc0ce97 100644 --- a/qt4/src/poppler-document.cc +++ b/qt4/src/poppler-document.cc @@ -98,7 +98,13 @@ namespace Poppler { Page *Document::page(int index) const { - return new Page(m_doc, index); + Page *page = new Page(m_doc, index); + if (!page->isOk()) { + delete page; + return NULL; + } + + return page; } bool Document::isLocked() const diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc index de06242..4f54201 100644 --- a/qt4/src/poppler-link.cc +++ b/qt4/src/poppler-link.cc @@ -232,9 +232,11 @@ class LinkMoviePrivate : public LinkPrivate int leftAux = 0, topAux = 0, rightAux = 0, bottomAux = 0; - if (d->pageNum > 0 && d->pageNum <= data.doc->doc->getNumPages()) + ::Page *page; + if (d->pageNum > 0 && + d->pageNum <= data.doc->doc->getNumPages() && + (page = data.doc->doc->getPage( d->pageNum ))) { - ::Page *page = data.doc->doc->getCatalog()->getPage( d->pageNum ); cvtUserToDev( page, left, top, &leftAux, &topAux ); cvtUserToDev( page, right, bottom, &rightAux, &bottomAux ); diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..335f2ce 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -186,8 +186,9 @@ Page::Page(DocumentData *doc, int index) { m_page = new PageData(); m_page->index = index; m_page->parentDoc = doc; - m_page->page = doc->doc->getCatalog()->getPage(m_page->index + 1); + m_page->page = doc->doc->getPage(m_page->index + 1); m_page->transition = 0; + ok = m_page->page ? true : false; } Page::~Page() diff --git a/qt4/src/poppler-qt4.h b/qt4/src/poppler-qt4.h index 117dc43..2e77f48 100644 --- a/qt4/src/poppler-qt4.h +++ b/qt4/src/poppler-qt4.h @@ -587,11 +587,14 @@ delete it; **/ QString label() const; + bool isOk() { return ok; }; + private: Q_DISABLE_COPY(Page) Page(DocumentData *doc, int index); PageData *m_page; + bool ok; }; /** -- 1.6.4.2 From e8b547ef7cda0b8abf8559fc7299cfff73add2f4 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Fri, 23 Apr 2010 09:21:23 +0200 Subject: [PATCH 08/15] Use PDFDoc::getPage() in qt Note API change: With this patch, Document::getPage(int index) can now return NULL when poppler fails to create a page. Any application using these bindings should check the return value. --- qt/poppler-document.cc | 11 +++++++++++ qt/poppler-page.cc | 11 +++++++---- qt/poppler-qt.h | 6 +++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc index bade1d1..1a5892b 100644 --- a/qt/poppler-document.cc +++ b/qt/poppler-document.cc @@ -113,6 +113,17 @@ int Document::getNumPages() const return data->doc.getNumPages(); } +Page *Document::getPage(int index) const +{ + Page *p = new Page(this, index); + if (!p->isOk()) { + delete p; + return NULL; + } + + return p; +} + QValueList Document::fonts() const { QValueList ourList; diff --git a/qt/poppler-page.cc b/qt/poppler-page.cc index a42aa15..ef077a7 100644 --- a/qt/poppler-page.cc +++ b/qt/poppler-page.cc @@ -47,6 +47,7 @@ class PageData { const Document *doc; int index; PageTransition *transition; + ::Page *page; }; Page::Page(const Document *doc, int index) { @@ -54,6 +55,8 @@ Page::Page(const Document *doc, int index) { data->index = index; data->doc = doc; data->transition = 0; + data->page = doc->data->doc.getPage(data->index + 1); + ok = data->page ? true : false; } Page::~Page() @@ -132,7 +135,7 @@ QString Page::getText(const Rectangle &r) const output_dev = new TextOutputDev(0, gFalse, gFalse, gFalse); data->doc->data->doc.displayPageSlice(output_dev, data->index + 1, 72, 72, 0, false, false, false, -1, -1, -1, -1); - p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + p = data->page; if (r.isNull()) { rect = p->getCropBox(); @@ -197,7 +200,7 @@ PageTransition *Page::getTransition() const { Object o; PageTransitionParams params; - params.dictObj = data->doc->data->doc.getCatalog()->getPage(data->index + 1)->getTrans(&o); + params.dictObj = data->page->getTrans(&o); data->transition = new PageTransition(params); o.free(); } @@ -208,7 +211,7 @@ QSize Page::pageSize() const { ::Page *p; - p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + p = data->page; if ( ( Page::Landscape == orientation() ) || (Page::Seascape == orientation() ) ) { return QSize( (int)p->getCropHeight(), (int)p->getCropWidth() ); } else { @@ -218,7 +221,7 @@ QSize Page::pageSize() const Page::Orientation Page::orientation() const { - ::Page *p = data->doc->data->doc.getCatalog()->getPage(data->index + 1); + ::Page *p = data->page; int rotation = p->getRotate(); switch (rotation) { diff --git a/qt/poppler-qt.h b/qt/poppler-qt.h index a6b1e6e..549ffd2 100644 --- a/qt/poppler-qt.h +++ b/qt/poppler-qt.h @@ -31,6 +31,7 @@ #include #include + namespace Poppler { class Document; @@ -198,9 +199,12 @@ class Page { */ QValueList links() const; + bool isOk() { return ok; }; + private: Page(const Document *doc, int index); PageData *data; + bool ok; }; class DocumentData; @@ -219,7 +223,7 @@ public: static Document *load(const QString & filePath); - Page *getPage(int index) const{ return new Page(this, index); } + Page *getPage(int index) const; int getNumPages() const; -- 1.6.4.2 From 515d9055f10cd3dab7c8b2cd8828e01859383bd4 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Fri, 23 Apr 2010 12:07:39 +0200 Subject: [PATCH 09/15] Use PDFDoc::getPage() in PSOutputDev --- glib/poppler-page.cc | 1 + poppler/PSOutputDev.cc | 37 ++++++++++++++++++++++--------------- poppler/PSOutputDev.h | 13 ++++++++----- qt/poppler-document.cc | 2 +- qt4/src/poppler-ps-converter.cc | 1 + utils/pdftohtml.cc | 2 +- utils/pdftops.cc | 2 +- 7 files changed, 35 insertions(+), 23 deletions(-) diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 39645bd..106b636 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1161,6 +1161,7 @@ poppler_page_render_to_ps (PopplerPage *page, if (!ps_file->out) ps_file->out = new PSOutputDev (ps_file->filename, + ps_file->document->doc, ps_file->document->doc->getXRef(), ps_file->document->doc->getCatalog(), NULL, diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc index 179a494..5e5d3d0 100644 --- a/poppler/PSOutputDev.cc +++ b/poppler/PSOutputDev.cc @@ -70,6 +70,7 @@ # include "SplashOutputDev.h" #endif #include "PSOutputDev.h" +#include "PDFDoc.h" #ifdef MACOS // needed for setting type/creator of MacOS files @@ -972,7 +973,7 @@ static void outputToFile(void *stream, char *data, int len) { fwrite(data, 1, len, (FILE *)stream); } -PSOutputDev::PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog, +PSOutputDev::PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog *catalog, char *psTitle, int firstPage, int lastPage, PSOutMode modeA, int paperWidthA, int paperHeightA, GBool duplexA, @@ -1033,13 +1034,14 @@ PSOutputDev::PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog, } init(outputToFile, f, fileTypeA, psTitle, - xrefA, catalog, firstPage, lastPage, modeA, + doc, xrefA, catalog, firstPage, lastPage, modeA, imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA, paperWidthA, paperHeightA, duplexA); } PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, char *psTitle, + PDFDoc *doc, XRef *xrefA, Catalog *catalog, int firstPage, int lastPage, PSOutMode modeA, int paperWidthA, int paperHeightA, GBool duplexA, @@ -1068,18 +1070,17 @@ PSOutputDev::PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, forceRasterize = forceRasterizeA; init(outputFuncA, outputStreamA, psGeneric, psTitle, - xrefA, catalog, firstPage, lastPage, modeA, + doc, xrefA, catalog, firstPage, lastPage, modeA, imgLLXA, imgLLYA, imgURXA, imgURYA, manualCtrlA, paperWidthA, paperHeightA, duplexA); } void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, - PSFileType fileTypeA, char *pstitle, XRef *xrefA, Catalog *catalog, + PSFileType fileTypeA, char *pstitle, PDFDoc *doc, XRef *xrefA, Catalog *catalog, int firstPage, int lastPage, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, GBool manualCtrlA, int paperWidthA, int paperHeightA, GBool duplexA) { - Page *page; PDFRectangle *box; // initialize @@ -1099,12 +1100,12 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, imgURX = imgURXA; imgURY = imgURYA; if (paperWidth < 0 || paperHeight < 0) { - // this check is needed in case the document has zero pages - if (firstPage > 0 && firstPage <= catalog->getNumPages()) { - page = catalog->getPage(firstPage); + Page *page; + if ((page = doc->getPage(firstPage))) { paperWidth = (int)ceil(page->getMediaWidth()); paperHeight = (int)ceil(page->getMediaHeight()); } else { + error(-1, "Invalid page %d", firstPage); paperWidth = 1; paperHeight = 1; } @@ -1170,14 +1171,16 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, embFontList = new GooString(); if (!manualCtrl) { + Page *page; // this check is needed in case the document has zero pages - if (firstPage > 0 && firstPage <= catalog->getNumPages()) { + if ((page = doc->getPage(firstPage))) { writeHeader(firstPage, lastPage, - catalog->getPage(firstPage)->getMediaBox(), - catalog->getPage(firstPage)->getCropBox(), - catalog->getPage(firstPage)->getRotate(), + page->getMediaBox(), + page->getCropBox(), + page->getRotate(), pstitle); } else { + error(-1, "Invalid page %d", firstPage); box = new PDFRectangle(0, 0, 1, 1); writeHeader(firstPage, lastPage, box, box, 0, pstitle); delete box; @@ -1190,7 +1193,7 @@ void PSOutputDev::init(PSOutputFunc outputFuncA, void *outputStreamA, writePS("%%EndProlog\n"); writePS("%%BeginSetup\n"); } - writeDocSetup(catalog, firstPage, lastPage, duplexA); + writeDocSetup(doc, catalog, firstPage, lastPage, duplexA); if (mode != psModeForm) { writePS("%%EndSetup\n"); } @@ -1400,7 +1403,7 @@ void PSOutputDev::writeXpdfProcset() { } } -void PSOutputDev::writeDocSetup(Catalog *catalog, +void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog, int firstPage, int lastPage, GBool duplexA) { Page *page; @@ -1416,7 +1419,11 @@ void PSOutputDev::writeDocSetup(Catalog *catalog, writePS("xpdf begin\n"); } for (pg = firstPage; pg <= lastPage; ++pg) { - page = catalog->getPage(pg); + page = doc->getPage(pg); + if (!page) { + error(-1, "Failed writing resources for page %d", pg); + continue; + } if ((resDict = page->getResourceDict())) { setupResources(resDict); } diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h index 38c838c..a84a638 100644 --- a/poppler/PSOutputDev.h +++ b/poppler/PSOutputDev.h @@ -50,6 +50,7 @@ struct PSFont8Info; struct PSFont16Enc; class PSOutCustomColor; class Function; +class PDFDoc; //------------------------------------------------------------------------ // PSOutputDev @@ -75,7 +76,7 @@ class PSOutputDev: public OutputDev { public: // Open a PostScript output file, and write the prolog. - PSOutputDev(const char *fileName, XRef *xrefA, Catalog *catalog, + PSOutputDev(const char *fileName, PDFDoc *doc, XRef *xrefA, Catalog *catalog, char *psTitle, int firstPage, int lastPage, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, @@ -88,6 +89,7 @@ public: // Open a PSOutputDev that will write to a generic stream. PSOutputDev(PSOutputFunc outputFuncA, void *outputStreamA, char *psTitle, + PDFDoc *doc, XRef *xrefA, Catalog *catalog, int firstPage, int lastPage, PSOutMode modeA, int paperWidthA = -1, int paperHeightA = -1, @@ -145,9 +147,6 @@ public: // Write the Xpdf procset. void writeXpdfProcset(); - // Write the document-level setup. - void writeDocSetup(Catalog *catalog, int firstPage, int lastPage, GBool duplexA); - // Write the trailer for the current page. void writePageTrailer(); @@ -287,7 +286,7 @@ public: private: void init(PSOutputFunc outputFuncA, void *outputStreamA, - PSFileType fileTypeA, char *pstitle, XRef *xrefA, Catalog *catalog, + PSFileType fileTypeA, char *pstitle, PDFDoc *doc, XRef *xrefA, Catalog *catalog, int firstPage, int lastPage, PSOutMode modeA, int imgLLXA, int imgLLYA, int imgURXA, int imgURYA, GBool manualCtrlA, int paperWidthA, int paperHeightA, @@ -341,6 +340,10 @@ private: double *x1, double *y1); #endif void cvtFunction(Function *func); + + // Write the document-level setup. + void writeDocSetup(PDFDoc *doc, Catalog *catalog, int firstPage, int lastPage, GBool duplexA); + void writePSChar(char c); void writePS(char *s); void writePSFmt(const char *fmt, ...); diff --git a/qt/poppler-document.cc b/qt/poppler-document.cc index 1a5892b..03d01fa 100644 --- a/qt/poppler-document.cc +++ b/qt/poppler-document.cc @@ -325,7 +325,7 @@ bool Document::print(const QString &fileName, QValueList pageList, double h bool Document::print(const QString &file, QValueList pageList, double hDPI, double vDPI, int rotate, int paperWidth, int paperHeight) { - PSOutputDev *psOut = new PSOutputDev(file.latin1(), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); + PSOutputDev *psOut = new PSOutputDev(file.latin1(), &(data->doc), data->doc.getXRef(), data->doc.getCatalog(), NULL, 1, data->doc.getNumPages(), psModePS, paperWidth, paperHeight); if (psOut->isOk()) { QValueList::iterator it; diff --git a/qt4/src/poppler-ps-converter.cc b/qt4/src/poppler-ps-converter.cc index 7a1957b..9dc82ec 100644 --- a/qt4/src/poppler-ps-converter.cc +++ b/qt4/src/poppler-ps-converter.cc @@ -195,6 +195,7 @@ bool PSConverter::convert() PSOutputDev *psOut = new PSOutputDev(outputToQIODevice, dev, pstitlechar, + d->document->doc, d->document->doc->getXRef(), d->document->doc->getCatalog(), 1, diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc index 3c74c6e..0558e5c 100644 --- a/utils/pdftohtml.cc +++ b/utils/pdftohtml.cc @@ -350,7 +350,7 @@ int main(int argc, char *argv[]) { psFileName = new GooString(htmlFileName->getCString()); psFileName->append(".ps"); - psOut = new PSOutputDev(psFileName->getCString(), doc->getXRef(), + psOut = new PSOutputDev(psFileName->getCString(), doc, doc->getXRef(), doc->getCatalog(), NULL, firstPage, lastPage, psModePS, w, h); psOut->setDisplayText(gFalse); doc->displayPages(psOut, firstPage, lastPage, 72, 72, 0, diff --git a/utils/pdftops.cc b/utils/pdftops.cc index 0bc43a1..8231458 100644 --- a/utils/pdftops.cc +++ b/utils/pdftops.cc @@ -359,7 +359,7 @@ int main(int argc, char *argv[]) { } // write PostScript file - psOut = new PSOutputDev(psFileName->getCString(), doc->getXRef(), + psOut = new PSOutputDev(psFileName->getCString(), doc, doc->getXRef(), doc->getCatalog(), NULL, firstPage, lastPage, mode, paperWidth, paperHeight, -- 1.6.4.2 From d7da607f8aad0c6410bf59c19f9d3444a0cd9ad8 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Sat, 24 Apr 2010 10:17:56 +0200 Subject: [PATCH 10/15] Use PDFDoc::getPage() in HtmlOutputDev --- utils/HtmlOutputDev.cc | 2 +- utils/HtmlOutputDev.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletions(-) diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc index 81f8b88..4f7dff6 100644 --- a/utils/HtmlOutputDev.cc +++ b/utils/HtmlOutputDev.cc @@ -1093,7 +1093,7 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state) { void HtmlOutputDev::endPage() { - Links *linksList = catalog->getPage(pageNum)->getLinks(catalog); + Links *linksList = docPage->getLinks(catalog); for (int i = 0; i < linksList->getNumLinks(); ++i) { doProcessLink(linksList->getLink(i)); diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h index 24ccfd1..48b04c6 100644 --- a/utils/HtmlOutputDev.h +++ b/utils/HtmlOutputDev.h @@ -256,6 +256,7 @@ public: GBool (* abortCheckCbk)(void *data) = NULL, void * abortCheckCbkData = NULL) { + docPage = page; catalog = catalogA; return gTrue; } @@ -323,6 +324,7 @@ private: GooString *docTitle; GooList *glMetaVars; Catalog *catalog; + Page *docPage; friend class HtmlPage; }; -- 1.6.4.2 From 979622d0755354c627c899e4261ed5e73883ac68 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 31 Mar 2010 14:39:57 +0200 Subject: [PATCH 11/15] Parse page tree on demand --- poppler/Catalog.cc | 266 ++++++++++++++++++++++++++++++++++----------------- poppler/Catalog.h | 12 ++- 2 files changed, 185 insertions(+), 93 deletions(-) diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 900cdd7..416fb66 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -59,9 +59,6 @@ Catalog::Catalog(XRef *xrefA) { Object catDict, pagesDict, pagesDictRef; Object obj, obj2; Object optContentProps; - char *alreadyRead; - int numPages0; - int i; ok = gTrue; xref = xrefA; @@ -78,6 +75,12 @@ Catalog::Catalog(XRef *xrefA) { embeddedFileNameTree = NULL; jsNameTree = NULL; + pagesList = NULL; + pagesRefList = NULL; + attrsList = NULL; + kidsIdxList = NULL; + lastCachedPage = 0; + xref->getCatalog(&catDict); if (!catDict.isDict()) { error(-1, "Catalog object is wrong type (%s)", catDict.getTypeName()); @@ -100,31 +103,11 @@ Catalog::Catalog(XRef *xrefA) { if (!obj.isNum()) { error(-1, "Page count in top-level pages object is wrong type (%s)", obj.getTypeName()); - pagesSize = numPages0 = 0; + numPages = 0; } else { - pagesSize = numPages0 = (int)obj.getNum(); + numPages = (int)obj.getNum(); } obj.free(); - pages = (Page **)gmallocn(pagesSize, sizeof(Page *)); - pageRefs = (Ref *)gmallocn(pagesSize, sizeof(Ref)); - for (i = 0; i < pagesSize; ++i) { - pages[i] = NULL; - pageRefs[i].num = -1; - pageRefs[i].gen = -1; - } - alreadyRead = (char *)gmalloc(xref->getNumObjects()); - memset(alreadyRead, 0, xref->getNumObjects()); - if (catDict.dictLookupNF("Pages", &pagesDictRef)->isRef() && - pagesDictRef.getRefNum() >= 0 && - pagesDictRef.getRefNum() < xref->getNumObjects()) { - alreadyRead[pagesDictRef.getRefNum()] = 1; - } - pagesDictRef.free(); - numPages = readPageTree(pagesDict.getDict(), NULL, 0, alreadyRead); - gfree(alreadyRead); - if (numPages != numPages0) { - error(-1, "Page count in top-level pages object is incorrect"); - } pagesDict.free(); // read base URI @@ -163,6 +146,10 @@ Catalog::Catalog(XRef *xrefA) { Catalog::~Catalog() { int i; + delete kidsIdxList; + delete attrsList; + delete pagesRefList; + delete pagesList; if (pages) { for (i = 0; i < pagesSize; ++i) { if (pages[i]) { @@ -225,91 +212,192 @@ GooString *Catalog::readMetadata() { return s; } -int Catalog::readPageTree(Dict *pagesDict, PageAttrs *attrs, int start, - char *alreadyRead) { - Object kids; - Object kid; - Object kidRef; - PageAttrs *attrs1, *attrs2; - Page *page; - int i, j; - - attrs1 = new PageAttrs(attrs, pagesDict); - pagesDict->lookup("Kids", &kids); - if (!kids.isArray()) { - error(-1, "Kids object (page %d) is wrong type (%s)", - start+1, kids.getTypeName()); - return start; - } - for (i = 0; i < kids.arrayGetLength(); ++i) { - kids.arrayGetNF(i, &kidRef); - if (kidRef.isRef() && - kidRef.getRefNum() >= 0 && - kidRef.getRefNum() < xref->getNumObjects()) { - if (alreadyRead[kidRef.getRefNum()]) { - error(-1, "Loop in Pages tree"); - kidRef.free(); - continue; +Page *Catalog::getPage(int i) +{ + if (i < 1) return NULL; + + if (i > lastCachedPage) { + if (cachePageTree(i) == gFalse) return NULL; + } + return pages[i-1]; +} + +Ref *Catalog::getPageRef(int i) +{ + if (i < 1) return NULL; + + if (i > lastCachedPage) { + if (cachePageTree(i) == gFalse) return NULL; + } + return &pageRefs[i-1]; +} + +GBool Catalog::cachePageTree(int page) +{ + Dict *pagesDict; + + if (pagesList == NULL) { + + Object catDict; + Ref pagesRef; + + xref->getCatalog(&catDict); + + Object pagesDictRef; + if (catDict.dictLookupNF("Pages", &pagesDictRef)->isRef() && + pagesDictRef.getRefNum() >= 0 && + pagesDictRef.getRefNum() < xref->getNumObjects()) { + pagesRef = pagesDictRef.getRef(); + pagesDictRef.free(); + } else { + error(-1, "Catalog dictionary does not contain a valid \"Pages\" entry"); + pagesDictRef.free(); + return gFalse; + } + + Object obj; + catDict.dictLookup("Pages", &obj); + // This should really be isDict("Pages"), but I've seen at least one + // PDF file where the /Type entry is missing. + if (obj.isDict()) { + obj.getDict()->incRef(); + pagesDict = obj.getDict(); + obj.free(); + } + else { + error(-1, "Top-level pages object is wrong type (%s)", obj.getTypeName()); + obj.free(); + return gFalse; + } + + pagesSize = numPages; + pages = (Page **)gmallocn(pagesSize, sizeof(Page *)); + pageRefs = (Ref *)gmallocn(pagesSize, sizeof(Ref)); + for (int i = 0; i < pagesSize; ++i) { + pages[i] = NULL; + pageRefs[i].num = -1; + pageRefs[i].gen = -1; + } + + pagesList = new GooVector(); + pagesList->push_back(pagesDict); + pagesRefList = new GooVector(); + pagesRefList->push_back(pagesRef); + attrsList = new GooVector(); + attrsList->push_back(new PageAttrs(NULL, pagesDict)); + kidsIdxList = new GooVector(); + kidsIdxList->push_back(0); + lastCachedPage = 0; + + } + + while(1) { + + if (page <= lastCachedPage) return gTrue; + + if (pagesList->empty()) return gFalse; + + pagesDict = pagesList->back(); + Object kids; + pagesDict->lookup("Kids", &kids); + if (!kids.isArray()) { + error(-1, "Kids object (page %d) is wrong type (%s)", + lastCachedPage+1, kids.getTypeName()); + kids.free(); + return gFalse; + } + + int kidsIdx = kidsIdxList->back(); + if (kidsIdx >= kids.arrayGetLength()) { + delete pagesList->back(); + pagesList->pop_back(); + pagesRefList->pop_back(); + delete attrsList->back(); + attrsList->pop_back(); + kidsIdxList->pop_back(); + if (!kidsIdxList->empty()) kidsIdxList->back()++; + kids.free(); + continue; + } + + Object kidRef; + kids.arrayGetNF(kidsIdx, &kidRef); + if (!kidRef.isRef()) { + error(-1, "Kid object (page %d) is not an indirect reference (%s)", + lastCachedPage+1, kidRef.getTypeName()); + kidRef.free(); + kids.free(); + return gFalse; + } + + for (size_t i = 0; i < pagesRefList->size(); i++) { + if (((*pagesRefList)[i]).num == kidRef.getRefNum()) { + error(-1, "Loop in Pages tree"); + kidRef.free(); + kids.free(); + kidsIdxList->back()++; + continue; } - alreadyRead[kidRef.getRefNum()] = 1; } - kids.arrayGet(i, &kid); + + Object kid; + kids.arrayGet(kidsIdx, &kid); + kids.free(); if (kid.isDict("Page")) { - attrs2 = new PageAttrs(attrs1, kid.getDict()); - page = new Page(xref, start+1, kid.getDict(), kidRef.getRef(), attrs2, getForm()); - if (!page->isOk()) { - ++start; - goto err3; - } - if (start >= pagesSize) { - pagesSize += 32; - pages = (Page **)greallocn(pages, pagesSize, sizeof(Page *)); - pageRefs = (Ref *)greallocn(pageRefs, pagesSize, sizeof(Ref)); - for (j = pagesSize - 32; j < pagesSize; ++j) { - pages[j] = NULL; - pageRefs[j].num = -1; - pageRefs[j].gen = -1; - } + PageAttrs *attrs = new PageAttrs(attrsList->back(), kid.getDict()); + Page *p = new Page(xref, lastCachedPage+1, kid.getDict(), + kidRef.getRef(), attrs, form); + if (!p->isOk()) { + error(-1, "Failed to create page (page %d)", lastCachedPage+1); + delete p; + kidRef.free(); + kid.free(); + return gFalse; } - pages[start] = page; - if (kidRef.isRef()) { - pageRefs[start].num = kidRef.getRefNum(); - pageRefs[start].gen = kidRef.getRefGen(); + + if (lastCachedPage >= numPages) { + error(-1, "Page count in top-level pages object is incorrect"); + kidRef.free(); + kid.free(); + return gFalse; } - ++start; + + pages[lastCachedPage] = p; + pageRefs[lastCachedPage].num = kidRef.getRefNum(); + pageRefs[lastCachedPage].gen = kidRef.getRefGen(); + + lastCachedPage++; + kidsIdxList->back()++; + // This should really be isDict("Pages"), but I've seen at least one // PDF file where the /Type entry is missing. } else if (kid.isDict()) { - if ((start = readPageTree(kid.getDict(), attrs1, start, alreadyRead)) - < 0) - goto err2; + attrsList->push_back(new PageAttrs(attrsList->back(), kid.getDict())); + pagesRefList->push_back(kidRef.getRef()); + kid.getDict()->incRef(); + pagesList->push_back(kid.getDict()); + kidsIdxList->push_back(0); } else { error(-1, "Kid object (page %d) is wrong type (%s)", - start+1, kid.getTypeName()); + lastCachedPage+1, kid.getTypeName()); + kidRef.free(); + kid.free(); + return gFalse; } - kid.free(); kidRef.free(); + kid.free(); + } - delete attrs1; - kids.free(); - return start; - err3: - delete page; - err2: - kid.free(); - kidRef.free(); - kids.free(); - delete attrs1; - ok = gFalse; - return -1; + return gFalse; } int Catalog::findPage(int num, int gen) { int i; for (i = 0; i < numPages; ++i) { - if (pageRefs[i].num == num && pageRefs[i].gen == gen) + Ref *ref = getPageRef(i+1); + if (ref->num == num && ref->gen == gen) return i + 1; } return 0; diff --git a/poppler/Catalog.h b/poppler/Catalog.h index 2cab80a..5a25109 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -151,10 +151,10 @@ public: int getNumPages() { return numPages; } // Get a page. - Page *getPage(int i) { return pages[i-1]; } + Page *getPage(int i); // Get the reference for a page object. - Ref *getPageRef(int i) { return &pageRefs[i-1]; } + Ref *getPageRef(int i); // Return base URI, or NULL if none. GooString *getBaseURI() { return baseURI; } @@ -232,6 +232,11 @@ private: XRef *xref; // the xref table for this PDF file Page **pages; // array of pages Ref *pageRefs; // object ID for each page + int lastCachedPage; + GooVector *pagesList; + GooVector *pagesRefList; + GooVector *attrsList; + GooVector *kidsIdxList; Form *form; int numPages; // number of pages int pagesSize; // size of pages array @@ -251,8 +256,7 @@ private: PageMode pageMode; // page mode PageLayout pageLayout; // page layout - int readPageTree(Dict *pages, PageAttrs *attrs, int start, - char *alreadyRead); + GBool cachePageTree(int page); // Cache first pages. Object *findDestInTree(Object *tree, GooString *name, Object *obj); Object *getNames(); -- 1.6.4.2 From 2f6929d3fdb9692450b56b967e5bfbc4cefdf287 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 24 Mar 2010 22:01:41 +0100 Subject: [PATCH 12/15] Parse number of pages on demand --- poppler/Catalog.cc | 70 +++++++++++++++++++++++++++++++-------------------- poppler/Catalog.h | 2 +- 2 files changed, 43 insertions(+), 29 deletions(-) diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 416fb66..536e474 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -64,7 +64,8 @@ Catalog::Catalog(XRef *xrefA) { xref = xrefA; pages = NULL; pageRefs = NULL; - numPages = pagesSize = 0; + numPages = -1; + pagesSize = 0; baseURI = NULL; pageLabelInfo = NULL; form = NULL; @@ -89,27 +90,6 @@ Catalog::Catalog(XRef *xrefA) { // get the AcroForm dictionary catDict.dictLookup("AcroForm", &acroForm); - // read page tree - catDict.dictLookup("Pages", &pagesDict); - // This should really be isDict("Pages"), but I've seen at least one - // PDF file where the /Type entry is missing. - if (!pagesDict.isDict()) { - error(-1, "Top-level pages object is wrong type (%s)", - pagesDict.getTypeName()); - goto err2; - } - pagesDict.dictLookup("Count", &obj); - // some PDF files actually use real numbers here ("/Count 9.0") - if (!obj.isNum()) { - error(-1, "Page count in top-level pages object is wrong type (%s)", - obj.getTypeName()); - numPages = 0; - } else { - numPages = (int)obj.getNum(); - } - obj.free(); - pagesDict.free(); - // read base URI if (catDict.dictLookup("URI", &obj)->isDict()) { if (obj.dictLookup("Base", &obj2)->isString()) { @@ -136,8 +116,6 @@ Catalog::Catalog(XRef *xrefA) { catDict.free(); return; - err2: - pagesDict.free(); err1: catDict.free(); ok = gFalse; @@ -270,7 +248,7 @@ GBool Catalog::cachePageTree(int page) return gFalse; } - pagesSize = numPages; + pagesSize = getNumPages(); pages = (Page **)gmallocn(pagesSize, sizeof(Page *)); pageRefs = (Ref *)gmallocn(pagesSize, sizeof(Ref)); for (int i = 0; i < pagesSize; ++i) { @@ -395,7 +373,7 @@ GBool Catalog::cachePageTree(int page) int Catalog::findPage(int num, int gen) { int i; - for (i = 0; i < numPages; ++i) { + for (i = 0; i < getNumPages(); ++i) { Ref *ref = getPageRef(i+1); if (ref->num == num && ref->gen == gen) return i + 1; @@ -719,7 +697,7 @@ GBool Catalog::labelToIndex(GooString *label, int *index) return gFalse; } - if (*index < 0 || *index >= numPages) + if (*index < 0 || *index >= getNumPages()) return gFalse; return gTrue; @@ -729,7 +707,7 @@ GBool Catalog::indexToLabel(int index, GooString *label) { char buffer[32]; - if (index < 0 || index >= numPages) + if (index < 0 || index >= getNumPages()) return gFalse; PageLabelInfo *pli = getPageLabelInfo(); @@ -845,6 +823,42 @@ EmbFile::EmbFile(Object *efDict, GooString *description) m_mimetype = new GooString(); } +int Catalog::getNumPages() +{ + if (numPages == -1) + { + Object catDict, pagesDict, obj; + + xref->getCatalog(&catDict); + catDict.dictLookup("Pages", &pagesDict); + catDict.free(); + + // This should really be isDict("Pages"), but I've seen at least one + // PDF file where the /Type entry is missing. + if (!pagesDict.isDict()) { + error(-1, "Top-level pages object is wrong type (%s)", + pagesDict.getTypeName()); + pagesDict.free(); + return 0; + } + + pagesDict.dictLookup("Count", &obj); + // some PDF files actually use real numbers here ("/Count 9.0") + if (!obj.isNum()) { + error(-1, "Page count in top-level pages object is wrong type (%s)", + obj.getTypeName()); + numPages = 0; + } else { + numPages = (int)obj.getNum(); + } + + obj.free(); + pagesDict.free(); + } + + return numPages; +} + PageLabelInfo *Catalog::getPageLabelInfo() { if (!pageLabelInfo) { diff --git a/poppler/Catalog.h b/poppler/Catalog.h index 5a25109..8bca80b 100644 --- a/poppler/Catalog.h +++ b/poppler/Catalog.h @@ -148,7 +148,7 @@ public: GBool isOk() { return ok; } // Get number of pages. - int getNumPages() { return numPages; } + int getNumPages(); // Get a page. Page *getPage(int i); -- 1.6.4.2 From 69afaeeb656139f8038aa2bfdc3cf3ea8dda29a9 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Thu, 25 Mar 2010 18:53:54 +0100 Subject: [PATCH 13/15] Get number of pages from linearization table --- poppler/PDFDoc.cc | 9 +++++++++ poppler/PDFDoc.h | 2 +- 2 files changed, 10 insertions(+), 1 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index 7de1b99..a683022 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -1035,6 +1035,15 @@ Guint PDFDoc::getMainXRefEntriesOffset() return mainXRefEntriesOffset; } +int PDFDoc::getNumPages() +{ + if (isLinearized()) { + return getLinearization()->getNumPages(); + } else { + return catalog->getNumPages(); + } +} + Page *PDFDoc::getPage(int page) { if ((page < 1) || page > getNumPages()) return NULL; diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 8de139f..9069698 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -118,7 +118,7 @@ public: { return getPage(page) ? getPage(page)->getRotate() : 0 ; } // Get number of pages. - int getNumPages() { return catalog->getNumPages(); } + int getNumPages(); // Return the contents of the metadata stream, or NULL if there is // no metadata. -- 1.6.4.2 From 4685fdcdd2546967ea3d1958e4267065a45bd8ac Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Wed, 24 Mar 2010 22:03:27 +0100 Subject: [PATCH 14/15] Add hint tables support --- CMakeLists.txt | 2 + poppler/Hints.cc | 406 +++++++++++++++++++++++++++++++++++++++++++++++++++ poppler/Hints.h | 92 ++++++++++++ poppler/Makefile.am | 2 + poppler/PDFDoc.cc | 14 ++ poppler/PDFDoc.h | 5 + 6 files changed, 521 insertions(+), 0 deletions(-) create mode 100644 poppler/Hints.cc create mode 100644 poppler/Hints.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 8f5fba9..6cb95dd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,6 +245,7 @@ set(poppler_SRCS poppler/GfxFont.cc poppler/GfxState.cc poppler/GlobalParams.cc + poppler/Hints.cc poppler/JArithmeticDecoder.cc poppler/JBIG2Stream.cc poppler/Lexer.cc @@ -392,6 +393,7 @@ if(ENABLE_XPDF_HEADERS) poppler/GfxState.h poppler/GfxState_helpers.h poppler/GlobalParams.h + poppler/Hints.h poppler/JArithmeticDecoder.h poppler/JBIG2Stream.h poppler/Lexer.h diff --git a/poppler/Hints.cc b/poppler/Hints.cc new file mode 100644 index 0000000..3d47aaa --- /dev/null +++ b/poppler/Hints.cc @@ -0,0 +1,406 @@ +//======================================================================== +// +// Hints.cc +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2010 Hib Eris +// +//======================================================================== + +#include + +#include "Hints.h" + +#include "Linearization.h" +#include "Object.h" +#include "Stream.h" +#include "XRef.h" +#include "Parser.h" +#include "Lexer.h" + +#include + +//------------------------------------------------------------------------ +// Hints +//------------------------------------------------------------------------ + +Hints::Hints(BaseStream *str, Linearization *linearization) +{ + mainXRefEntriesOffset = linearization->getMainXRefEntriesOffset(); + nPages = linearization->getNumPages(); + pageFirst = linearization->getPageFirst(); + pageEndFirst = linearization->getEndFirst(); + + if (nPages >= INT_MAX / (int)sizeof(Guint)) { + error(-1, "Invalid number of pages (%d) for hints table", nPages); + nPages = 0; + } + nObjects = (Guint *) gmallocn(nPages, sizeof(Guint)); + xRefOffset = (Guint *) gmallocn(nPages, sizeof(Guint)); + pageLength = (Guint *) gmallocn(nPages, sizeof(Guint)); + pageOffset = (Guint *) gmallocn(nPages, sizeof(Guint)); + numSharedObject = (Guint *) gmallocn(nPages, sizeof(Guint)); + sharedObjectId = (Guint **) gmallocn(nPages, sizeof(Guint)); + if (!nObjects || !xRefOffset || !pageLength || !pageOffset || + !numSharedObject || !sharedObjectId) { + error(-1, "Failed to allocate memory for hints tabel"); + nPages = 0; + } + + memset(numSharedObject, 0, nPages); + + nSharedGroups = 0; + groupLength = NULL; + groupOffset = NULL; + groupHasSignature = NULL; + groupNumObjects = NULL; + groupXRefOffset = NULL; + + readTables(str, linearization); +} + +Hints::~Hints() +{ + gfree(nObjects); + gfree(xRefOffset); + gfree(pageLength); + gfree(pageOffset); + gfree(numSharedObject); + for (int i=0; i< nPages; i++) gfree(sharedObjectId[i]); + gfree(sharedObjectId); + + gfree(groupLength); + gfree(groupOffset); + gfree(groupHasSignature); + gfree(groupNumObjects); + gfree(groupXRefOffset); +} + +void Hints::readTables(BaseStream *str, Linearization *linearization) +{ + hintsOffset = linearization->getHintsOffset(); + hintsLength = linearization->getHintsLength(); + hintsOffset2 = linearization->getHintsOffset2(); + hintsLength2 = linearization->getHintsLength2(); + + Parser *parser; + Object obj; + + int bufLength = hintsLength + hintsLength2; + + char buf[bufLength]; + char *p = buf; + + obj.initNull(); + Stream *s = str->makeSubStream(hintsOffset, gFalse, hintsLength, &obj); + s->reset(); + for (Guint i=0; i < hintsLength; i++) { *p++ = s->getChar(); } + delete s; + + if (hintsOffset2 && hintsLength2) { + obj.initNull(); + s = str->makeSubStream(hintsOffset2, gFalse, hintsLength2, &obj); + s->reset(); + for (Guint i=0; i < hintsLength2; i++) { *p++ = s->getChar(); } + delete s; + } + + obj.initNull(); + MemStream *memStream = new MemStream (buf, 0, bufLength, &obj); + + obj.initNull(); + parser = new Parser(NULL, new Lexer(NULL, memStream), gTrue); + if (parser->getObj(&obj)->isInt() && + (obj.free(), parser->getObj(&obj)->isInt()) && + (obj.free(), parser->getObj(&obj)->isCmd("obj")) && + (obj.free(), parser->getObj(&obj)->isStream())){ + Stream *hintsStream = obj.getStream(); + Dict *hintsDict = obj.streamGetDict(); + + int sharedStreamOffset = 0; + if (hintsDict->lookupInt("S", NULL, &sharedStreamOffset) && + sharedStreamOffset > 0) { + + hintsStream->reset(); + readPageOffsetTable(hintsStream); + + hintsStream->reset(); + for (int i=0; igetChar(); + readSharedObjectsTable(hintsStream); + } else { + error(-1, "Invalid shared object hint table offset"); + } + } else { + error(-1, "Failed parsing hints table object"); + } + obj.free(); + + delete parser; +} + +void Hints::readPageOffsetTable(Stream *str) +{ + if (nPages < 1) { + error(-1, "Invalid number of pages reading page offset hints table"); + return; + } + + inputBits = 0; // reset on byte boundary. + + nObjectLeast = readBits(32, str); + + objectOffsetFirst = readBits(32, str); + if (objectOffsetFirst >= hintsOffset) objectOffsetFirst += hintsLength; + + nBitsDiffObjects = readBits(16, str); + + pageLengthLeast = readBits(32, str); + + nBitsDiffPageLength = readBits(16, str); + + OffsetStreamLeast = readBits(32, str); + + nBitsOffsetStream = readBits(16, str); + + lengthStreamLeast = readBits(32, str); + + nBitsLengthStream = readBits(16, str); + + nBitsNumShared = readBits(16, str); + + nBitsShared = readBits(16, str); + + nBitsNumerator = readBits(16, str); + + denominator = readBits(16, str); + + for (int i=0; i= INT_MAX / (int)sizeof(Guint)) { + error(-1, "Invalid number of shared objects"); + numSharedObject[i] = 0; + return; + } + sharedObjectId[i] = (Guint *) gmallocn(numSharedObject[i], sizeof(Guint)); + if (numSharedObject[i] && !sharedObjectId[i]) { + error(-1, "Failed to allocate memory for shared object IDs"); + numSharedObject[i] = 0; + return; + } + } + + inputBits = 0; // reset on byte boundary. Not in specs! + for (int i=1; i= INT_MAX / (int)sizeof(Guint)) { + error(-1, "Invalid number of shared object groups"); + nSharedGroups = 0; + return; + } + groupLength = (Guint *) gmallocn(nSharedGroups, sizeof(Guint)); + groupOffset = (Guint *) gmallocn(nSharedGroups, sizeof(Guint)); + groupHasSignature = (Guint *) gmallocn(nSharedGroups, sizeof(Guint)); + groupNumObjects = (Guint *) gmallocn(nSharedGroups, sizeof(Guint)); + groupXRefOffset = (Guint *) gmallocn(nSharedGroups, sizeof(Guint)); + if (!groupLength || !groupOffset || !groupHasSignature || + !groupNumObjects || !groupXRefOffset) { + error(-1, "Failed to allocate memory for shared object groups"); + nSharedGroups = 0; + return; + } + + if (nSharedGroupsFirst > nSharedGroups) { + error(-1, "Invalid number of first page shared object groups"); + nSharedGroupsFirst = nSharedGroups; + } + + inputBits = 0; // reset on byte boundary. Not in specs! + for (Guint i=0; i nPages)) return 0; + + if (page-1 > pageFirst) + return pageOffset[page-1]; + else if (page-1 < pageFirst) + return pageOffset[page]; + else + return pageOffset[0]; +} + +GooVector* Hints::getPageRanges(int page) +{ + if ((page < 1) || (page > nPages)) return NULL; + + int idx; + if (page-1 > pageFirst) + idx = page-1; + else if (page-1 < pageFirst) + idx = page; + else + idx = 0; + + ByteRange pageRange; + GooVector *v = new GooVector; + + pageRange.offset = pageOffset[idx]; + pageRange.length = pageLength[idx]; + v->push_back(pageRange); + + pageRange.offset = xRefOffset[idx]; + pageRange.length = 20*nObjects[idx]; + v->push_back(pageRange); + + for (Guint j=0; jpush_back(pageRange); + + pageRange.offset = groupXRefOffset[k]; + pageRange.length = 20*groupNumObjects[k]; + v->push_back(pageRange); + } + + return v; +} + +Guint Hints::readBit(Stream *str) +{ + Guint bit; + int c; + + if (inputBits == 0) { + if ((c = str->getChar()) == EOF) { + return (Guint) -1; + } + bitsBuffer = c; + inputBits = 8; + } + bit = (bitsBuffer >> (inputBits - 1)) & 1; + --inputBits; + return bit; +} + +Guint Hints::readBits(int n, Stream *str) +{ + Guint bit, bits; + + if (n < 0) return -1; + if (n == 0) return 0; + + if (n == 1) + return readBit(str); + + bit = (readBit(str) << (n-1)); + if (bit == (Guint) -1) + return -1; + + bits = readBits(n-1, str); + if (bits == (Guint) -1) + return -1; + + return bit | bits; +} + + diff --git a/poppler/Hints.h b/poppler/Hints.h new file mode 100644 index 0000000..35a2e55 --- /dev/null +++ b/poppler/Hints.h @@ -0,0 +1,92 @@ +//======================================================================== +// +// Hints.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright 2010 Hib Eris +// +//======================================================================== + +#ifndef HINTS_H +#define HINTS_H + +#include +#include "goo/gtypes.h" +#include "goo/GooVector.h" +//#include +#include "PDFDoc.h" + +class Stream; +class BaseStream; +class Linearization; +class XRef; + +//------------------------------------------------------------------------ +// Hints +//------------------------------------------------------------------------ + +class Hints { +public: + + Hints(BaseStream *str, Linearization *linearization); + ~Hints(); + + Guint getPageOffset(int page); + GooVector* getPageRanges(int page); + +private: + + void readTables(BaseStream *str, Linearization *linearization); + void readPageOffsetTable(Stream *str); + void readSharedObjectsTable(Stream *str); + + Guint readBit(Stream *str); + Guint readBits(int n, Stream *str); + + Guint hintsOffset; + Guint hintsLength; + Guint hintsOffset2; + Guint hintsLength2; + Guint mainXRefEntriesOffset; + + int nPages; + int pageFirst; + Guint pageOffsetFirst; + Guint pageEndFirst; + int objectNumberFirst; + + Guint nObjectLeast; + Guint objectOffsetFirst; + Guint nBitsDiffObjects; + Guint pageLengthLeast; + Guint nBitsDiffPageLength; + Guint OffsetStreamLeast; + Guint nBitsOffsetStream; + Guint lengthStreamLeast; + Guint nBitsLengthStream; + Guint nBitsNumShared; + Guint nBitsShared; + Guint nBitsNumerator; + Guint denominator; + + Guint *nObjects; + Guint *xRefOffset; + Guint *pageLength; + Guint *pageOffset; + Guint *numSharedObject; + Guint **sharedObjectId; + + Guint nSharedGroups; + Guint *groupLength; + Guint *groupOffset; + Guint *groupHasSignature; + Guint *groupNumObjects; + Guint *groupXRefOffset; + + int inputBits; + char bitsBuffer; + +}; + +#endif diff --git a/poppler/Makefile.am b/poppler/Makefile.am index 72bafd8..6260039 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -206,6 +206,7 @@ poppler_include_HEADERS = \ GfxState.h \ GfxState_helpers.h \ GlobalParams.h \ + Hints.h \ JArithmeticDecoder.h \ JBIG2Stream.h \ Lexer.h \ @@ -285,6 +286,7 @@ libpoppler_la_SOURCES = \ GfxFont.cc \ GfxState.cc \ GlobalParams.cc \ + Hints.cc \ JArithmeticDecoder.cc \ JBIG2Stream.cc \ Lexer.cc \ diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index a683022..fa0624e 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -68,6 +68,7 @@ #include "Outline.h" #endif #include "PDFDoc.h" +#include "Hints.h" //------------------------------------------------------------------------ @@ -95,6 +96,7 @@ void PDFDoc::init() xref = NULL; linearization = NULL; catalog = NULL; + hints = NULL; #ifndef DISABLE_OUTLINE outline = NULL; #endif @@ -269,6 +271,9 @@ PDFDoc::~PDFDoc() { if (xref) { delete xref; } + if (hints) { + delete hints; + } if (linearization) { delete linearization; } @@ -473,6 +478,15 @@ GBool PDFDoc::isLinearized() { return gFalse; } +Hints *PDFDoc::getHints() +{ + if (!hints && isLinearized()) { + hints = new Hints(str, getLinearization()); + } + + return hints; +} + int PDFDoc::saveAs(GooString *name, PDFWriteMode mode) { FILE *f; OutStream *outStr; diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index 9069698..b2f40c9 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -49,6 +49,7 @@ class LinkAction; class LinkDest; class Outline; class Linearization; +class Hints; enum PDFWriteMode { writeStandard, @@ -236,6 +237,9 @@ private: void saveIncrementalUpdate (OutStream* outStr); void saveCompleteRewrite (OutStream* outStr); + // Get hints. + Hints *getHints(); + PDFDoc(); void init(); GBool setup(GooString *ownerPassword, GooString *userPassword); @@ -258,6 +262,7 @@ private: Linearization *linearization; XRef *xref; Catalog *catalog; + Hints *hints; #ifndef DISABLE_OUTLINE Outline *outline; #endif -- 1.6.4.2 From 621a490e61e3a2698d3f9258a15d1a4ac2720137 Mon Sep 17 00:00:00 2001 From: Hib Eris Date: Tue, 20 Apr 2010 19:06:02 +0200 Subject: [PATCH 15/15] Use hint tables for PDFDoc::getPage() --- poppler/PDFDoc.cc | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++- poppler/PDFDoc.h | 4 +++ 2 files changed, 79 insertions(+), 1 deletions(-) diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc index fa0624e..9677563 100644 --- a/poppler/PDFDoc.cc +++ b/poppler/PDFDoc.cc @@ -101,6 +101,7 @@ void PDFDoc::init() outline = NULL; #endif startXRefPos = ~(Guint)0; + pageCache = NULL; } PDFDoc::PDFDoc() @@ -260,6 +261,14 @@ GBool PDFDoc::setup(GooString *ownerPassword, GooString *userPassword) { } PDFDoc::~PDFDoc() { + if (pageCache) { + for (int i = 0; i < getNumPages(); i++) { + if (pageCache[i]) { + delete pageCache[i]; + } + } + gfree(pageCache); + } #ifndef DISABLE_OUTLINE if (outline) { delete outline; @@ -1058,11 +1067,76 @@ int PDFDoc::getNumPages() } } +Guint PDFDoc::getPageOffset(int page) +{ + if (isLinearized() && (page-1 == getLinearization()->getPageFirst())) { + return xref->getEntry(linearization->getObjectNumberFirst())->offset; + } + + Guint offset; + if (getHints() && (offset = getHints()->getPageOffset(page))) { + return offset; + } else { + error(-1, "Failed getting page offset from hint table"); + return 0; + } +} + +Page *PDFDoc::parsePage(Guint offset, int page) +{ + Page *p = NULL; + Object obj; + + obj.initNull(); + Stream *stream = str->makeSubStream(offset, gFalse, 0, &obj); + Parser parser = Parser(xref, new Lexer(xref, stream), gTrue); + + Object obj1, obj2, obj3, obj4; + if (parser.getObj(&obj1)->isInt() && + parser.getObj(&obj2)->isInt() && + parser.getObj(&obj3)->isCmd("obj") && + parser.getObj(&obj4)->isDict("Page")) { + Ref pageRef; + Dict *pageDict; + pageRef.num = obj1.getInt(); + pageRef.gen = obj2.getInt(); + pageDict = obj4.getDict(); + p = new Page(xref, page, pageDict, pageRef, + new PageAttrs(NULL, pageDict), + catalog->getForm()); + if (!p->isOk()) { + delete p; + p = NULL; + } + } + obj4.free(); + obj3.free(); + obj2.free(); + obj1.free(); + + return p; +} + Page *PDFDoc::getPage(int page) { if ((page < 1) || page > getNumPages()) return NULL; - { + if (isLinearized()) { + if (!pageCache) { + pageCache = (Page **) gmallocn(getNumPages(), sizeof(Page *)); + for (int i = 0; i < getNumPages(); i++) { + pageCache[i] = NULL; + } + } + if (!pageCache[page-1]) { + pageCache[page-1] = parsePage(getPageOffset(page), page); + if (!pageCache[page-1]) { + error(-1, "Failed parsing page %d at offset %d", + page, getPageOffset(page)); + } + } + return pageCache[page-1]; + } else { return catalog->getPage(page); } } diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h index b2f40c9..99c005e 100644 --- a/poppler/PDFDoc.h +++ b/poppler/PDFDoc.h @@ -237,6 +237,9 @@ private: void saveIncrementalUpdate (OutStream* outStr); void saveCompleteRewrite (OutStream* outStr); + Guint getPageOffset(int page); + Page *parsePage(Guint offset, int page); + // Get hints. Hints *getHints(); @@ -266,6 +269,7 @@ private: #ifndef DISABLE_OUTLINE Outline *outline; #endif + Page **pageCache; GBool ok; int errCode; -- 1.6.4.2 From aacid at kde.org Sat Jun 12 05:45:12 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sat, 12 Jun 2010 13:45:12 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100612043514.GA9180@daedalus.localdomain> References: <20100612043514.GA9180@daedalus.localdomain> Message-ID: <201006121345.12974.aacid@kde.org> A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > Hi Guys, > > I wanted to send in these patches, they allow handling of reset-form and > print actions respectably. > > Please check them out, and if you have any questions please don't hesitate > to ask. Do you have a document that uses them? Also what is the point of + } else if (obj2.isName("ResetForm")) { + action = new LinkResetForm(obj2.getName()); don't we know the name will be "ResetForm" for sure? I think i'd prefer LinkFormActionPrivate constructor to need the ActionType too. And if (obj->dictLookup("AA", &tmp)->isDict()) seems like an unrelated fix, can you please explain it too? Albert > > Cheers, > GA From gamaral at kdab.com Sat Jun 12 19:40:44 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Sat, 12 Jun 2010 19:40:44 -0700 Subject: [poppler] Form-Reset and Print [patches] Message-ID: <20100613024041.GA2423@daedalus.localdomain> Albert Astals Cid wrote: > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: >> >> I wanted to send in these patches, they allow handling of reset-form and >> print actions respectably. >> >> Please check them out, and if you have any questions please don't hesitate >> to ask. > > Do you have a document that uses them? I do, but I dunno if I can share them ATM, looking into it. But I did make a test pdf that uses both features. :-) > Also what is the point of > > + } else if (obj2.isName("ResetForm")) { > + action = new LinkResetForm(obj2.getName()); As usual, you are right aacid :) I try a little to hard not to break the flow of other programs, I think I went to far lol (fixed) > And > if (obj->dictLookup("AA", &tmp)->isDict()) > seems like an unrelated fix, can you please explain it too? Mixed them up, that one should be in the print patch (moved). Sometimes the AA dict is used to hold a ref to the named object. I have seen it in two docs so far, it seems to happen when people set an action to happen on mouse down instead of mouse up. It should not break anything else (as far as I can see). Example in attached test.pdf. -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions -------------- next part -------------- diff --git a/qt4/src/poppler-form.cc b/qt4/src/poppler-form.cc index 6224b68..4ce4465 100644 --- a/qt4/src/poppler-form.cc +++ b/qt4/src/poppler-form.cc @@ -139,14 +139,24 @@ Link* FormField::activationAction() const Object tmp; Object *obj = m_formData->fm->getObj(); Link* action = 0; + ::LinkAction *act = 0; + if (obj->dictLookup("A", &tmp)->isDict()) { - ::LinkAction *act = ::LinkAction::parseAction(&tmp, m_formData->doc->doc->getCatalog()->getBaseURI()); - if (act) - { - action = PageData::convertLinkActionToLink(act, m_formData->doc, QRectF()); - delete act; - } + act = ::LinkAction::parseAction(&tmp, m_formData->doc->doc->getCatalog()->getBaseURI()); + } + else if (obj->dictLookup("AA", &tmp)->isDict()) + { + Object tmp1; + if (tmp.dictLookup("D", &tmp1)->isDict()) + act = ::LinkAction::parseAction(&tmp1, m_formData->doc->doc->getCatalog()->getBaseURI()); + tmp1.free(); + } + + if (act) + { + action = PageData::convertLinkActionToLink(act, m_formData->doc, QRectF()); + delete act; } tmp.free(); return action; diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..48b558d 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -357,7 +357,8 @@ class POPPLER_QT4_EXPORT LinkAction : public Link EndPresentation = 9, Find = 10, GoToPage = 11, - Close = 12 }; + Close = 12, + Print = 13 }; /** * The action of the current LinkAction diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..8aea6ce 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -129,6 +129,8 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo popplerLink = new LinkAction( linkArea, LinkAction::Find ); else if ( !strcmp( name, "FullScreen" ) ) popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); + else if ( !strcmp( name, "Print" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Print ); else if ( !strcmp( name, "Close" ) ) { // acroread closes the document always, doesnt care whether -------------- next part -------------- diff --git a/poppler/Link.cc b/poppler/Link.cc index 5d7b779..e3d6ce7 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { } else if (obj2.isName("SetOCGState")) { action = new LinkOCGState(obj); + // ResetForm action + } else if (obj2.isName("ResetForm")) { + action = new LinkResetForm(); + // unknown action } else if (obj2.isName()) { action = new LinkUnknown(obj2.getName()); @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { } //------------------------------------------------------------------------ +// LinkFormClear +//------------------------------------------------------------------------ + +LinkResetForm::LinkResetForm() { + action = new GooString("ResetForm"); +} + +LinkResetForm::~LinkResetForm() { + delete action; +} + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/poppler/Link.h b/poppler/Link.h index ea10375..15a594d 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -53,6 +53,7 @@ enum LinkActionKind { actionSound, // sound action actionJavaScript, // JavaScript action actionOCGState, // Set-OCG-State action + actionResetForm, // Reset form action actionUnknown // anything else }; @@ -429,6 +430,31 @@ private: }; //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +class LinkResetForm: public LinkAction { +public: + + // Build a LinkResetForm with the specified action type. + LinkResetForm(); + + // Destructor. + virtual ~LinkResetForm(); + + // Was the LinkResetForm create successfully? + virtual GBool isOk() { return action != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionResetForm; } + GooString *getAction() { return action; } + +private: + + GooString *action; // action subtype +}; + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc index de06242..17779b5 100644 --- a/qt4/src/poppler-link.cc +++ b/qt4/src/poppler-link.cc @@ -179,6 +179,19 @@ class LinkMoviePrivate : public LinkPrivate } #endif +class LinkFormActionPrivate : public LinkPrivate +{ + public: + LinkFormActionPrivate( const QRectF &area, LinkFormAction::ActionType actionType ); + + LinkFormAction::ActionType type; +}; + + LinkFormActionPrivate::LinkFormActionPrivate( const QRectF &area, LinkFormAction::ActionType actionType ) + : LinkPrivate( area ), type( actionType ) + { + } + static void cvtUserToDev(::Page *page, double xu, double yu, int *xd, int *yd) { double ctm[6]; @@ -581,4 +594,25 @@ class LinkMoviePrivate : public LinkPrivate } #endif + // LinkFormAction + LinkFormAction::LinkFormAction( const QRectF &linkArea, ActionType actionType ) + : Link( *new LinkFormActionPrivate( linkArea, actionType ) ) + { + } + + LinkFormAction::~LinkFormAction() + { + } + + LinkFormAction::ActionType LinkFormAction::actionType() const + { + Q_D( const LinkFormAction ); + return d->type; + } + + Link::LinkType LinkFormAction::linkType() const + { + return FormAction; + } + } diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..f037642 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -39,6 +39,7 @@ class LinkJavaScriptPrivate; class LinkMoviePrivate; class LinkDestinationData; class LinkDestinationPrivate; +class LinkFormActionPrivate; class SoundObject; /** @@ -182,7 +183,8 @@ class POPPLER_QT4_EXPORT Link Action, ///< A "standard" action to be executed in the viewer Sound, ///< A link representing a sound to be played Movie, ///< An action to be executed on a movie - JavaScript ///< A JavaScript code to be interpreted \since 0.10 + JavaScript, ///< A JavaScript code to be interpreted \since 0.10 + FormAction ///< A "form" action to be executed in the viewer }; /** @@ -484,6 +486,46 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link }; #endif +/** + * \brief "Form" action request. + * + * The LinkFormAction class represents a link that request a "form" action + * to be performed by the viewer on the displayed document. + */ +class POPPLER_QT4_EXPORT LinkFormAction : public Link +{ + public: + /** + * The possible types of actions + */ + enum ActionType { Submit = 1, + Reset = 2, + ImportData = 3 }; + + /** + * The action of the current LinkFormAction + */ + ActionType actionType() const; + + /** + * Create a new Action link, that executes a specified action + * on the document. + * + * \param linkArea the active area of the link + * \param actionType which action should be executed + */ + LinkFormAction( const QRectF &linkArea, ActionType actionType ); + /** + * Destructor. + */ + ~LinkFormAction(); + LinkType linkType() const; + + private: + Q_DECLARE_PRIVATE( LinkFormAction ) + Q_DISABLE_COPY( LinkFormAction ) +}; + } #endif diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..b0b2871 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -174,6 +174,10 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo copyString( m_uri, m->getTitle()->getCString() ); */ break; + case actionResetForm: + popplerLink = new LinkFormAction( linkArea, LinkFormAction::Reset ); + break; + case actionUnknown: break; } -------------- next part -------------- A non-text attachment was scrubbed... Name: test.pdf Type: application/pdf Size: 26457 bytes Desc: not available URL: From carlosgc at gnome.org Sun Jun 13 01:21:35 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Sun, 13 Jun 2010 10:21:35 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100613024041.GA2423@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> Message-ID: <1276417004-sup-3718@charmaleon> Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 2010: > Albert Astals Cid wrote: > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > >> > >> I wanted to send in these patches, they allow handling of reset-form and > >> print actions respectably. > >> > >> Please check them out, and if you have any questions please don't hesitate > >> to ask. > > > > Do you have a document that uses them? > > I do, but I dunno if I can share them ATM, looking into it. > But I did make a test pdf that uses both features. :-) > > > Also what is the point of > > > > + } else if (obj2.isName("ResetForm")) { > > + action = new LinkResetForm(obj2.getName()); > > As usual, you are right aacid :) I try a little to hard not to break the > flow of other programs, I think I went to far lol (fixed) > > > And > > if (obj->dictLookup("AA", &tmp)->isDict()) > > seems like an unrelated fix, can you please explain it too? > > Mixed them up, that one should be in the print patch (moved). Sometimes the > AA dict is used to hold a ref to the named object. I have seen it in two docs so > far, it seems to happen when people set an action to happen on mouse down > instead of mouse up. It should not break anything else (as far as I can see). > We should definitely add support for additional actions properly in poppler. > diff --git a/poppler/Link.cc b/poppler/Link.cc > index 5d7b779..e3d6ce7 100644 > --- a/poppler/Link.cc > +++ b/poppler/Link.cc > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > } else if (obj2.isName("SetOCGState")) { > action = new LinkOCGState(obj); > > + // ResetForm action > + } else if (obj2.isName("ResetForm")) { > + action = new LinkResetForm(); > + > // unknown action > } else if (obj2.isName()) { > action = new LinkUnknown(obj2.getName()); > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > } > > //------------------------------------------------------------------------ > +// LinkFormClear > +//------------------------------------------------------------------------ > + > +LinkResetForm::LinkResetForm() { > + action = new GooString("ResetForm"); this is redundant, you already know it's a LinkResetForm object. You should parse Fields and Flags here. Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aacid at kemper.freedesktop.org Sun Jun 13 07:32:32 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 07:32:32 -0700 (PDT) Subject: [poppler] glib/Makefile.am poppler/Makefile.am Message-ID: <20100613143232.4303910057@kemper.freedesktop.org> glib/Makefile.am | 7 +++---- poppler/Makefile.am | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) New commits: commit a52670a46c0561025d8b86cd2865603f0720c695 Author: Albert Astals Cid Date: Sun Jun 13 15:31:15 2010 +0100 do not distribute these two files they are generated on configure/cmake time and depend on the machine diff --git a/glib/Makefile.am b/glib/Makefile.am index f69c67a..2b0fadd 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -47,8 +47,8 @@ poppler_glib_includedir = $(includedir)/poppler/glib poppler_glib_include_HEADERS = \ $(poppler_glib_public_headers) \ - poppler-enums.h \ - poppler-features.h + poppler-enums.h +nodist_poppler_glib_include_HEADERS = poppler-features.h lib_LTLIBRARIES = libpoppler-glib.la libpoppler_glib_la_SOURCES = \ @@ -92,8 +92,7 @@ endif BUILT_SOURCES = \ poppler-enums.c \ - poppler-enums.h \ - poppler-features.h + poppler-enums.h CLEANFILES = $(BUILT_SOURCES) $(stamp_files) DISTCLEANFILES = $(BUILT_SOURCES) $(stamp_files) diff --git a/poppler/Makefile.am b/poppler/Makefile.am index 3affce8..5f8f7fb 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -249,8 +249,8 @@ poppler_include_HEADERS = \ SecurityHandler.h \ UTF8.h \ XpdfPluginAPI.h \ - Sound.h \ - poppler-config.h + Sound.h +nodist_poppler_include_HEADERS = poppler-config.h endif From aacid at kemper.freedesktop.org Sun Jun 13 07:33:01 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 07:33:01 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - glib/Makefile.am poppler/Makefile.am Message-ID: <20100613143301.A435E10057@kemper.freedesktop.org> glib/Makefile.am | 7 +++---- poppler/Makefile.am | 4 ++-- 2 files changed, 5 insertions(+), 6 deletions(-) New commits: commit 75c2cba15327930ae35a2bb160bdd3dc672bb178 Author: Albert Astals Cid Date: Sun Jun 13 15:31:15 2010 +0100 do not distribute these two files they are generated on configure/cmake time and depend on the machine diff --git a/glib/Makefile.am b/glib/Makefile.am index f69c67a..2b0fadd 100644 --- a/glib/Makefile.am +++ b/glib/Makefile.am @@ -47,8 +47,8 @@ poppler_glib_includedir = $(includedir)/poppler/glib poppler_glib_include_HEADERS = \ $(poppler_glib_public_headers) \ - poppler-enums.h \ - poppler-features.h + poppler-enums.h +nodist_poppler_glib_include_HEADERS = poppler-features.h lib_LTLIBRARIES = libpoppler-glib.la libpoppler_glib_la_SOURCES = \ @@ -92,8 +92,7 @@ endif BUILT_SOURCES = \ poppler-enums.c \ - poppler-enums.h \ - poppler-features.h + poppler-enums.h CLEANFILES = $(BUILT_SOURCES) $(stamp_files) DISTCLEANFILES = $(BUILT_SOURCES) $(stamp_files) diff --git a/poppler/Makefile.am b/poppler/Makefile.am index 3affce8..5f8f7fb 100644 --- a/poppler/Makefile.am +++ b/poppler/Makefile.am @@ -249,8 +249,8 @@ poppler_include_HEADERS = \ SecurityHandler.h \ UTF8.h \ XpdfPluginAPI.h \ - Sound.h \ - poppler-config.h + Sound.h +nodist_poppler_include_HEADERS = poppler-config.h endif From gamaral at kdab.com Sun Jun 13 08:58:56 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Sun, 13 Jun 2010 08:58:56 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1276417004-sup-3718@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> Message-ID: <20100613155856.GA6584@daedalus.localdomain> On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 2010: > > Albert Astals Cid wrote: > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > >> > > >> I wanted to send in these patches, they allow handling of reset-form and > > >> print actions respectably. > > >> > > >> Please check them out, and if you have any questions please don't hesitate > > >> to ask. > > > > > > Do you have a document that uses them? > > > > I do, but I dunno if I can share them ATM, looking into it. > > But I did make a test pdf that uses both features. :-) > > > > > Also what is the point of > > > > > > + } else if (obj2.isName("ResetForm")) { > > > + action = new LinkResetForm(obj2.getName()); > > > > As usual, you are right aacid :) I try a little to hard not to break the > > flow of other programs, I think I went to far lol (fixed) > > > > > And > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > seems like an unrelated fix, can you please explain it too? > > > > Mixed them up, that one should be in the print patch (moved). Sometimes the > > AA dict is used to hold a ref to the named object. I have seen it in two docs so > > far, it seems to happen when people set an action to happen on mouse down > > instead of mouse up. It should not break anything else (as far as I can see). > > > > We should definitely add support for additional actions properly in > poppler. > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > index 5d7b779..e3d6ce7 100644 > > --- a/poppler/Link.cc > > +++ b/poppler/Link.cc > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > } else if (obj2.isName("SetOCGState")) { > > action = new LinkOCGState(obj); > > > > + // ResetForm action > > + } else if (obj2.isName("ResetForm")) { > > + action = new LinkResetForm(); > > + > > // unknown action > > } else if (obj2.isName()) { > > action = new LinkUnknown(obj2.getName()); > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > } > > > > //------------------------------------------------------------------------ > > +// LinkFormClear > > +//------------------------------------------------------------------------ > > + > > +LinkResetForm::LinkResetForm() { > > + action = new GooString("ResetForm"); > > this is redundant, you already know it's a LinkResetForm object. You > should parse Fields and Flags here. Yeah it's a partial patch, it allows the client to know it has to reset.. I guess I could make it reset the fields in the fieldlist here and just notify the client the form values have changed or something? what do you guys think? As far as it being redundant T_T yep totally. but I do see that the getAction() accessor returns said action GooString ptr, as I said before I don't want to rock the boat; I'm guessing that method is used some place else so I don't want to take it out willy nilly. But I do want to make it clear (if it's not totally obvious already) that I'm not completely familiar with the popplers code. ;-) Cheers, GA -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions From aacid at kde.org Sun Jun 13 14:28:25 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 22:28:25 +0100 Subject: [poppler] Caching more ObjectStream Message-ID: <201006132228.25905.aacid@kde.org> Hi, this patch makes opening of file in bug 26759 go down from around 15 secs to 1.5 secs by caching more ObjectStream objects. Obviously some more memory is used but i think a 10x speed is worth it. Any objection to commit it to both master and 0.14 branches? Albert -------------- next part -------------- A non-text attachment was scrubbed... Name: objstrcache.patch Type: text/x-patch Size: 2577 bytes Desc: not available URL: From aacid at kde.org Sun Jun 13 14:32:07 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 22:32:07 +0100 Subject: [poppler] Accessibility of PDF documents In-Reply-To: References: Message-ID: <201006132232.07637.aacid@kde.org> A Divendres, 11 de juny de 2010, leena chourey va escriure: > Dear all, > > This is in continuation to our last communication related with > *Accessibility of Pdf document.* As discussed last time, we have now > completed the first prototype version of the same and we are making it > available for your testing and valuable comments/feedback. As mentioned > last time, we convert the PDF file into HTML format and open the same > automatically in Firefox. > > Enclosed with this email is the ReadMe file which explains the steps to > download, install and run this enhancement. Please try out the same and > give us your valuable feedback. > > > We have tested it at our end by different teams and have found that it > works well in most cases. Some places where we feel work is required are > as follows: > > - Sometimes Orca in not able to read header and footer of page > - Some character combinations are displayed as garbage like 'ft', 'tt' > - Content in table format is spoken by orca but it does not say the row > and column reference. Means a user can not find out that orca is reading > table content. (as orca does table reading in openoffice writer) > > We are working on these. Waiting to hear more from all. Quick question, do you have any patches on top of the poppler you use? Albert > > > > > With regards > Leena C From aacid at kde.org Sun Jun 13 14:32:59 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 22:32:59 +0100 Subject: [poppler] For Accessibility of pdf document: changes required in pdftohtml complex output In-Reply-To: References: Message-ID: <201006132232.59308.aacid@kde.org> A Dimecres, 9 de juny de 2010, leena chourey va escriure: > Dear poppler developers, > > I am new to this list, and working on Gnome accessibility. To read pdf > document, visually impaired person uses screen reader, but very less > support is provided by the opensource communities. We are working in the > same line and trying to make pdf document accessible using screen reader > Orca. We have analysed various options in this reagard, that includes > exploration of evince document viewer, orca accessibility features for pdf > document and more. As a first step, we have decided to use pdftohtml > utility to provide pdf content in html format, so that orca can the pdf > content available in html format. > Observations while exploring poppler-0.12.4 (utils): > > - Poppler-utils has a pdftohtml facility to generate html file for pdf > document, Similarly with -c option it can generate the formatted html > file for corresponding pdf. -c generates file_ind.html, file_outline.html, > file.html and 1 .html & .png for each page of pdf. (please confirm) - > While working on this file.html in firefox, we have observed that this > links/contains only index file (file_ind.html) and file1.html (first page > html) file. To shift to another page, I have to click on that page from > index, which opens the corresponding page in new tab of firefox. So for > every page one new tab will open. (please confirm) > - I don't find way to return to previous page or jump to some particular > page. > > For a person with perfect vision, no issues in reading pdfcontent in > complex html format. But to ensure that the complex html format is as much > as similar to pdfdocument displayed using any document viewer and to make > html format more accessible and usable by a blind person, we found that > following issues need to be resolved. As mentioned above for > accessibility, now if a blind person reads file.html then following are > some issues : > > 1. Because file.html uses frameset/frame so orca is not able to shift > control from 1 frame to another. it shifted after reading full content > of one frame (with tab). Normal person can shift from frame to frame with > the help of mouse, but with tab it is not possible to skip no. of tabs. 2. > If a blind person want to read/shift to another page , it opens in new > tab, it will be confusing for her/him to handle no of tabs (1 for each > page). > 3. Some more issues are there related with content format can be > discussed in further communication > > To resolve first 2 issues, it is required to have changes in pdftohtml -c > utility, that will make html document more accessible and usable to a > visually impaired person. Hi, i wonder if you know the people working on https://bugs.freedesktop.org/show_bug.cgi?id=28276 it would make sense to join efforts since it seems you are trying to achieve the same. Albert > > With regards > Leena From aacid at kde.org Sun Jun 13 15:00:50 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 23:00:50 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100613024041.GA2423@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> Message-ID: <201006132300.50465.aacid@kde.org> A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > Albert Astals Cid wrote: > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > >> I wanted to send in these patches, they allow handling of reset-form and > >> print actions respectably. > >> > >> Please check them out, and if you have any questions please don't > >> hesitate to ask. > > > > Do you have a document that uses them? > > I do, but I dunno if I can share them ATM, looking into it. > But I did make a test pdf that uses both features. :-) > > > Also what is the point of > > > > + } else if (obj2.isName("ResetForm")) { > > + action = new LinkResetForm(obj2.getName()); > > As usual, you are right aacid :) I try a little to hard not to break the > flow of other programs, I think I went to far lol (fixed) Same question again, you still have + action = new GooString("ResetForm"); and + GooString *getAction() { return action; } but noone ever uses them, can we just remove them? Also i think you should add to the docu that Submit and ImportData ActionType are not supported > > > And > > if (obj->dictLookup("AA", &tmp)->isDict()) > > seems like an unrelated fix, can you please explain it too? > > Mixed them up, that one should be in the print patch (moved). Sometimes > the AA dict is used to hold a ref to the named object. I have seen it in > two docs so far, it seems to happen when people set an action to happen on > mouse down instead of mouse up. It should not break anything else (as far > as I can see). Well, i think that we should properly support that in a different function, not activationAction but "mouseDownAction" or something, i'd appreciate Pino's comments here since it seems that file is mostly his. > > Example in attached test.pdf. Thanks, Albert From aacid at kde.org Sun Jun 13 15:01:55 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 23:01:55 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1276417004-sup-3718@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> Message-ID: <201006132301.55708.aacid@kde.org> A Diumenge, 13 de juny de 2010, Carlos Garcia Campos va escriure: > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 2010: > > Albert Astals Cid wrote: > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > >> I wanted to send in these patches, they allow handling of reset-form > > >> and print actions respectably. > > >> > > >> Please check them out, and if you have any questions please don't > > >> hesitate to ask. > > > > > > Do you have a document that uses them? > > > > > I do, but I dunno if I can share them ATM, looking into it. > > But I did make a test pdf that uses both features. :-) > > > > > Also what is the point of > > > > > > + } else if (obj2.isName("ResetForm")) { > > > + action = new LinkResetForm(obj2.getName()); > > > > > As usual, you are right aacid :) I try a little to hard not to break > > the flow of other programs, I think I went to far lol (fixed) > > > > > And > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > seems like an unrelated fix, can you please explain it too? > > > > > Mixed them up, that one should be in the print patch (moved). Sometimes > > the AA dict is used to hold a ref to the named object. I have seen it > > in two docs so far, it seems to happen when people set an action to > > happen on mouse down instead of mouse up. It should not break anything > > else (as far as I can see). > > We should definitely add support for additional actions properly in > poppler. Well, the problem seems to be that the poppler-qt4 form handling is somewhat disconnected from poppler core form handling, anyone working on integration will get cookies/beer/orangejuice from me. Albert From aacid at kde.org Sun Jun 13 15:02:56 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 13 Jun 2010 23:02:56 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100613155856.GA6584@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> Message-ID: <201006132302.56527.aacid@kde.org> A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 2010: > > > Albert Astals Cid wrote: > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > >> I wanted to send in these patches, they allow handling of reset-form > > > >> and print actions respectably. > > > >> > > > >> Please check them out, and if you have any questions please don't > > > >> hesitate to ask. > > > > > > > > Do you have a document that uses them? > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > But I did make a test pdf that uses both features. :-) > > > > > > > Also what is the point of > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > And > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > have seen it in two docs so far, it seems to happen when people set > > > an action to happen on mouse down instead of mouse up. It should not > > > break anything else (as far as I can see). > > > > We should definitely add support for additional actions properly in > > poppler. > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > index 5d7b779..e3d6ce7 100644 > > > --- a/poppler/Link.cc > > > +++ b/poppler/Link.cc > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > GooString *baseURI) { > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > action = new LinkOCGState(obj); > > > > > > + // ResetForm action > > > + } else if (obj2.isName("ResetForm")) { > > > + action = new LinkResetForm(); > > > + > > > > > > // unknown action > > > } else if (obj2.isName()) { > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > } > > > > > > //-------------------------------------------------------------------- > > > ---- > > > > > > +// LinkFormClear > > > +//-------------------------------------------------------------------- > > > ---- + > > > +LinkResetForm::LinkResetForm() { > > > + action = new GooString("ResetForm"); > > > > this is redundant, you already know it's a LinkResetForm object. You > > should parse Fields and Flags here. > > Yeah it's a partial patch, it allows the client to know it has to reset.. > I guess I could make it reset the fields in the fieldlist here and just > notify the client the form values have changed or something? what do you > guys think? > > As far as it being redundant T_T yep totally. but I do see that > the getAction() accessor returns said action GooString ptr, as I said > before I don't want to rock the boat; I'm guessing that method is used > some place else so I don't want to take it out willy nilly. But I do want > to make it clear (if it's not totally obvious already) that I'm not > completely familiar with the popplers code. ;-) getAction() used somewhere? It's not virtual and you don't use it anywhere, so where is it going to be used? Albert > > Cheers, > GA From gamaral at kdab.com Sun Jun 13 20:37:16 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Sun, 13 Jun 2010 20:37:16 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <201006132302.56527.aacid@kde.org> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> Message-ID: <20100614033713.GA11727@daedalus.localdomain> On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > 2010: > > > > Albert Astals Cid wrote: > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > >> and print actions respectably. > > > > >> > > > > >> Please check them out, and if you have any questions please don't > > > > >> hesitate to ask. > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > Also what is the point of > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > And > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > have seen it in two docs so far, it seems to happen when people set > > > > an action to happen on mouse down instead of mouse up. It should not > > > > break anything else (as far as I can see). > > > > > > We should definitely add support for additional actions properly in > > > poppler. > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > index 5d7b779..e3d6ce7 100644 > > > > --- a/poppler/Link.cc > > > > +++ b/poppler/Link.cc > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > GooString *baseURI) { > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > + // ResetForm action > > > > + } else if (obj2.isName("ResetForm")) { > > > > + action = new LinkResetForm(); > > > > + > > > > > > > > // unknown action > > > > } else if (obj2.isName()) { > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > } > > > > > > > > //-------------------------------------------------------------------- > > > > ---- > > > > > > > > +// LinkFormClear > > > > +//-------------------------------------------------------------------- > > > > ---- + > > > > +LinkResetForm::LinkResetForm() { > > > > + action = new GooString("ResetForm"); > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > should parse Fields and Flags here. > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > I guess I could make it reset the fields in the fieldlist here and just > > notify the client the form values have changed or something? what do you > > guys think? > > > > As far as it being redundant T_T yep totally. but I do see that > > the getAction() accessor returns said action GooString ptr, as I said > > before I don't want to rock the boat; I'm guessing that method is used > > some place else so I don't want to take it out willy nilly. But I do want > > to make it clear (if it's not totally obvious already) that I'm not > > completely familiar with the popplers code. ;-) > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > where is it going to be used? > Mmm thought it was lol, dammit. Anyway, I added the missing features to the reset form patch today, check it out. Cheers, GA -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions -------------- next part -------------- diff --git a/poppler/Link.cc b/poppler/Link.cc index 5d7b779..abb17b6 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { } else if (obj2.isName("SetOCGState")) { action = new LinkOCGState(obj); + // ResetForm action + } else if (obj2.isName("ResetForm")) { + action = new LinkResetForm(obj); + // unknown action } else if (obj2.isName()) { action = new LinkUnknown(obj2.getName()); @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { } //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +LinkResetForm::LinkResetForm(Object *obj) { + Object obj1; + + fieldList = new GooList(); + flags = 0; + + if (obj->dictLookup("Fields", &obj1)->isArray()) { + for (int i = 0; i < obj1.arrayGetLength(); ++i) { + Object obj2; + obj1.arrayGetNF(i, &obj2); + fieldList->append(obj2.getString()->copy()); + obj2.free(); + } + } else { + error (-1, "Invalid ResetForm action"); + delete fieldList; + fieldList = NULL; + } + obj1.free(); + + if (obj->dictLookup("Flags", &obj1)->isNum()) { + flags = obj1.getInt(); + } + obj1.free(); +} + +LinkResetForm::~LinkResetForm() { + deleteGooList(fieldList, GooString); +} + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/poppler/Link.h b/poppler/Link.h index ea10375..3df61ae 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -53,6 +53,7 @@ enum LinkActionKind { actionSound, // sound action actionJavaScript, // JavaScript action actionOCGState, // Set-OCG-State action + actionResetForm, // Reset form action actionUnknown // anything else }; @@ -429,6 +430,34 @@ private: }; //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +class LinkResetForm: public LinkAction { +public: + + // Build a LinkResetForm with the specified action type. + LinkResetForm(Object *obj); + + // Destructor. + virtual ~LinkResetForm(); + + // Was the LinkResetForm create successfully? + virtual GBool isOk() { return fieldList != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionResetForm; } + + GooList *getFieldList() { return fieldList; } + int getFlags() { return flags; } + +private: + + GooList *fieldList; + int flags; +}; + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc index de06242..d460c94 100644 --- a/qt4/src/poppler-link.cc +++ b/qt4/src/poppler-link.cc @@ -179,6 +179,36 @@ class LinkMoviePrivate : public LinkPrivate } #endif +class LinkFormActionPrivate : public LinkPrivate +{ + public: + LinkFormActionPrivate( const QRectF &area, LinkFormAction::ActionType actionType ); + + LinkFormAction::ActionType type; +}; + + LinkFormActionPrivate::LinkFormActionPrivate( const QRectF &area, LinkFormAction::ActionType actionType ) + : LinkPrivate( area ), type( actionType ) + { + } + +class LinkResetFormActionPrivate : public LinkFormActionPrivate +{ + public: + LinkResetFormActionPrivate( const QRectF &area, + const LinkResetFormAction::FieldList &_fieldList, int _flags ); + + LinkResetFormAction::FieldList fieldList; + int flags; + +}; + + LinkResetFormActionPrivate::LinkResetFormActionPrivate( const QRectF &area, + const LinkResetFormAction::FieldList &_fieldList, int _flags ) + : LinkFormActionPrivate( area, LinkFormAction::Reset ), fieldList( _fieldList ), flags( _flags ) + { + } + static void cvtUserToDev(::Page *page, double xu, double yu, int *xd, int *yd) { double ctm[6]; @@ -581,4 +611,58 @@ class LinkMoviePrivate : public LinkPrivate } #endif + // LinkFormAction + LinkFormAction::LinkFormAction( const QRectF &linkArea, ActionType actionType ) + : Link( *new LinkFormActionPrivate( linkArea, actionType ) ) + { + } + + LinkFormAction::LinkFormAction( LinkFormActionPrivate &dd ) + : Link( dd ) + { + } + + LinkFormAction::~LinkFormAction() + { + } + + LinkFormAction::ActionType LinkFormAction::actionType() const + { + Q_D( const LinkFormAction ); + return d->type; + } + + Link::LinkType LinkFormAction::linkType() const + { + return FormAction; + } + + // LinkResetFormAction + LinkResetFormAction::LinkResetFormAction( const QRectF &linkArea, const FieldList &_fieldList, int _flags ) + : LinkFormAction( *new LinkResetFormActionPrivate( linkArea, _fieldList, _flags ) ) + { + } + + LinkResetFormAction::~LinkResetFormAction() + { + } + + LinkResetFormAction::FieldList LinkResetFormAction::fieldList() const + { + Q_D( const LinkResetFormAction ); + return d->fieldList; + } + + int LinkResetFormAction::flags() const + { + Q_D( const LinkResetFormAction ); + return d->flags; + } + + bool LinkResetFormAction::isExcludeFieldList() const + { + Q_D( const LinkResetFormAction ); + return (1 == (d->flags % 1)); + } + } diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..ba401b9 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -39,6 +39,8 @@ class LinkJavaScriptPrivate; class LinkMoviePrivate; class LinkDestinationData; class LinkDestinationPrivate; +class LinkFormActionPrivate; +class LinkResetFormActionPrivate; class SoundObject; /** @@ -182,7 +184,8 @@ class POPPLER_QT4_EXPORT Link Action, ///< A "standard" action to be executed in the viewer Sound, ///< A link representing a sound to be played Movie, ///< An action to be executed on a movie - JavaScript ///< A JavaScript code to be interpreted \since 0.10 + JavaScript, ///< A JavaScript code to be interpreted \since 0.10 + FormAction ///< A "form" action to be executed in the viewer }; /** @@ -484,6 +487,95 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link }; #endif +/** + * \brief "Form" action request. + * + * The LinkFormAction class represents a link that request a "form" action + * to be performed by the viewer on the displayed document. + */ +class POPPLER_QT4_EXPORT LinkFormAction : public Link +{ + public: + /** + * The possible types of actions + */ + enum ActionType { Submit = 1, + Reset = 2, + ImportData = 3 }; + + /** + * The action of the current LinkFormAction + */ + ActionType actionType() const; + + /** + * Create a new Action link, that executes a specified action + * on the document. + * + * \param linkArea the active area of the link + * \param actionType which action should be executed + */ + LinkFormAction( const QRectF &linkArea, ActionType actionType ); + /** + * Destructor. + */ + ~LinkFormAction(); + LinkType linkType() const; + + protected: + LinkFormAction( LinkFormActionPrivate &dd ); + + private: + Q_DECLARE_PRIVATE( LinkFormAction ) + Q_DISABLE_COPY( LinkFormAction ) +}; + +/** + * \brief "Form" action reset request. + * + * The LinkResetFormAction class represents a link that request a "ResetForm" action + * to be performed by the viewer on the displayed document. + */ +class POPPLER_QT4_EXPORT LinkResetFormAction : public LinkFormAction +{ + public: + typedef QList FieldList; + + /** + * Create a new LinkResetFormAction link, that + * resets form fields on document. + * + * \param linkArea the active area of the link + * \param fieldList list of field names + * \param flags action flags + */ + LinkResetFormAction( const QRectF &linkArea, const FieldList &_fieldList, int _flags ); + + /** + * Destructor. + */ + ~LinkResetFormAction(); + + /** + * The list of fields to either reset or ignore. + */ + FieldList fieldList() const; + + /** + * Return raw flags. + */ + int flags() const; + + /** + * Whether the field list should be excluded from the reset. + */ + bool isExcludeFieldList() const; + + private: + Q_DECLARE_PRIVATE( LinkResetFormAction ) + Q_DISABLE_COPY( LinkResetFormAction ) +}; + } #endif diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..ca9de3b 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -174,6 +174,23 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo copyString( m_uri, m->getTitle()->getCString() ); */ break; + case actionResetForm: + { + LinkResetFormAction::FieldList fieldList; + LinkResetForm * g = (LinkResetForm *) a; + GooList *gfieldList = g->getFieldList(); + + /* Convert GooString field list to FieldList */ + const int c = gfieldList->getLength(); + for ( int i = 0; i < c; ++i ) { + GooString *str = (GooString *) gfieldList->get( i ); + fieldList.append( str->getCString() ); + } + + popplerLink = new LinkResetFormAction( linkArea, fieldList, g->getFlags() ); + } + break; + case actionUnknown: break; } From leenagour at gmail.com Mon Jun 14 00:14:01 2010 From: leenagour at gmail.com (leena chourey) Date: Mon, 14 Jun 2010 12:44:01 +0530 Subject: [poppler] Accessibility of PDF documents In-Reply-To: <201006132232.07637.aacid@kde.org> References: <201006132232.07637.aacid@kde.org> Message-ID: Dear Albert, Thanks for responding. The poppler patch related with our changes will be submitted soon to poppler developers for feedback. with regards Leena On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid wrote: > A Divendres, 11 de juny de 2010, leena chourey va escriure: > > Dear all, > > > > This is in continuation to our last communication related with > > *Accessibility of Pdf document.* As discussed last time, we have now > > completed the first prototype version of the same and we are making it > > available for your testing and valuable comments/feedback. As mentioned > > last time, we convert the PDF file into HTML format and open the same > > automatically in Firefox. > > > > Enclosed with this email is the ReadMe file which explains the steps to > > download, install and run this enhancement. Please try out the same and > > give us your valuable feedback. > > > > > > We have tested it at our end by different teams and have found that it > > works well in most cases. Some places where we feel work is required are > > as follows: > > > > - Sometimes Orca in not able to read header and footer of page > > - Some character combinations are displayed as garbage like 'ft', 'tt' > > - Content in table format is spoken by orca but it does not say the > row > > and column reference. Means a user can not find out that orca is > reading > > table content. (as orca does table reading in openoffice writer) > > > > We are working on these. Waiting to hear more from all. > > Quick question, do you have any patches on top of the poppler you use? > > Albert > > > > > > > > > > > With regards > > Leena C > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > -- Leena C -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosgc at gnome.org Mon Jun 14 00:34:27 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 09:34:27 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100614033713.GA11727@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> Message-ID: <1276500470-sup-4055@charmaleon> Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > 2010: > > > > > Albert Astals Cid wrote: > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > >> and print actions respectably. > > > > > >> > > > > > >> Please check them out, and if you have any questions please don't > > > > > >> hesitate to ask. > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > And > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > break anything else (as far as I can see). > > > > > > > > We should definitely add support for additional actions properly in > > > > poppler. > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > index 5d7b779..e3d6ce7 100644 > > > > > --- a/poppler/Link.cc > > > > > +++ b/poppler/Link.cc > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > GooString *baseURI) { > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > + // ResetForm action > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > + action = new LinkResetForm(); > > > > > + > > > > > > > > > > // unknown action > > > > > } else if (obj2.isName()) { > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > } > > > > > > > > > > //-------------------------------------------------------------------- > > > > > ---- > > > > > > > > > > +// LinkFormClear > > > > > +//-------------------------------------------------------------------- > > > > > ---- + > > > > > +LinkResetForm::LinkResetForm() { > > > > > + action = new GooString("ResetForm"); > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > should parse Fields and Flags here. > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > I guess I could make it reset the fields in the fieldlist here and just > > > notify the client the form values have changed or something? what do you > > > guys think? > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > the getAction() accessor returns said action GooString ptr, as I said > > > before I don't want to rock the boat; I'm guessing that method is used > > > some place else so I don't want to take it out willy nilly. But I do want > > > to make it clear (if it's not totally obvious already) that I'm not > > > completely familiar with the popplers code. ;-) > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > where is it going to be used? > > > > Mmm thought it was lol, dammit. > Anyway, I added the missing features to the reset form patch today, check it out. > > Cheers, > GA > > diff --git a/poppler/Link.cc b/poppler/Link.cc > index 5d7b779..abb17b6 100644 > --- a/poppler/Link.cc > +++ b/poppler/Link.cc > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > } else if (obj2.isName("SetOCGState")) { > action = new LinkOCGState(obj); > > + // ResetForm action > + } else if (obj2.isName("ResetForm")) { > + action = new LinkResetForm(obj); > + > // unknown action > } else if (obj2.isName()) { > action = new LinkUnknown(obj2.getName()); > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > } > > //------------------------------------------------------------------------ > +// LinkResetForm > +//------------------------------------------------------------------------ > + > +LinkResetForm::LinkResetForm(Object *obj) { > + Object obj1; > + > + fieldList = new GooList(); > + flags = 0; > + > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > + Object obj2; > + obj1.arrayGetNF(i, &obj2); > + fieldList->append(obj2.getString()->copy()); > + obj2.free(); > + } Fields items can be either strings or indirect references depending on Flags, and both kinds can be mixed. This will fail if obj2 is not a string. Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From gamaral at kdab.com Mon Jun 14 00:45:07 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Mon, 14 Jun 2010 00:45:07 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1276500470-sup-4055@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <1276500470-sup-4055@charmaleon> Message-ID: <20100614074507.GA9491@daedalus.localdomain> On Mon, Jun 14, 2010 at 09:34:27AM +0200, Carlos Garcia Campos wrote: > Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > 2010: > > > > > > Albert Astals Cid wrote: > > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > > >> and print actions respectably. > > > > > > >> > > > > > > >> Please check them out, and if you have any questions please don't > > > > > > >> hesitate to ask. > > > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > > > And > > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > > break anything else (as far as I can see). > > > > > > > > > > We should definitely add support for additional actions properly in > > > > > poppler. > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > index 5d7b779..e3d6ce7 100644 > > > > > > --- a/poppler/Link.cc > > > > > > +++ b/poppler/Link.cc > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > > GooString *baseURI) { > > > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > + // ResetForm action > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > + action = new LinkResetForm(); > > > > > > + > > > > > > > > > > > > // unknown action > > > > > > } else if (obj2.isName()) { > > > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > > > } > > > > > > > > > > > > //-------------------------------------------------------------------- > > > > > > ---- > > > > > > > > > > > > +// LinkFormClear > > > > > > +//-------------------------------------------------------------------- > > > > > > ---- + > > > > > > +LinkResetForm::LinkResetForm() { > > > > > > + action = new GooString("ResetForm"); > > > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > > should parse Fields and Flags here. > > > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > > I guess I could make it reset the fields in the fieldlist here and just > > > > notify the client the form values have changed or something? what do you > > > > guys think? > > > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > > the getAction() accessor returns said action GooString ptr, as I said > > > > before I don't want to rock the boat; I'm guessing that method is used > > > > some place else so I don't want to take it out willy nilly. But I do want > > > > to make it clear (if it's not totally obvious already) that I'm not > > > > completely familiar with the popplers code. ;-) > > > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > > where is it going to be used? > > > > > > > Mmm thought it was lol, dammit. > > Anyway, I added the missing features to the reset form patch today, check it out. > > > > Cheers, > > GA > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > index 5d7b779..abb17b6 100644 > > --- a/poppler/Link.cc > > +++ b/poppler/Link.cc > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > } else if (obj2.isName("SetOCGState")) { > > action = new LinkOCGState(obj); > > > > + // ResetForm action > > + } else if (obj2.isName("ResetForm")) { > > + action = new LinkResetForm(obj); > > + > > // unknown action > > } else if (obj2.isName()) { > > action = new LinkUnknown(obj2.getName()); > > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > > } > > > > //------------------------------------------------------------------------ > > +// LinkResetForm > > +//------------------------------------------------------------------------ > > + > > +LinkResetForm::LinkResetForm(Object *obj) { > > + Object obj1; > > + > > + fieldList = new GooList(); > > + flags = 0; > > + > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > + Object obj2; > > + obj1.arrayGetNF(i, &obj2); > > + fieldList->append(obj2.getString()->copy()); > > + obj2.free(); > > + } > > Fields items can be either strings or indirect references depending on > Flags, and both kinds can be mixed. This will fail if obj2 is not a > string. Have a copy of the spec your using? or more info on the flags? the PDF spec I got from adobe I have only mentions bit 1 for (include/exclude). :S -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions From carlosgc at gnome.org Mon Jun 14 00:46:48 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 09:46:48 +0200 Subject: [poppler] Caching more ObjectStream In-Reply-To: <201006132228.25905.aacid@kde.org> References: <201006132228.25905.aacid@kde.org> Message-ID: <1276501502-sup-970@charmaleon> Excerpts from Albert Astals Cid's message of dom jun 13 23:28:25 +0200 2010: > Hi, this patch makes opening of file in bug 26759 go down from around 15 secs > to 1.5 secs by caching more ObjectStream objects. Obviously some more memory > is used but i think a 10x speed is worth it. Absolutely > Any objection to commit it to both master and 0.14 branches? No > Albert -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From carlosgc at gnome.org Mon Jun 14 00:48:08 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 09:48:08 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100614074507.GA9491@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <1276500470-sup-4055@charmaleon> <20100614074507.GA9491@daedalus.localdomain> Message-ID: <1276501671-sup-8223@charmaleon> Excerpts from Guillermo Amaral's message of lun jun 14 09:45:07 +0200 2010: > On Mon, Jun 14, 2010 at 09:34:27AM +0200, Carlos Garcia Campos wrote: > > Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > > > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > > 2010: > > > > > > > Albert Astals Cid wrote: > > > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > > > >> and print actions respectably. > > > > > > > >> > > > > > > > >> Please check them out, and if you have any questions please don't > > > > > > > >> hesitate to ask. > > > > > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > > > > > And > > > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > > > break anything else (as far as I can see). > > > > > > > > > > > > We should definitely add support for additional actions properly in > > > > > > poppler. > > > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > > index 5d7b779..e3d6ce7 100644 > > > > > > > --- a/poppler/Link.cc > > > > > > > +++ b/poppler/Link.cc > > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > > > GooString *baseURI) { > > > > > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > > > + // ResetForm action > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > + action = new LinkResetForm(); > > > > > > > + > > > > > > > > > > > > > > // unknown action > > > > > > > } else if (obj2.isName()) { > > > > > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > > > > > } > > > > > > > > > > > > > > //-------------------------------------------------------------------- > > > > > > > ---- > > > > > > > > > > > > > > +// LinkFormClear > > > > > > > +//-------------------------------------------------------------------- > > > > > > > ---- + > > > > > > > +LinkResetForm::LinkResetForm() { > > > > > > > + action = new GooString("ResetForm"); > > > > > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > > > should parse Fields and Flags here. > > > > > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > > > I guess I could make it reset the fields in the fieldlist here and just > > > > > notify the client the form values have changed or something? what do you > > > > > guys think? > > > > > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > > > the getAction() accessor returns said action GooString ptr, as I said > > > > > before I don't want to rock the boat; I'm guessing that method is used > > > > > some place else so I don't want to take it out willy nilly. But I do want > > > > > to make it clear (if it's not totally obvious already) that I'm not > > > > > completely familiar with the popplers code. ;-) > > > > > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > > > where is it going to be used? > > > > > > > > > > Mmm thought it was lol, dammit. > > > Anyway, I added the missing features to the reset form patch today, check it out. > > > > > > Cheers, > > > GA > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > index 5d7b779..abb17b6 100644 > > > --- a/poppler/Link.cc > > > +++ b/poppler/Link.cc > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > > } else if (obj2.isName("SetOCGState")) { > > > action = new LinkOCGState(obj); > > > > > > + // ResetForm action > > > + } else if (obj2.isName("ResetForm")) { > > > + action = new LinkResetForm(obj); > > > + > > > // unknown action > > > } else if (obj2.isName()) { > > > action = new LinkUnknown(obj2.getName()); > > > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > > > } > > > > > > //------------------------------------------------------------------------ > > > +// LinkResetForm > > > +//------------------------------------------------------------------------ > > > + > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > + Object obj1; > > > + > > > + fieldList = new GooList(); > > > + flags = 0; > > > + > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > + Object obj2; > > > + obj1.arrayGetNF(i, &obj2); > > > + fieldList->append(obj2.getString()->copy()); > > > + obj2.free(); > > > + } > > > > Fields items can be either strings or indirect references depending on > > Flags, and both kinds can be mixed. This will fail if obj2 is not a > > string. > > Have a copy of the spec your using? or more info on the flags? the PDF > spec I got from adobe I have only mentions bit 1 for (include/exclude). :S > http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From gamaral at kdab.com Mon Jun 14 01:02:37 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Mon, 14 Jun 2010 01:02:37 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1276501671-sup-8223@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <1276500470-sup-4055@charmaleon> <20100614074507.GA9491@daedalus.localdomain> <1276501671-sup-8223@charmaleon> Message-ID: <20100614080236.GA10113@daedalus.localdomain> On Mon, Jun 14, 2010 at 09:48:08AM +0200, Carlos Garcia Campos wrote: > Excerpts from Guillermo Amaral's message of lun jun 14 09:45:07 +0200 2010: > > On Mon, Jun 14, 2010 at 09:34:27AM +0200, Carlos Garcia Campos wrote: > > > Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > > > > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > > > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > > > 2010: > > > > > > > > Albert Astals Cid wrote: > > > > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > > > > >> and print actions respectably. > > > > > > > > >> > > > > > > > > >> Please check them out, and if you have any questions please don't > > > > > > > > >> hesitate to ask. > > > > > > > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > > > > > > > And > > > > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > > > > break anything else (as far as I can see). > > > > > > > > > > > > > > We should definitely add support for additional actions properly in > > > > > > > poppler. > > > > > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > > > index 5d7b779..e3d6ce7 100644 > > > > > > > > --- a/poppler/Link.cc > > > > > > > > +++ b/poppler/Link.cc > > > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > > > > GooString *baseURI) { > > > > > > > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > > > > > + // ResetForm action > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > + action = new LinkResetForm(); > > > > > > > > + > > > > > > > > > > > > > > > > // unknown action > > > > > > > > } else if (obj2.isName()) { > > > > > > > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > //-------------------------------------------------------------------- > > > > > > > > ---- > > > > > > > > > > > > > > > > +// LinkFormClear > > > > > > > > +//-------------------------------------------------------------------- > > > > > > > > ---- + > > > > > > > > +LinkResetForm::LinkResetForm() { > > > > > > > > + action = new GooString("ResetForm"); > > > > > > > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > > > > should parse Fields and Flags here. > > > > > > > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > > > > I guess I could make it reset the fields in the fieldlist here and just > > > > > > notify the client the form values have changed or something? what do you > > > > > > guys think? > > > > > > > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > > > > the getAction() accessor returns said action GooString ptr, as I said > > > > > > before I don't want to rock the boat; I'm guessing that method is used > > > > > > some place else so I don't want to take it out willy nilly. But I do want > > > > > > to make it clear (if it's not totally obvious already) that I'm not > > > > > > completely familiar with the popplers code. ;-) > > > > > > > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > > > > where is it going to be used? > > > > > > > > > > > > > Mmm thought it was lol, dammit. > > > > Anyway, I added the missing features to the reset form patch today, check it out. > > > > > > > > Cheers, > > > > GA > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > index 5d7b779..abb17b6 100644 > > > > --- a/poppler/Link.cc > > > > +++ b/poppler/Link.cc > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > > > } else if (obj2.isName("SetOCGState")) { > > > > action = new LinkOCGState(obj); > > > > > > > > + // ResetForm action > > > > + } else if (obj2.isName("ResetForm")) { > > > > + action = new LinkResetForm(obj); > > > > + > > > > // unknown action > > > > } else if (obj2.isName()) { > > > > action = new LinkUnknown(obj2.getName()); > > > > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > > > > } > > > > > > > > //------------------------------------------------------------------------ > > > > +// LinkResetForm > > > > +//------------------------------------------------------------------------ > > > > + > > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > > + Object obj1; > > > > + > > > > + fieldList = new GooList(); > > > > + flags = 0; > > > > + > > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > > + Object obj2; > > > > + obj1.arrayGetNF(i, &obj2); > > > > + fieldList->append(obj2.getString()->copy()); > > > > + obj2.free(); > > > > + } > > > > > > Fields items can be either strings or indirect references depending on > > > Flags, and both kinds can be mixed. This will fail if obj2 is not a > > > string. > > > > Have a copy of the spec your using? or more info on the flags? the PDF > > spec I got from adobe I have only mentions bit 1 for (include/exclude). :S > > > http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf Thanks Carlos, I have the same spec it seems. Can you point me to the section? The one I used was 12.7.5.3; it mentions only one flag. Thanks again, GA -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions From carlosgc at gnome.org Mon Jun 14 01:27:27 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 10:27:27 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100614080236.GA10113@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <1276500470-sup-4055@charmaleon> <20100614074507.GA9491@daedalus.localdomain> <1276501671-sup-8223@charmaleon> <20100614080236.GA10113@daedalus.localdomain> Message-ID: <1276503514-sup-3115@charmaleon> Excerpts from Guillermo Amaral's message of lun jun 14 10:02:37 +0200 2010: > On Mon, Jun 14, 2010 at 09:48:08AM +0200, Carlos Garcia Campos wrote: > > Excerpts from Guillermo Amaral's message of lun jun 14 09:45:07 +0200 2010: > > > On Mon, Jun 14, 2010 at 09:34:27AM +0200, Carlos Garcia Campos wrote: > > > > Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > > > > > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > > > > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > > > > 2010: > > > > > > > > > Albert Astals Cid wrote: > > > > > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > > > > > >> and print actions respectably. > > > > > > > > > >> > > > > > > > > > >> Please check them out, and if you have any questions please don't > > > > > > > > > >> hesitate to ask. > > > > > > > > > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > > > > > > > > > And > > > > > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > > > > > break anything else (as far as I can see). > > > > > > > > > > > > > > > > We should definitely add support for additional actions properly in > > > > > > > > poppler. > > > > > > > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > > > > index 5d7b779..e3d6ce7 100644 > > > > > > > > > --- a/poppler/Link.cc > > > > > > > > > +++ b/poppler/Link.cc > > > > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > > > > > GooString *baseURI) { > > > > > > > > > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > > > > > > > + // ResetForm action > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > > + action = new LinkResetForm(); > > > > > > > > > + > > > > > > > > > > > > > > > > > > // unknown action > > > > > > > > > } else if (obj2.isName()) { > > > > > > > > > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > //-------------------------------------------------------------------- > > > > > > > > > ---- > > > > > > > > > > > > > > > > > > +// LinkFormClear > > > > > > > > > +//-------------------------------------------------------------------- > > > > > > > > > ---- + > > > > > > > > > +LinkResetForm::LinkResetForm() { > > > > > > > > > + action = new GooString("ResetForm"); > > > > > > > > > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > > > > > should parse Fields and Flags here. > > > > > > > > > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > > > > > I guess I could make it reset the fields in the fieldlist here and just > > > > > > > notify the client the form values have changed or something? what do you > > > > > > > guys think? > > > > > > > > > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > > > > > the getAction() accessor returns said action GooString ptr, as I said > > > > > > > before I don't want to rock the boat; I'm guessing that method is used > > > > > > > some place else so I don't want to take it out willy nilly. But I do want > > > > > > > to make it clear (if it's not totally obvious already) that I'm not > > > > > > > completely familiar with the popplers code. ;-) > > > > > > > > > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > > > > > where is it going to be used? > > > > > > > > > > > > > > > > Mmm thought it was lol, dammit. > > > > > Anyway, I added the missing features to the reset form patch today, check it out. > > > > > > > > > > Cheers, > > > > > GA > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > index 5d7b779..abb17b6 100644 > > > > > --- a/poppler/Link.cc > > > > > +++ b/poppler/Link.cc > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > action = new LinkOCGState(obj); > > > > > > > > > > + // ResetForm action > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > + action = new LinkResetForm(obj); > > > > > + > > > > > // unknown action > > > > > } else if (obj2.isName()) { > > > > > action = new LinkUnknown(obj2.getName()); > > > > > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > > > > > } > > > > > > > > > > //------------------------------------------------------------------------ > > > > > +// LinkResetForm > > > > > +//------------------------------------------------------------------------ > > > > > + > > > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > > > + Object obj1; > > > > > + > > > > > + fieldList = new GooList(); > > > > > + flags = 0; > > > > > + > > > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > > > + Object obj2; > > > > > + obj1.arrayGetNF(i, &obj2); > > > > > + fieldList->append(obj2.getString()->copy()); > > > > > + obj2.free(); > > > > > + } > > > > > > > > Fields items can be either strings or indirect references depending on > > > > Flags, and both kinds can be mixed. This will fail if obj2 is not a > > > > string. > > > > > > Have a copy of the spec your using? or more info on the flags? the PDF > > > spec I got from adobe I have only mentions bit 1 for (include/exclude). :S > > > > > http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf > > Thanks Carlos, I have the same spec it seems. Can you point me to the > section? The one I used was 12.7.5.3; it mentions only one flag. Yes, there's only one flag, what I meant is that Field items can be strings or indirect objects, and I thought it depended on Flags, but I was wrong. In any case you should take into account items can be indirect references to a field dict. > Thanks again, > GA > -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From gamaral at kdab.com Mon Jun 14 01:28:48 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Mon, 14 Jun 2010 01:28:48 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1276503514-sup-3115@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <1276417004-sup-3718@charmaleon> <20100613155856.GA6584@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <1276500470-sup-4055@charmaleon> <20100614074507.GA9491@daedalus.localdomain> <1276501671-sup-8223@charmaleon> <20100614080236.GA10113@daedalus.localdomain> <1276503514-sup-3115@charmaleon> Message-ID: <20100614082848.GA10322@daedalus.localdomain> On Mon, Jun 14, 2010 at 10:27:27AM +0200, Carlos Garcia Campos wrote: > Excerpts from Guillermo Amaral's message of lun jun 14 10:02:37 +0200 2010: > > On Mon, Jun 14, 2010 at 09:48:08AM +0200, Carlos Garcia Campos wrote: > > > Excerpts from Guillermo Amaral's message of lun jun 14 09:45:07 +0200 2010: > > > > On Mon, Jun 14, 2010 at 09:34:27AM +0200, Carlos Garcia Campos wrote: > > > > > Excerpts from Guillermo Amaral's message of lun jun 14 05:37:16 +0200 2010: > > > > > > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > > > > > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > > > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > > > > > 2010: > > > > > > > > > > Albert Astals Cid wrote: > > > > > > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > > > > > > >> I wanted to send in these patches, they allow handling of reset-form > > > > > > > > > > >> and print actions respectably. > > > > > > > > > > >> > > > > > > > > > > >> Please check them out, and if you have any questions please don't > > > > > > > > > > >> hesitate to ask. > > > > > > > > > > > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to break > > > > > > > > > > the flow of other programs, I think I went to far lol (fixed) > > > > > > > > > > > > > > > > > > > > > And > > > > > > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > > > > > > Sometimes the AA dict is used to hold a ref to the named object. I > > > > > > > > > > have seen it in two docs so far, it seems to happen when people set > > > > > > > > > > an action to happen on mouse down instead of mouse up. It should not > > > > > > > > > > break anything else (as far as I can see). > > > > > > > > > > > > > > > > > > We should definitely add support for additional actions properly in > > > > > > > > > poppler. > > > > > > > > > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > > > > > index 5d7b779..e3d6ce7 100644 > > > > > > > > > > --- a/poppler/Link.cc > > > > > > > > > > +++ b/poppler/Link.cc > > > > > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, > > > > > > > > > > GooString *baseURI) { > > > > > > > > > > > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > > > > > > > > > + // ResetForm action > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > > > > > + action = new LinkResetForm(); > > > > > > > > > > + > > > > > > > > > > > > > > > > > > > > // unknown action > > > > > > > > > > } else if (obj2.isName()) { > > > > > > > > > > > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > //-------------------------------------------------------------------- > > > > > > > > > > ---- > > > > > > > > > > > > > > > > > > > > +// LinkFormClear > > > > > > > > > > +//-------------------------------------------------------------------- > > > > > > > > > > ---- + > > > > > > > > > > +LinkResetForm::LinkResetForm() { > > > > > > > > > > + action = new GooString("ResetForm"); > > > > > > > > > > > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > > > > > > should parse Fields and Flags here. > > > > > > > > > > > > > > > > Yeah it's a partial patch, it allows the client to know it has to reset.. > > > > > > > > I guess I could make it reset the fields in the fieldlist here and just > > > > > > > > notify the client the form values have changed or something? what do you > > > > > > > > guys think? > > > > > > > > > > > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > > > > > > the getAction() accessor returns said action GooString ptr, as I said > > > > > > > > before I don't want to rock the boat; I'm guessing that method is used > > > > > > > > some place else so I don't want to take it out willy nilly. But I do want > > > > > > > > to make it clear (if it's not totally obvious already) that I'm not > > > > > > > > completely familiar with the popplers code. ;-) > > > > > > > > > > > > > > getAction() used somewhere? It's not virtual and you don't use it anywhere, so > > > > > > > where is it going to be used? > > > > > > > > > > > > > > > > > > > Mmm thought it was lol, dammit. > > > > > > Anyway, I added the missing features to the reset form patch today, check it out. > > > > > > > > > > > > Cheers, > > > > > > GA > > > > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > > index 5d7b779..abb17b6 100644 > > > > > > --- a/poppler/Link.cc > > > > > > +++ b/poppler/Link.cc > > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > > > + // ResetForm action > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > + action = new LinkResetForm(obj); > > > > > > + > > > > > > // unknown action > > > > > > } else if (obj2.isName()) { > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > @@ -856,6 +860,40 @@ LinkOCGState::StateList::~StateList() { > > > > > > } > > > > > > > > > > > > //------------------------------------------------------------------------ > > > > > > +// LinkResetForm > > > > > > +//------------------------------------------------------------------------ > > > > > > + > > > > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > > > > + Object obj1; > > > > > > + > > > > > > + fieldList = new GooList(); > > > > > > + flags = 0; > > > > > > + > > > > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > > > > + Object obj2; > > > > > > + obj1.arrayGetNF(i, &obj2); > > > > > > + fieldList->append(obj2.getString()->copy()); > > > > > > + obj2.free(); > > > > > > + } > > > > > > > > > > Fields items can be either strings or indirect references depending on > > > > > Flags, and both kinds can be mixed. This will fail if obj2 is not a > > > > > string. > > > > > > > > Have a copy of the spec your using? or more info on the flags? the PDF > > > > spec I got from adobe I have only mentions bit 1 for (include/exclude). :S > > > > > > > http://www.adobe.com/devnet/acrobat/pdfs/PDF32000_2008.pdf > > > > Thanks Carlos, I have the same spec it seems. Can you point me to the > > section? The one I used was 12.7.5.3; it mentions only one flag. > > Yes, there's only one flag, what I meant is that Field items can be > strings or indirect objects, and I thought it depended on Flags, but > I was wrong. In any case you should take into account items can be > indirect references to a field dict. > Ah, got it ;-) I thought maybe I used a diff spec or something. I'm tired lol Cheers dudes. -- gamaral From carlosgc at kemper.freedesktop.org Mon Jun 14 08:42:54 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 08:42:54 -0700 (PDT) Subject: [poppler] glib/demo Message-ID: <20100614154254.1A21810057@kemper.freedesktop.org> glib/demo/attachments.c | 5 ----- glib/demo/main.c | 32 +------------------------------- 2 files changed, 1 insertion(+), 36 deletions(-) New commits: commit 34b2dbb6bbaf0189c92eea6b7924999ab2b6ad11 Author: Carlos Garcia Campos Date: Mon Jun 14 17:41:51 2010 +0200 [glib-demo] Remove GLIB_CHECK_VERSION(), we already depend on glib 2.18 diff --git a/glib/demo/attachments.c b/glib/demo/attachments.c index 28eb62e..63565dd 100644 --- a/glib/demo/attachments.c +++ b/glib/demo/attachments.c @@ -179,7 +179,6 @@ pgd_attachments_save_button_clicked (GtkButton *button, } -#if GLIB_CHECK_VERSION(2, 16, 0) static gboolean attachment_save_callback (const gchar *buf, gsize count, @@ -270,7 +269,6 @@ pgd_attachments_validate_button_clicked (GtkButton *button, g_free (digest); g_object_unref (attachment); } -#endif GtkWidget * pgd_attachments_create_widget (PopplerDocument *document) @@ -340,7 +338,6 @@ pgd_attachments_create_widget (PopplerDocument *document) gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); -#if GLIB_CHECK_VERSION(2, 16, 0) button = gtk_button_new_with_label ("Validate"); g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (pgd_attachments_validate_button_clicked), @@ -348,8 +345,6 @@ pgd_attachments_create_widget (PopplerDocument *document) gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); gtk_widget_show (button); -#endif - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6); gtk_widget_show (hbox); diff --git a/glib/demo/main.c b/glib/demo/main.c index 89e4eeb..9137a25 100644 --- a/glib/demo/main.c +++ b/glib/demo/main.c @@ -149,6 +149,7 @@ gint main (gint argc, gchar **argv) GtkWidget *notebook; GtkWidget *treeview; GtkTreeSelection *selection; + GFile *file; gchar *uri; GTimer *timer; GError *error = NULL; @@ -163,40 +164,9 @@ gint main (gint argc, gchar **argv) gtk_init (&argc, &argv); -#if GLIB_CHECK_VERSION (2,15,0) - GFile *file; - file = g_file_new_for_commandline_arg (argv[1]); uri = g_file_get_uri (file); g_object_unref (file); -#else - if (g_path_is_absolute (argv[1])) { - uri = g_filename_to_uri (argv[1], NULL, &error); - } else if (g_ascii_strncasecmp (argv[1], "file://", strlen ("file://")) == 0) { - uri = g_strdup (argv[1]); - } else if (!g_strrstr (argv[1], "://")) { - gchar *dir; - gchar *filename; - - dir = g_get_current_dir (); - filename = g_build_filename (dir, argv[1], NULL); - g_free (dir); - - uri = g_filename_to_uri (filename, NULL, &error); - g_free (filename); - } else { - g_print ("Error: unsupported uri\n"); - - return 1; - } - - if (error) { - g_print ("Error: %s\n", error->message); - g_error_free (error); - - return 1; - } -#endif /* GLIB_CHECK_VERSION */ timer = g_timer_new (); document = poppler_document_new_from_file (uri, NULL, &error); From carlosgc at kemper.freedesktop.org Mon Jun 14 09:17:39 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Mon, 14 Jun 2010 09:17:39 -0700 (PDT) Subject: [poppler] glib/demo Message-ID: <20100614161739.DACB710057@kemper.freedesktop.org> glib/demo/main.c | 175 +++++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 170 insertions(+), 5 deletions(-) New commits: commit cc2e5f190e19ee8169f67df2541302a2816873d3 Author: Carlos Garcia Campos Date: Mon Jun 14 18:17:01 2010 +0200 [glib-demo] Support password protected documents diff --git a/glib/demo/main.c b/glib/demo/main.c index 9137a25..206d29b 100644 --- a/glib/demo/main.c +++ b/glib/demo/main.c @@ -141,6 +141,145 @@ pdg_demo_notebook_create (PopplerDocument *document) return notebook; } +static void +pgd_demo_auth_dialog_entry_changed (GtkEditable *editable, + GtkDialog *dialog) +{ + const char *text; + + text = gtk_entry_get_text (GTK_ENTRY (editable)); + + gtk_dialog_set_response_sensitive (dialog, GTK_RESPONSE_OK, + (text != NULL && *text != '\0')); + g_object_set_data (G_OBJECT (dialog), "pgd-password", (gpointer)text); +} + +static void +pgd_demo_auth_dialog_entry_activated (GtkEntry *entry, + GtkDialog *dialog) +{ + gtk_dialog_response (dialog, GTK_RESPONSE_OK); +} + +static GtkDialog * +pgd_demo_get_auth_dialog (GFile *uri_file) +{ + GtkDialog *dialog; + GtkWidget *content_area, *action_area; + GtkWidget *entry_container; + GtkWidget *password_entry; + GtkWidget *hbox, *main_vbox, *vbox, *icon; + GtkWidget *table; + GtkWidget *label; + gchar *format, *markup, *file_name; + + dialog = GTK_DIALOG (gtk_dialog_new ()); + content_area = gtk_dialog_get_content_area (dialog); + action_area = gtk_dialog_get_action_area (dialog); + + /* Set the dialog up with HIG properties */ + gtk_dialog_set_has_separator (dialog, FALSE); + gtk_container_set_border_width (GTK_CONTAINER (dialog), 5); + gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */ + gtk_container_set_border_width (GTK_CONTAINER (action_area), 5); + gtk_box_set_spacing (GTK_BOX (action_area), 6); + + gtk_window_set_title (GTK_WINDOW (dialog), "Enter password"); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); + gtk_window_set_icon_name (GTK_WINDOW (dialog), GTK_STOCK_DIALOG_AUTHENTICATION); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + + gtk_dialog_add_buttons (dialog, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + "_Unlock Document", GTK_RESPONSE_OK, + NULL); + gtk_dialog_set_default_response (dialog, GTK_RESPONSE_OK); + gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), + GTK_RESPONSE_OK, FALSE); + gtk_dialog_set_alternative_button_order (dialog, + GTK_RESPONSE_OK, + GTK_RESPONSE_CANCEL, + -1); + + /* Build contents */ + hbox = gtk_hbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); + gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); + gtk_widget_show (hbox); + + icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_AUTHENTICATION, + GTK_ICON_SIZE_DIALOG); + + gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0.0); + gtk_box_pack_start (GTK_BOX (hbox), icon, FALSE, FALSE, 0); + gtk_widget_show (icon); + + main_vbox = gtk_vbox_new (FALSE, 18); + gtk_box_pack_start (GTK_BOX (hbox), main_vbox, TRUE, TRUE, 0); + gtk_widget_show (main_vbox); + + label = gtk_label_new (NULL); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); + file_name = g_file_get_basename (uri_file); + format = g_strdup_printf ("%s\n\n%s", + "Password required", + "The document ???%s??? is locked and requires a password before it can be opened."); + markup = g_markup_printf_escaped (format, file_name); + gtk_label_set_markup (GTK_LABEL (label), markup); + g_free (format); + g_free (markup); + g_free (file_name); + gtk_box_pack_start (GTK_BOX (main_vbox), label, + FALSE, FALSE, 0); + gtk_widget_show (label); + + vbox = gtk_vbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (main_vbox), vbox, FALSE, FALSE, 0); + gtk_widget_show (vbox); + + /* The table that holds the entries */ + entry_container = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + + gtk_alignment_set_padding (GTK_ALIGNMENT (entry_container), + 0, 0, 0, 0); + + gtk_box_pack_start (GTK_BOX (vbox), entry_container, + FALSE, FALSE, 0); + gtk_widget_show (entry_container); + + table = gtk_table_new (1, 2, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (table), 12); + gtk_table_set_row_spacings (GTK_TABLE (table), 6); + gtk_container_add (GTK_CONTAINER (entry_container), table); + gtk_widget_show (table); + + label = gtk_label_new_with_mnemonic ("_Password:"); + gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); + + password_entry = gtk_entry_new (); + gtk_entry_set_visibility (GTK_ENTRY (password_entry), FALSE); + g_signal_connect (password_entry, "changed", + G_CALLBACK (pgd_demo_auth_dialog_entry_changed), + dialog); + g_signal_connect (password_entry, "activate", + G_CALLBACK (pgd_demo_auth_dialog_entry_activated), + dialog); + + gtk_table_attach (GTK_TABLE (table), label, + 0, 1, 0, 1, + GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0); + gtk_widget_show (label); + + gtk_table_attach_defaults (GTK_TABLE (table), password_entry, + 1, 2, 0, 1); + gtk_widget_show (password_entry); + + gtk_label_set_mnemonic_widget (GTK_LABEL (label), password_entry); + + return dialog; +} + gint main (gint argc, gchar **argv) { PopplerDocument *document; @@ -166,19 +305,45 @@ gint main (gint argc, gchar **argv) file = g_file_new_for_commandline_arg (argv[1]); uri = g_file_get_uri (file); - g_object_unref (file); timer = g_timer_new (); document = poppler_document_new_from_file (uri, NULL, &error); g_timer_stop (timer); if (error) { - g_print ("Error: %s\n", error->message); - g_error_free (error); - g_free (uri); + while (g_error_matches (error, POPPLER_ERROR, POPPLER_ERROR_ENCRYPTED)) { + GtkDialog *dialog; + const gchar *password; - return 1; + dialog = pgd_demo_get_auth_dialog (file); + if (gtk_dialog_run (dialog) != GTK_RESPONSE_OK) { + g_print ("Error: no password provided\n"); + g_object_unref (file); + g_free (uri); + + return 1; + } + + g_clear_error (&error); + password = g_object_get_data (G_OBJECT (dialog), "pgd-password"); + + g_timer_start (timer); + document = poppler_document_new_from_file (uri, password, &error); + g_timer_stop (timer); + + gtk_widget_destroy (GTK_WIDGET (dialog)); + } + + if (error) { + g_print ("Error: %s\n", error->message); + g_error_free (error); + g_object_unref (file); + g_free (uri); + + return 1; + } } + g_object_unref (file); g_free (uri); g_print ("Document successfully loaded in %.4f seconds\n", From ludewich at users.sourceforge.net Mon Jun 14 10:40:39 2010 From: ludewich at users.sourceforge.net (Christian Feuersaenger) Date: Mon, 14 Jun 2010 19:40:39 +0200 Subject: [poppler] Implemented Type 4/5 shading for Splash Device Message-ID: <4C166997.9050109@users.sourceforge.net> Dear Poppler Developers, I found that the actual implementation of Type 4 or Type 5 interpoalted shadings in xpdf/libpoppler are extremely slow and do not display all shadings correctly (parameterized patches with large triangles are often wrong). I have written a stable patch for both issues: it is now about 5 times faster and displays parameterized patches correctly. It is a small bugfix combined with a tweaked the triangle refinement. Furthermore, I have a prototype which implements *real* linear interpolation for these shadings. It is very fast and looks considerably better than the piecewise constant approximation introduced by triangle refinements. It works pretty well up to now. I implemented low level support for these shadings and specialized the SplashOutputDev for rendering triangle interpolations, i.e. it works for screen display and for bitmap output. Quality and display speed match the one of acrobat reader. I am sure my additions are valueable and propose them for usage in libpoppler: the bugfix/speed improvement is directly usable and stable and the lowlevel shader will need some more time. I could also use some advice to get the integration with transparency, blending and whatever correctly. I started with the xpdf sources, so I would also appreciate any hints how you communicate changes between xpdf and libpoppler if you are interested in my proposal. Best regards Christian From aacid at kde.org Mon Jun 14 11:13:43 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 19:13:43 +0100 Subject: [poppler] Addition of stream::getChars Message-ID: <201006141913.44053.aacid@kde.org> Hi, this patch implements getChars as improvement to the getChar interface, just by making the number of function calls smaller, i get around 10% speed improvements in PDF files like 28225 and thought the number of changed lines is quite big it doesn't add much code duplication (it removes some) so it should not make code more difficult to maintain. I've run it thorugh my test suite and did get 100% exact results as the one we get now. If noone disagrees i'll commit it to trunk on wednesday european night. Albert -------------- next part -------------- A non-text attachment was scrubbed... Name: getchars.patch Type: text/x-patch Size: 20177 bytes Desc: not available URL: From aacid at kemper.freedesktop.org Mon Jun 14 11:18:33 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 11:18:33 -0700 (PDT) Subject: [poppler] poppler/XRef.cc poppler/XRef.h Message-ID: <20100614181834.016B710057@kemper.freedesktop.org> poppler/XRef.cc | 62 +++++++++++++++++++++++++++++++++++++++++++++++--------- poppler/XRef.h | 4 +-- 2 files changed, 55 insertions(+), 11 deletions(-) New commits: commit 3ca304f3837af27ae49541a5f441d8729264a945 Author: Albert Astals Cid Date: Mon Jun 14 19:16:41 2010 +0100 Add more caching to ObjectStreams Makes opening of file from bug 26759 ten times faster diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 9d0cd3b..a9cf571 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -45,6 +45,7 @@ #include "Error.h" #include "ErrorCodes.h" #include "XRef.h" +#include "PopplerCache.h" //------------------------------------------------------------------------ @@ -97,6 +98,37 @@ private: GBool ok; }; +class ObjectStreamKey : public PopplerCacheKey +{ + public: + ObjectStreamKey(int num) : objStrNum(num) + { + } + + bool operator==(const PopplerCacheKey &key) const + { + const ObjectStreamKey *k = static_cast(&key); + return objStrNum == k->objStrNum; + } + + const int objStrNum; +}; + +class ObjectStreamItem : public PopplerCacheItem +{ + public: + ObjectStreamItem(ObjectStream *objStr) : objStream(objStr) + { + } + + ~ObjectStreamItem() + { + delete objStream; + } + + ObjectStream *objStream; +}; + ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { Stream *str; Parser *parser; @@ -233,7 +265,7 @@ XRef::XRef() { size = 0; streamEnds = NULL; streamEndsLen = 0; - objStr = NULL; + objStrs = new PopplerCache(5); } XRef::XRef(BaseStream *strA) { @@ -246,7 +278,7 @@ XRef::XRef(BaseStream *strA) { entries = NULL; streamEnds = NULL; streamEndsLen = 0; - objStr = NULL; + objStrs = new PopplerCache(5); encrypted = gFalse; permFlags = defPermFlags; @@ -309,8 +341,8 @@ XRef::~XRef() { if (streamEnds) { gfree(streamEnds); } - if (objStr) { - delete objStr; + if (objStrs) { + delete objStrs; } } @@ -1010,22 +1042,34 @@ Object *XRef::fetch(int num, int gen, Object *obj) { break; case xrefEntryCompressed: + { if (gen != 0) { goto err; } - if (!objStr || objStr->getObjStrNum() != (int)e->offset) { - if (objStr) { - delete objStr; - } + + ObjectStream *objStr = NULL; + ObjectStreamKey key(e->offset); + PopplerCacheItem *item = objStrs->lookup(key); + if (item) { + ObjectStreamItem *it = static_cast(item); + objStr = it->objStream; + } + + if (!objStr) { objStr = new ObjectStream(this, e->offset); if (!objStr->isOk()) { delete objStr; objStr = NULL; goto err; + } else { + ObjectStreamKey *newkey = new ObjectStreamKey(e->offset); + ObjectStreamItem *newitem = new ObjectStreamItem(objStr); + objStrs->put(newkey, newitem); } } objStr->getObject(e->gen, num, obj); - break; + } + break; default: goto err; diff --git a/poppler/XRef.h b/poppler/XRef.h index 36546fc..be19e23 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -37,7 +37,7 @@ class Dict; class Stream; class Parser; -class ObjectStream; +class PopplerCache; //------------------------------------------------------------------------ // XRef @@ -146,7 +146,7 @@ private: Guint *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds - ObjectStream *objStr; // cached object stream + PopplerCache *objStrs; // cached object streams GBool encrypted; // true if file is encrypted int encRevision; int encVersion; // encryption algorithm From aacid at kde.org Mon Jun 14 11:19:39 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 19:19:39 +0100 Subject: [poppler] Caching more ObjectStream In-Reply-To: <1276501502-sup-970@charmaleon> References: <201006132228.25905.aacid@kde.org> <1276501502-sup-970@charmaleon> Message-ID: <201006141919.39228.aacid@kde.org> A Dilluns, 14 de juny de 2010, Carlos Garcia Campos va escriure: > Excerpts from Albert Astals Cid's message of dom jun 13 23:28:25 +0200 2010: > > Hi, this patch makes opening of file in bug 26759 go down from around 15 > > secs to 1.5 secs by caching more ObjectStream objects. Obviously some > > more memory is used but i think a 10x speed is worth it. > > Absolutely > > > Any objection to commit it to both master and 0.14 branches? > > No > > > Albert Commited. Albert From aacid at kemper.freedesktop.org Mon Jun 14 11:19:58 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 11:19:58 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - poppler/XRef.cc poppler/XRef.h Message-ID: <20100614181958.3E26310057@kemper.freedesktop.org> poppler/XRef.cc | 62 +++++++++++++++++++++++++++++++++++++++++++++++--------- poppler/XRef.h | 4 +-- 2 files changed, 55 insertions(+), 11 deletions(-) New commits: commit 54ed4c6962a68e744bdd272193c320c0ea35359c Author: Albert Astals Cid Date: Mon Jun 14 19:16:41 2010 +0100 Add more caching to ObjectStreams Makes opening of file from bug 26759 ten times faster diff --git a/poppler/XRef.cc b/poppler/XRef.cc index 9d0cd3b..a9cf571 100644 --- a/poppler/XRef.cc +++ b/poppler/XRef.cc @@ -45,6 +45,7 @@ #include "Error.h" #include "ErrorCodes.h" #include "XRef.h" +#include "PopplerCache.h" //------------------------------------------------------------------------ @@ -97,6 +98,37 @@ private: GBool ok; }; +class ObjectStreamKey : public PopplerCacheKey +{ + public: + ObjectStreamKey(int num) : objStrNum(num) + { + } + + bool operator==(const PopplerCacheKey &key) const + { + const ObjectStreamKey *k = static_cast(&key); + return objStrNum == k->objStrNum; + } + + const int objStrNum; +}; + +class ObjectStreamItem : public PopplerCacheItem +{ + public: + ObjectStreamItem(ObjectStream *objStr) : objStream(objStr) + { + } + + ~ObjectStreamItem() + { + delete objStream; + } + + ObjectStream *objStream; +}; + ObjectStream::ObjectStream(XRef *xref, int objStrNumA) { Stream *str; Parser *parser; @@ -233,7 +265,7 @@ XRef::XRef() { size = 0; streamEnds = NULL; streamEndsLen = 0; - objStr = NULL; + objStrs = new PopplerCache(5); } XRef::XRef(BaseStream *strA) { @@ -246,7 +278,7 @@ XRef::XRef(BaseStream *strA) { entries = NULL; streamEnds = NULL; streamEndsLen = 0; - objStr = NULL; + objStrs = new PopplerCache(5); encrypted = gFalse; permFlags = defPermFlags; @@ -309,8 +341,8 @@ XRef::~XRef() { if (streamEnds) { gfree(streamEnds); } - if (objStr) { - delete objStr; + if (objStrs) { + delete objStrs; } } @@ -1010,22 +1042,34 @@ Object *XRef::fetch(int num, int gen, Object *obj) { break; case xrefEntryCompressed: + { if (gen != 0) { goto err; } - if (!objStr || objStr->getObjStrNum() != (int)e->offset) { - if (objStr) { - delete objStr; - } + + ObjectStream *objStr = NULL; + ObjectStreamKey key(e->offset); + PopplerCacheItem *item = objStrs->lookup(key); + if (item) { + ObjectStreamItem *it = static_cast(item); + objStr = it->objStream; + } + + if (!objStr) { objStr = new ObjectStream(this, e->offset); if (!objStr->isOk()) { delete objStr; objStr = NULL; goto err; + } else { + ObjectStreamKey *newkey = new ObjectStreamKey(e->offset); + ObjectStreamItem *newitem = new ObjectStreamItem(objStr); + objStrs->put(newkey, newitem); } } objStr->getObject(e->gen, num, obj); - break; + } + break; default: goto err; diff --git a/poppler/XRef.h b/poppler/XRef.h index 36546fc..be19e23 100644 --- a/poppler/XRef.h +++ b/poppler/XRef.h @@ -37,7 +37,7 @@ class Dict; class Stream; class Parser; -class ObjectStream; +class PopplerCache; //------------------------------------------------------------------------ // XRef @@ -146,7 +146,7 @@ private: Guint *streamEnds; // 'endstream' positions - only used in // damaged files int streamEndsLen; // number of valid entries in streamEnds - ObjectStream *objStr; // cached object stream + PopplerCache *objStrs; // cached object streams GBool encrypted; // true if file is encrypted int encRevision; int encVersion; // encryption algorithm From aacid at kde.org Mon Jun 14 11:23:40 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 19:23:40 +0100 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <4C166997.9050109@users.sourceforge.net> References: <4C166997.9050109@users.sourceforge.net> Message-ID: <201006141923.40228.aacid@kde.org> A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: > Dear Poppler Developers, Hi Chrisitian > > I found that the actual implementation of Type 4 or Type 5 interpoalted > shadings in xpdf/libpoppler are extremely slow and do not display all > shadings correctly (parameterized patches with large triangles are often > wrong). > > I have written a stable patch for both issues: it is now about 5 times > faster and displays parameterized patches correctly. It is a small > bugfix combined with a tweaked the triangle refinement. > > Furthermore, I have a prototype which implements *real* linear > interpolation for these shadings. It is very fast and looks considerably > better than the piecewise constant approximation introduced by triangle > refinements. It works pretty well up to now. I implemented low level > support for these shadings and specialized the SplashOutputDev for > rendering triangle interpolations, i.e. it works for screen display and > for bitmap output. Quality and display speed match the one of acrobat > reader. > > I am sure my additions are valueable and propose them for usage in > libpoppler: the bugfix/speed improvement is directly usable and stable > and the lowlevel shader will need some more time. I could also use some > advice to get the integration with transparency, blending and whatever > correctly. I started with the xpdf sources, so I would also appreciate > any hints how you communicate changes between xpdf and libpoppler if you > are interested in my proposal. Yes, we are interested in your patches, basically what we would need you is to provide a patch over poppler sources, you can choose wheter you want to make it against git master branch, git poppler-0.14 branch or the released 0.14.0 tarball. Also it would be interesting to have the PDF you have used for testing. Thanks, Albert > > Best regards > > Christian > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From ludewich at users.sourceforge.net Mon Jun 14 12:37:02 2010 From: ludewich at users.sourceforge.net (Christian Feuersaenger) Date: Mon, 14 Jun 2010 21:37:02 +0200 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: References: Message-ID: <4C1684DE.201@users.sourceforge.net> Hi Albert, thank you for the fast reply and your positive answer! I will use the next days to apply the xpdf patches to libpoppler. I intent to patch the patched triangle refinement to your stable branch, which appears to be the poppler-0.14 (?). I consider it to be a bugfix. The interpolated shader is not yet stable and may need some revisions. I will continue working on it, preferrable on a separate branch. If you like, I can try to make a www git repository somewhere such that you can fetch my changes and merge them to whereever you want. For the moment, you find my test.pdf attached. it has been generated with latex and the unstable version of \usepackage{pgfplots}, http://pgfplots.sourceforge.net/; I also attached the .tex sources. So, thank you for the positive feedback. Best regards Christian >> > I am sure my additions are valueable and propose them for usage in >> > libpoppler: the bugfix/speed improvement is directly usable and stable >> > and the lowlevel shader will need some more time. I could also use some >> > advice to get the integration with transparency, blending and whatever >> > correctly. I started with the xpdf sources, so I would also appreciate >> > any hints how you communicate changes between xpdf and libpoppler if you >> > are interested in my proposal. > Yes, we are interested in your patches, basically what we would need you is to > provide a patch over poppler sources, you can choose wheter you want to make > it against git master branch, git poppler-0.14 branch or the released 0.14.0 > tarball. > > Also it would be interesting to have the PDF you have used for testing. > > Thanks, > Albert From ludewich at users.sourceforge.net Mon Jun 14 12:38:40 2010 From: ludewich at users.sourceforge.net (Christian Feuersaenger) Date: Mon, 14 Jun 2010 21:38:40 +0200 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: References: Message-ID: <4C168540.8040406@users.sourceforge.net> ... sorry, I forgot the attachment. and I apologize to the list admin: I accidentally sent mail from the wrong address. -------------- next part -------------- A non-text attachment was scrubbed... Name: test.pdf Type: application/pdf Size: 73326 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: test.tex Type: text/x-tex Size: 783 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: FokkerDrI_layer_0.patches.dat Type: application/x-ns-proxy-autoconfig Size: 46921 bytes Desc: not available URL: From aacid at kde.org Mon Jun 14 14:07:27 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 14 Jun 2010 22:07:27 +0100 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <4C1684DE.201@users.sourceforge.net> References: <4C1684DE.201@users.sourceforge.net> Message-ID: <201006142207.27550.aacid@kde.org> A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: > Hi Albert, > > thank you for the fast reply and your positive answer! > > I will use the next days to apply the xpdf patches to libpoppler. > > I intent to patch the patched triangle refinement to your stable branch, > which appears to be the poppler-0.14 (?). I consider it to be a bugfix. Right poppler 0.14 is our stable branch. > > The interpolated shader is not yet stable and may need some revisions. I > will continue working on it, preferrable on a separate branch. > If you like, I can try to make a www git repository somewhere such that > you can fetch my changes and merge them to whereever you want. Personally i'd prefer that you send the patches to the mailing list, makes easier for more people to see them and comment if they feel like. Albert > > For the moment, you find my test.pdf attached. it has been generated > with latex and the unstable version of \usepackage{pgfplots}, > http://pgfplots.sourceforge.net/; I also attached the .tex sources. > > So, thank you for the positive feedback. > > Best regards > > Christian > > >> > I am sure my additions are valueable and propose them for usage in > >> > libpoppler: the bugfix/speed improvement is directly usable and > > stable > > >> > and the lowlevel shader will need some more time. I could also > > use some > > >> > advice to get the integration with transparency, blending and > > whatever > > >> > correctly. I started with the xpdf sources, so I would also > > appreciate > > >> > any hints how you communicate changes between xpdf and libpoppler > > if you > > >> > are interested in my proposal. > > > > Yes, we are interested in your patches, basically what we would need > > you is to > > > provide a patch over poppler sources, you can choose wheter you want > > to make > > > it against git master branch, git poppler-0.14 branch or the released > > 0.14.0 > > > tarball. > > > > Also it would be interesting to have the PDF you have used for testing. > > > > Thanks, > > > > Albert > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From leenagour at gmail.com Mon Jun 14 23:34:41 2010 From: leenagour at gmail.com (leena chourey) Date: Tue, 15 Jun 2010 12:04:41 +0530 Subject: [poppler] Accessibility of PDF documents (patch attached) Message-ID: Dear developers, The poppler patch is attached related with "accessibility of pdf document", please check it and give your feedback. On Mon, Jun 14, 2010 at 12:44 PM, leena chourey wrote: > Dear Albert, > > Thanks for responding. > The poppler patch related with our changes will be submitted soon to > poppler developers for feedback. > > with regards > Leena > > > > On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid wrote: > >> A Divendres, 11 de juny de 2010, leena chourey va escriure: >> > Dear all, >> > >> > This is in continuation to our last communication related with >> > *Accessibility of Pdf document.* As discussed last time, we have now >> > completed the first prototype version of the same and we are making it >> > available for your testing and valuable comments/feedback. As mentioned >> > last time, we convert the PDF file into HTML format and open the same >> > automatically in Firefox. >> > >> > Enclosed with this email is the ReadMe file which explains the steps to >> > download, install and run this enhancement. Please try out the same and >> > give us your valuable feedback. >> > >> > >> > We have tested it at our end by different teams and have found that it >> > works well in most cases. Some places where we feel work is required are >> > as follows: >> > >> > - Sometimes Orca in not able to read header and footer of page >> > - Some character combinations are displayed as garbage like 'ft', >> 'tt' >> > - Content in table format is spoken by orca but it does not say the >> row >> > and column reference. Means a user can not find out that orca is >> reading >> > table content. (as orca does table reading in openoffice writer) >> > >> > We are working on these. Waiting to hear more from all. >> >> Quick question, do you have any patches on top of the poppler you use? >> >> Albert >> >> > >> > >> > >> > >> > With regards >> > Leena C >> _______________________________________________ >> poppler mailing list >> poppler at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/poppler >> > > > > -- > Leena C > Thanks & Regards -- Leena C (for CDAC Mumbai team) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-By-CDAC-Developers_accesspdf.patch Type: text/x-diff Size: 7324 bytes Desc: not available URL: From srinivas.adicherla at gmail.com Tue Jun 15 00:03:11 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Tue, 15 Jun 2010 12:33:11 +0530 Subject: [poppler] poppler Digest, Vol 64, Issue 9 In-Reply-To: References: Message-ID: Hi, By considering the suggestions from Carlos & Pino Toscano, I made some changes to the previous patch. As Carlos mentioned, I added PDFDoc:getID() in the core and from the glib bindings took the structure for PopplerDocumentId and returning it. In addition to that I added two new properties in the PopplerDocument namely, "permanent-id" , "update-id". As Carlos mentioned PDFDoc::saveAs() will not generate ID unless we modify and save the file. If we don't modify and save it, it is nothing but save a copy.So, I added PDFDoc::setID() in the core. Please find two attachments with this mail containing the above said changes. On Sat, Jun 12, 2010 at 12:30 AM, wrote: > Send poppler mailing list submissions to > poppler at lists.freedesktop.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freedesktop.org/mailman/listinfo/poppler > or, via email, send a message with subject or body 'help' to > poppler-request at lists.freedesktop.org > > You can reach the person managing the list at > poppler-owner at lists.freedesktop.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of poppler digest..." > > > Today's Topics: > > 1. Re: Patch to Get/Set PDF ID in the trailer dictionary, get > page labels . (Carlos Garcia Campos) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 11 Jun 2010 12:31:47 +0200 > From: Carlos Garcia Campos > Subject: Re: [poppler] Patch to Get/Set PDF ID in the trailer > dictionary, get page labels . > To: srinivas adicherla > Cc: poppler > Message-ID: <1276251137-sup-4795 at charmaleon> > Content-Type: text/plain; charset="utf8" > > Excerpts from srinivas adicherla's message of jue jun 10 12:13:25 +0200 > 2010: > > Hi, > > Hi srinivas, > > > This Patch does the following: > > Thanks for the patch, I some comments: > > > 1) gets and set the pdf IDs in the trailer dictionary. > > The code to get ID could be moved to the core, so that it can be used > by other frontends, someting like PDFDoc::getID(). In the glib > frontend, instead of returning an array we could use a struct so that > we can also give names to the fields, since the first id is the > permanent id and the second one is the id that changes when the > document is updated. Something like > > typedef struct _PopplerDocumentId { > gchar permanent_id[32]; > gchar update_id[32]; > } PopplerDocumentId; > > The method generate_and_set_id() shouldn't be necessary since > PDFDoc::saveAS() already generates a new id. > > > 2) get all page labels & get page labels by index. > > We already have labels in the glib frontend, it's property of > PopplerPage that can be obtained with > > g_object_get (page, "label", &label, NULL); > > I don't think we need that API in PopplerDocument, but we should > probably expose it in the PopplerPage API to make it easier to > find. > > > Kindly let me know if You commit this patch. > > > > > > Thanks > > A Srinivas > -- > Carlos Garcia Campos > PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: signature.asc > Type: application/pgp-signature > Size: 198 bytes > Desc: not available > URL: < > http://lists.freedesktop.org/archives/poppler/attachments/20100611/3ab6035b/attachment-0001.pgp > > > > ------------------------------ > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > > > End of poppler Digest, Vol 64, Issue 9 > ************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler.patch Type: text/x-patch Size: 6628 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler_api.patch Type: text/x-patch Size: 7315 bytes Desc: not available URL: From carlosgc at kemper.freedesktop.org Tue Jun 15 01:39:50 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Tue, 15 Jun 2010 01:39:50 -0700 (PDT) Subject: [poppler] glib/demo Message-ID: <20100615083950.0C1FB10057@kemper.freedesktop.org> glib/demo/find.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 44639cb7b10ab6d66122ae2b6b7f3e5745f933bd Author: Carlos Garcia Campos Date: Tue Jun 15 10:39:00 2010 +0200 [glib-demo] Use poppler_rectangle_free() instead of g_free() diff --git a/glib/demo/find.c b/glib/demo/find.c index 08e41e2..632e610 100644 --- a/glib/demo/find.c +++ b/glib/demo/find.c @@ -138,7 +138,7 @@ pgd_find_find_text (PgdFindDemo *demo) g_free (y1); g_free (x2); g_free (y2); - g_free (rect); + poppler_rectangle_free (rect); } g_list_free (matches); } From buchner.johannes at gmx.at Tue Jun 15 03:37:16 2010 From: buchner.johannes at gmx.at (Johannes Buchner) Date: Tue, 15 Jun 2010 22:37:16 +1200 Subject: [poppler] KMP for search Message-ID: <20100615223716.8513ae9d.buchner.johannes@gmx.at> Hi! I implemented the KMP search algorithm in [1] but I feel it doesn't get attention. Please apply [2] and test it. [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821 [2] https://bugs.freedesktop.org/attachment.cgi?id=36255 To be honest, the gain is small; I find it odd that the search function is page-based and runs per block (sorry, I'm new to poppler). It strikes me that no wrapped words can ever be found. Perhaps it would also make sense to put a '#pragma omp for' in front of the whole-document search? (For those not familiar with OpenMP, this simply parallizes the search over the available CPUs.) Cheers, Johannes -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From pino at kde.org Tue Jun 15 03:53:53 2010 From: pino at kde.org (Pino Toscano) Date: Tue, 15 Jun 2010 12:53:53 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100614033713.GA11727@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> Message-ID: <201006151253.58505.pino@kde.org> Hi, Alle luned? 14 giugno 2010, Guillermo Amaral ha scritto: > Anyway, I added the missing features to the reset form patch today, > check it out. Some more notes other than what Albert and Carlos said already: > +LinkResetForm::LinkResetForm(Object *obj) { > + Object obj1; > + > + fieldList = new GooList(); > + flags = 0; > + > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > + Object obj2; > + obj1.arrayGetNF(i, &obj2); > + fieldList->append(obj2.getString()->copy()); > + obj2.free(); > + } > + } else { > + error (-1, "Invalid ResetForm action"); > + delete fieldList; > + fieldList = NULL; > + } > + obj1.free(); > [...] > + // Was the LinkResetForm create successfully? > + virtual GBool isOk() { return fieldList != NULL; } Basically this code makes the action valid only if Fields is specified and valid, while that key is optional. > +class LinkFormActionPrivate : public LinkPrivate > +{ > + public: > + LinkFormActionPrivate( const QRectF &area, > LinkFormAction::ActionType actionType ); > + > + LinkFormAction::ActionType type; + const here > + bool LinkResetFormAction::isExcludeFieldList() const > + { > + Q_D( const LinkResetFormAction ); > + return (1 == (d->flags % 1)); Err, you mean 'd->flags & 1'? > @@ -182,7 +184,8 @@ class POPPLER_QT4_EXPORT Link > Action, ///< A "standard" action to be executed > in the viewer > Sound, ///< A link representing a sound to be > played > Movie, ///< An action to be executed on a movie > - JavaScript ///< A JavaScript code to be > interpreted \since 0.10 > + JavaScript, ///< A > JavaScript code to be interpreted \since 0.10 > + FormAction ///< A "form" action to be > executed in the viewer + \since 0.16 > @@ -484,6 +487,95 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link > }; > #endif > > +/** > + * \brief "Form" action request. > + * > + * The LinkFormAction class represents a link that request a "form" > action > + * to be performed by the viewer on the displayed document. > + */ as above, add \since 0.16 > +class POPPLER_QT4_EXPORT LinkFormAction : public Link > +{ > + public: > + /** > + * The possible types of actions > + */ > + enum ActionType { Submit = 1, > + Reset = 2, > + ImportData = 3 }; I'd use a slightly better name for the enum, like FormActionType. > + > + /** > + * The action of the current LinkFormAction > + */ > + ActionType actionType() const; likewise for the method naming > + /** > + * Create a new Action link, that executes a > specified action + * on the document. > + * > + * \param linkArea the active area of the link > + * \param actionType which action should be executed > + */ > + LinkFormAction( const QRectF &linkArea, ActionType > actionType ); I'd make this constructor protected, as LinkFormAction looks more an intermediate action type which has no sense used alone. > +/** > + * \brief "Form" action reset request. > + * > + * The LinkResetFormAction class represents a link that request a > "ResetForm" action > + * to be performed by the viewer on the displayed document. > + */ ... guess what? ;) > +class POPPLER_QT4_EXPORT LinkResetFormAction : public LinkFormAction > +{ > + public: > + typedef QList FieldList; Why not just a simple QStringList instead of this typedef? > + LinkResetFormAction( const QRectF &linkArea, const > FieldList &_fieldList, int _flags ); > [...] > + int flags() const; > [...] > + bool isExcludeFieldList() const; This looks a bit too "raw"... what I would do is something like: enum FormResetType { ResetAll, ResetIncluded, ResetExcluded } and then use only this enum in both constructor and method. Maybe ResetAll is not needed, stating in the apidox that you should check for the emptiness of the field list. -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 190 bytes Desc: This is a digitally signed message part. URL: From carlosgc at kemper.freedesktop.org Tue Jun 15 05:03:07 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Tue, 15 Jun 2010 05:03:07 -0700 (PDT) Subject: [poppler] 5 commits - glib/poppler-document.cc glib/poppler-page.cc Message-ID: <20100615120307.7A32410057@kemper.freedesktop.org> glib/poppler-document.cc | 9 ++---- glib/poppler-page.cc | 67 ++++++++++++++++------------------------------- 2 files changed, 26 insertions(+), 50 deletions(-) New commits: commit f035c94d8b5b34c0c3bb47b8cfc2f9c720a4fc71 Author: Carlos Garcia Campos Date: Tue Jun 15 14:01:07 2010 +0200 [glib] Use g_slice_dup in _copy() function for iterators diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index cd6794a..76a05a1 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -967,8 +967,7 @@ poppler_index_iter_copy (PopplerIndexIter *iter) g_return_val_if_fail (iter != NULL, NULL); - new_iter = g_slice_new (PopplerIndexIter); - *new_iter = *iter; + new_iter = g_slice_dup (PopplerIndexIter, iter); new_iter->document = (PopplerDocument *) g_object_ref (new_iter->document); return new_iter; @@ -1292,8 +1291,7 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter) g_return_val_if_fail (iter != NULL, NULL); - new_iter = g_slice_new (PopplerFontsIter); - *new_iter = *iter; + new_iter = g_slice_dup (PopplerFontsIter, iter); new_iter->items = new GooList (); for (int i = 0; i < iter->items->getLength(); i++) { @@ -1631,8 +1629,7 @@ poppler_layers_iter_copy (PopplerLayersIter *iter) g_return_val_if_fail (iter != NULL, NULL); - new_iter = g_slice_new (PopplerLayersIter); - *new_iter = *iter; + new_iter = g_slice_dup (PopplerLayersIter, iter); new_iter->document = (PopplerDocument *) g_object_ref (new_iter->document); return new_iter; commit c84f69681828c7e3b969f666f9b84f1531976c6f Author: Carlos Garcia Campos Date: Tue Jun 15 13:57:18 2010 +0200 [glib] Use g_slice for mappings and PopplerRectangle diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 6a3b3ab..14601a6 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1523,26 +1523,21 @@ POPPLER_DEFINE_BOXED_TYPE (PopplerRectangle, poppler_rectangle, PopplerRectangle * poppler_rectangle_new (void) { - return g_new0 (PopplerRectangle, 1); + return g_slice_new0 (PopplerRectangle); } PopplerRectangle * poppler_rectangle_copy (PopplerRectangle *rectangle) { - PopplerRectangle *new_rectangle; - g_return_val_if_fail (rectangle != NULL, NULL); - - new_rectangle = g_new (PopplerRectangle, 1); - *new_rectangle = *rectangle; - return new_rectangle; + return g_slice_dup (PopplerRectangle, rectangle); } void poppler_rectangle_free (PopplerRectangle *rectangle) { - g_free (rectangle); + g_slice_free (PopplerRectangle, rectangle); } /* PopplerColor type */ @@ -1579,7 +1574,7 @@ POPPLER_DEFINE_BOXED_TYPE (PopplerLinkMapping, poppler_link_mapping, PopplerLinkMapping * poppler_link_mapping_new (void) { - return (PopplerLinkMapping *) g_new0 (PopplerLinkMapping, 1); + return g_slice_new0 (PopplerLinkMapping); } PopplerLinkMapping * @@ -1587,9 +1582,8 @@ poppler_link_mapping_copy (PopplerLinkMapping *mapping) { PopplerLinkMapping *new_mapping; - new_mapping = poppler_link_mapping_new (); - - *new_mapping = *mapping; + new_mapping = g_slice_dup (PopplerLinkMapping, mapping); + if (new_mapping->action) new_mapping->action = poppler_action_copy (new_mapping->action); @@ -1602,7 +1596,7 @@ poppler_link_mapping_free (PopplerLinkMapping *mapping) if (mapping->action) poppler_action_free (mapping->action); - g_free (mapping); + g_slice_free (PopplerLinkMapping, mapping); } /* Poppler Image mapping type */ @@ -1613,25 +1607,19 @@ POPPLER_DEFINE_BOXED_TYPE (PopplerImageMapping, poppler_image_mapping, PopplerImageMapping * poppler_image_mapping_new (void) { - return (PopplerImageMapping *) g_new0 (PopplerImageMapping, 1); + return g_slice_new0 (PopplerImageMapping); } PopplerImageMapping * poppler_image_mapping_copy (PopplerImageMapping *mapping) { - PopplerImageMapping *new_mapping; - - new_mapping = poppler_image_mapping_new (); - - *new_mapping = *mapping; - - return new_mapping; + return g_slice_dup (PopplerImageMapping, mapping); } void poppler_image_mapping_free (PopplerImageMapping *mapping) { - g_free (mapping); + g_slice_free (PopplerImageMapping, mapping); } /* Page Transition */ @@ -1670,16 +1658,15 @@ POPPLER_DEFINE_BOXED_TYPE (PopplerFormFieldMapping, poppler_form_field_mapping, PopplerFormFieldMapping * poppler_form_field_mapping_new (void) { - return (PopplerFormFieldMapping *) g_new0 (PopplerFormFieldMapping, 1); + return g_slice_new0 (PopplerFormFieldMapping); } PopplerFormFieldMapping * poppler_form_field_mapping_copy (PopplerFormFieldMapping *mapping) { PopplerFormFieldMapping *new_mapping; - - new_mapping = poppler_form_field_mapping_new (); - *new_mapping = *mapping; + + new_mapping = g_slice_dup (PopplerFormFieldMapping, mapping); if (mapping->field) new_mapping->field = (PopplerFormField *)g_object_ref (mapping->field); @@ -1695,8 +1682,8 @@ poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping) if (mapping->field) g_object_unref (mapping->field); - - g_free (mapping); + + g_slice_free (PopplerFormFieldMapping, mapping); } /* PopplerAnnot Mapping Type */ @@ -1707,7 +1694,7 @@ POPPLER_DEFINE_BOXED_TYPE (PopplerAnnotMapping, poppler_annot_mapping, PopplerAnnotMapping * poppler_annot_mapping_new (void) { - return (PopplerAnnotMapping *) g_new0 (PopplerAnnotMapping, 1); + return g_slice_new0 (PopplerAnnotMapping); } PopplerAnnotMapping * @@ -1715,9 +1702,8 @@ poppler_annot_mapping_copy (PopplerAnnotMapping *mapping) { PopplerAnnotMapping *new_mapping; - new_mapping = poppler_annot_mapping_new (); + new_mapping = g_slice_dup (PopplerAnnotMapping, mapping); - *new_mapping = *mapping; if (mapping->annot) new_mapping->annot = (PopplerAnnot *) g_object_ref (mapping->annot); @@ -1733,7 +1719,7 @@ poppler_annot_mapping_free (PopplerAnnotMapping *mapping) if (mapping->annot) g_object_unref (mapping->annot); - g_free (mapping); + g_slice_free (PopplerAnnotMapping, mapping); } void commit e12b9ab105f3b56b47ded871693b939ed421c853 Author: Carlos Garcia Campos Date: Tue Jun 15 13:49:27 2010 +0200 [glib] Use poppler_image_mapping_free() instead of g_free() diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index fbfaf98..6a3b3ab 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1140,7 +1140,7 @@ poppler_page_free_image_mapping (GList *list) if (list == NULL) return; - g_list_foreach (list, (GFunc)g_free, NULL); + g_list_foreach (list, (GFunc)poppler_image_mapping_free, NULL); g_list_free (list); } commit fb791a15f7472042fb2174e6f5df6924dd4eeb9b Author: Carlos Garcia Campos Date: Tue Jun 15 13:37:52 2010 +0200 [glib] Remove poppler_mapping_free and use poppler_link_mapping_free instead diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 77f191a..fbfaf98 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1305,13 +1305,6 @@ poppler_page_get_link_mapping (PopplerPage *page) return map_list; } -static void -poppler_mapping_free (PopplerLinkMapping *mapping) -{ - poppler_action_free (mapping->action); - g_free (mapping); -} - /** * poppler_page_free_link_mapping: * @list: A list of #PopplerLinkMappings @@ -1327,7 +1320,7 @@ poppler_page_free_link_mapping (GList *list) if (list == NULL) return; - g_list_foreach (list, (GFunc) (poppler_mapping_free), NULL); + g_list_foreach (list, (GFunc)poppler_link_mapping_free, NULL); g_list_free (list); } commit 6186d7220e545eb89597626933a10acd0cd25173 Author: Carlos Garcia Campos Date: Tue Jun 15 13:16:59 2010 +0200 [glib] Use _new() methods instead of g_new() to create boxed structs diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 39645bd..77f191a 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -991,7 +991,7 @@ poppler_page_find_text (PopplerPage *page, gFalse, gFalse, // caseSensitive, backwards &xMin, &yMin, &xMax, &yMax)) { - match = g_new (PopplerRectangle, 1); + match = poppler_rectangle_new (); match->x1 = xMin; match->y1 = height - yMax; match->x2 = xMax; @@ -1061,7 +1061,7 @@ poppler_page_get_image_mapping (PopplerPage *page) image = out->getImage (i); /* Create the mapping */ - mapping = g_new (PopplerImageMapping, 1); + mapping = poppler_image_mapping_new (); image->getRect (&(mapping->area.x1), &(mapping->area.y1), &(mapping->area.x2), &(mapping->area.y2)); @@ -1257,7 +1257,7 @@ poppler_page_get_link_mapping (PopplerPage *page) link_action = link->getAction (); /* Create the mapping */ - mapping = g_new (PopplerLinkMapping, 1); + mapping = poppler_link_mapping_new (); mapping->action = _poppler_action_new (page->document, link_action, NULL); link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2); From pino at kde.org Tue Jun 15 05:08:48 2010 From: pino at kde.org (Pino Toscano) Date: Tue, 15 Jun 2010 14:08:48 +0200 Subject: [poppler] poppler Digest, Vol 64, Issue 9 In-Reply-To: References: Message-ID: <201006151408.54267.pino@kde.org> Hi, patches gets better, although there are still some things that can be improved: > + // Return the PDF ID contains in the trailer dictionary > + char** getID(); I still think we could just use inout parameters for the two strings, ie something like: void PDFDoc::getId(char id1[33], char id2[33]) char id1[33]; char id2[33]; doc->getId(id1, id2); what do the others think about this? > +static void > +get_id(char* encodedid,char *pdfid) { > + > + char buf[3]; > + for(int i=0;i<16;i++) { > + > + sprintf(buf,"%02x",encodedid[i] & 0xff); > + > + if(i == 0) strcpy(pdfid,buf); > + else strcat(pdfid,buf); > + } > +} Thinking further, this can be simplified a lot, eg: sprintf(pdfid, "%02x%02x%02x...", encodedid[0] & 0xff, encodedid[1] & 0xff, encodedid[2] & 0xff, [...] ); Yes, a bit longer, but much faster. > +GBool PDFDoc::setID() { > + > + char **pdfid = getID(); > + if(pdfid != NULL) return false; if pdfid != NULL then you are leaking it. > + else { > + char *filename = getFileName()->getCString(); You are relying on the fact that a PDFDoc was opened from a local file, so fileName (hence getFileName()) returns a non-NULL GooString. This is not always the case, so you must handle that situation. > + > + GooString message; > + char buffer[256]; 64 chars are more than enough... > + // file size > + unsigned int fileSize = 0; > + > + FILE *f; > + f = fopen(filename,"r"); > + char ch; > + while((ch=fgetc(f)) != EOF) { > + fileSize++; > + } This is a bit slow... A better way would be seeking to the end and see the position, falling back to this manual reading if the seek fails. > + if (!(f = fopen(filename,"r+"))) { > + error(-1, "Couldn't open file > '%s'",filename); > + } Same as above, this PDFDoc can also be constructed in other ways than from a physical file. > break; > + case PROP_PERMANENT_ID: > + char **pid; > + pid = document->doc->getID(); > + if(pid != NULL) { > + g_value_set_string(value,strdup(pid[0])); > + free(pid); The current getID() returns a pointer to an array of two char pointers. This means the free() will just delete the array of char*, but not the two actual char*. (Similar problem in other places.) > + "Permanent Id of the Pdf Document", > [...] > + "Update Id of the Pdf Document", "Pdf" -> "PDF" > + > +PopplerDocumentId* > +poppler_document_get_pdf_id (PopplerDocument *document) > +{ > + char **pid = document->doc->getID(); > + > + if(pid == NULL) { > + free(pid); > + return NULL; > + } > + else > + { > + PopplerDocumentId *doc_id = > g_new(PopplerDocumentId,1); > + strcpy(doc_id->permanent_id,strdup(pid[0])); > + strcpy(doc_id->update_id,strdup(pid[1])); pid[0] and pid[1] are the brand-new strings getID() returns, so you are duplicating them and then copying the new copies on the PopplerDocumentId fields; this mean the two intermediate strdup() are leaked. > +gboolean > +poppler_document_set_pdf_id (PopplerDocument *document) > +{ > + GBool boolean = document->doc->setID(); > + if(boolean) return TRUE; > + else return FALSE; > +} Easier: return document->doc->setID() ? TRUE : FALSE; (this is subject to Carlos' preference though) -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 190 bytes Desc: This is a digitally signed message part. URL: From carlosgc at kemper.freedesktop.org Tue Jun 15 05:21:33 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Tue, 15 Jun 2010 05:21:33 -0700 (PDT) Subject: [poppler] glib/poppler-action.cc Message-ID: <20100615122133.D7C7910057@kemper.freedesktop.org> glib/poppler-action.cc | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) New commits: commit 52f133fb962256edb577b7f639c5c13221c6365d Author: Carlos Garcia Campos Date: Tue Jun 15 14:20:49 2010 +0200 [glib] Use g_slice for actions and destinations diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index ffc1842..871d3cf 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -34,8 +34,7 @@ poppler_dest_copy (PopplerDest *dest) { PopplerDest *new_dest; - new_dest = g_new0 (PopplerDest, 1); - memcpy (new_dest, dest, sizeof (PopplerDest)); + new_dest = g_slice_dup (PopplerDest, dest); if (dest->named_dest) new_dest->named_dest = g_strdup (dest->named_dest); @@ -59,7 +58,7 @@ poppler_dest_free (PopplerDest *dest) if (dest->named_dest) g_free (dest->named_dest); - g_free (dest); + g_slice_free (PopplerDest, dest); } static void @@ -74,15 +73,14 @@ poppler_action_layer_free (PopplerActionLayer *action_layer) action_layer->layers = NULL; } - g_free (action_layer); + g_slice_free (PopplerActionLayer, action_layer); } static PopplerActionLayer * poppler_action_layer_copy (PopplerActionLayer *action_layer) { - PopplerActionLayer *retval = g_new (PopplerActionLayer, 1); + PopplerActionLayer *retval = g_slice_dup (PopplerActionLayer, action_layer); - retval->action = action_layer->action; retval->layers = g_list_copy (action_layer->layers); g_list_foreach (action_layer->layers, (GFunc)g_object_ref, NULL); @@ -141,7 +139,7 @@ poppler_action_free (PopplerAction *action) } g_free (action->any.title); - g_free (action); + g_slice_free (PopplerAction, action); } /** @@ -160,8 +158,7 @@ poppler_action_copy (PopplerAction *action) g_return_val_if_fail (action != NULL, NULL); /* Do a straight copy of the memory */ - new_action = g_new0 (PopplerAction, 1); - memcpy (new_action, action, sizeof (PopplerAction)); + new_action = g_slice_dup (PopplerAction, action); if (action->any.title != NULL) new_action->any.title = g_strdup (action->any.title); @@ -224,7 +221,7 @@ dest_new_goto (PopplerDocument *document, { PopplerDest *dest; - dest = g_new0 (PopplerDest, 1); + dest = g_slice_new0 (PopplerDest); if (link_dest == NULL) { dest->type = POPPLER_DEST_UNKNOWN; @@ -309,7 +306,7 @@ dest_new_named (GooString *named_dest) { PopplerDest *dest; - dest = g_new0 (PopplerDest, 1); + dest = g_slice_new0 (PopplerDest); if (named_dest == NULL) { dest->type = POPPLER_DEST_UNKNOWN; @@ -601,7 +598,7 @@ _poppler_action_new (PopplerDocument *document, { PopplerAction *action; - action = g_new0 (PopplerAction, 1); + action = g_slice_new0 (PopplerAction); if (title) action->any.title = g_strdup (title); From carlosgc at kemper.freedesktop.org Tue Jun 15 08:45:41 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Tue, 15 Jun 2010 08:45:41 -0700 (PDT) Subject: [poppler] glib/poppler-document.cc glib/poppler-page.cc Message-ID: <20100615154542.6AB4B10057@kemper.freedesktop.org> glib/poppler-document.cc | 12 ++++++------ glib/poppler-page.cc | 17 ++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) New commits: commit 25494311c5b8eb88d43df420ec91a1aedad20d05 Author: Carlos Garcia Campos Date: Tue Jun 15 17:44:23 2010 +0200 [glib] Add some G_UNLIKELY() diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 76a05a1..b265a34 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -1171,7 +1171,7 @@ poppler_index_iter_next (PopplerIndexIter *iter) void poppler_index_iter_free (PopplerIndexIter *iter) { - if (iter == NULL) + if (G_UNLIKELY (iter == NULL)) return; g_object_unref (iter->document); @@ -1305,7 +1305,7 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter) void poppler_fonts_iter_free (PopplerFontsIter *iter) { - if (iter == NULL) + if (G_UNLIKELY (iter == NULL)) return; deleteGooList (iter->items, FontInfo); @@ -1424,7 +1424,7 @@ layer_new (OptionalContentGroup *oc) static void layer_free (Layer *layer) { - if (!layer) + if (G_UNLIKELY (!layer)) return; if (layer->kids) { @@ -1589,8 +1589,8 @@ _poppler_document_get_layers (PopplerDocument *document) static void poppler_document_layers_free (PopplerDocument *document) { - if (!document->layers) - return; + if (G_UNLIKELY (!document->layers)) + return; g_list_foreach (document->layers, (GFunc)layer_free, NULL); g_list_free (document->layers); @@ -1644,7 +1644,7 @@ poppler_layers_iter_copy (PopplerLayersIter *iter) void poppler_layers_iter_free (PopplerLayersIter *iter) { - if (iter == NULL) + if (G_UNLIKELY (iter == NULL)) return; g_object_unref (iter->document); diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 14601a6..19ea941 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -891,7 +891,7 @@ poppler_page_get_selection_region (PopplerPage *page, void poppler_page_selection_region_free (GList *region) { - if (!region) + if (G_UNLIKELY (!region)) return; g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL); @@ -1137,7 +1137,7 @@ poppler_page_get_image (PopplerPage *page, void poppler_page_free_image_mapping (GList *list) { - if (list == NULL) + if (G_UNLIKELY (list == NULL)) return; g_list_foreach (list, (GFunc)poppler_image_mapping_free, NULL); @@ -1317,7 +1317,7 @@ poppler_page_get_link_mapping (PopplerPage *page) void poppler_page_free_link_mapping (GList *list) { - if (list == NULL) + if (G_UNLIKELY (list == NULL)) return; g_list_foreach (list, (GFunc)poppler_link_mapping_free, NULL); @@ -1380,7 +1380,7 @@ poppler_page_get_form_field_mapping (PopplerPage *page) void poppler_page_free_form_field_mapping (GList *list) { - if (list == NULL) + if (G_UNLIKELY (list == NULL)) return; g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL); @@ -1507,7 +1507,7 @@ poppler_page_get_annot_mapping (PopplerPage *page) void poppler_page_free_annot_mapping (GList *list) { - if (!list) + if (G_UNLIKELY (!list)) return; g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL); @@ -1593,6 +1593,9 @@ poppler_link_mapping_copy (PopplerLinkMapping *mapping) void poppler_link_mapping_free (PopplerLinkMapping *mapping) { + if (G_UNLIKELY (!mapping)) + return; + if (mapping->action) poppler_action_free (mapping->action); @@ -1677,7 +1680,7 @@ poppler_form_field_mapping_copy (PopplerFormFieldMapping *mapping) void poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping) { - if (!mapping) + if (G_UNLIKELY (!mapping)) return; if (mapping->field) @@ -1713,7 +1716,7 @@ poppler_annot_mapping_copy (PopplerAnnotMapping *mapping) void poppler_annot_mapping_free (PopplerAnnotMapping *mapping) { - if (!mapping) + if (G_UNLIKELY (!mapping)) return; if (mapping->annot) From aacid at kde.org Tue Jun 15 11:05:25 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 19:05:25 +0100 Subject: [poppler] KMP for search In-Reply-To: <20100615223716.8513ae9d.buchner.johannes@gmx.at> References: <20100615223716.8513ae9d.buchner.johannes@gmx.at> Message-ID: <201006151905.25318.aacid@kde.org> A Dimarts, 15 de juny de 2010, Johannes Buchner va escriure: > Hi! Hi > I implemented the KMP search algorithm in [1] but I feel it doesn't > get attention. Please apply [2] and test it. You sent a mail yesterday and already complain you are being ignored? > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821 > [2] https://bugs.freedesktop.org/attachment.cgi?id=36255 > > To be honest, the gain is small; If the gain is small i'd prefer to stay with our tested code than to switch to something totally new. > I find it odd that the search > function is page-based and runs per block (sorry, I'm new to poppler). > It strikes me that no wrapped words can ever be found. > > Perhaps it would also make sense to put a '#pragma omp for' in front of > the whole-document search? (For those not familiar with OpenMP, > this simply parallizes the search over the available CPUs.) I don't think depending on OpenMP is an option. Albert > > Cheers, > Johannes From carlosgc at gnome.org Tue Jun 15 11:44:50 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Tue, 15 Jun 2010 20:44:50 +0200 Subject: [poppler] Changes and possible api break in glib frontend for 0.16 Message-ID: <1276617261-sup-4132@charmaleon> Hi all, there are some planned changes and possible api breakages for this devel cycle that I would like to comment here. - The GDK api will be marked as deprecated for 0.16 and definitely removed in 0.17/0.18. In this moment GDK api is just a wrapper over the cairo one, so it doesn't make sense to depend on gdk just for that. - poppler_page_get_selection_region(). This method was already changed to return a GList * of PopplerRectangles instead of a GdkRegion when we made gdk an optional dependency. Now that gdk api is deprecated it probably makes sense to return a cairo_region_t * instead. The main problem is that cairo_region is cairo 1.10 api, so we need to trust it will be released on August as planned. - poppler_page_get_text(). This method is confusing, it receives a PopplerRectangle and PopplerSelectionStyle, so I think it might be renamed to poppler_page_get_selected_text(), since it actually returns the text contained in the selection contained in the given rectangle. Then we can add poppler_page_get_text() as convenient method to get the whole text of the page. - poppler_page_get_text_layout(). Daniel Garcia is already working on this. It returns an array of PopplerRectangles that are the bounding boxes of every character in the page. The array index is the character offset of the string returned by (the new) poppler_page_get_text(). - printing options. I would like to add a way to specify options when rendering for printing, like not rendering annotations. We could add an options parameter to poppler_page_render_for_printing() or maybe we can avoid breaking the api and just add poppler_page_render_for_printing_with_options(). - In PopplerDocument, linearized property is an string containing "Yes" or "No", it should be a boolean. I plan to add accessors for all properties in PopplerDocument and PopplerPage, to make properties easier to discover. - poppler_page_get_bounding_box(). This will be a new method that returns the effective bounding box of the page. It would allow viewers to implement fit-to-contents zoom as well as FitB* destinations. This needs cairo 1.10 (recording surface) - GObject introspection support. I think I don't forget anything. Comments? Objections? Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aacid at kde.org Tue Jun 15 13:23:06 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 21:23:06 +0100 Subject: [poppler] poppler Digest, Vol 64, Issue 9 In-Reply-To: <201006151408.54267.pino@kde.org> References: <201006151408.54267.pino@kde.org> Message-ID: <201006152123.06693.aacid@kde.org> A Dimarts, 15 de juny de 2010, Pino Toscano va escriure: > Hi, > > patches gets better, although there are still some things that can be > > improved: > > + // Return the PDF ID contains in the trailer dictionary > > + char** getID(); > > I still think we could just use inout parameters for the two strings, ie > something like: > > void PDFDoc::getId(char id1[33], char id2[33]) I'd prefer a solution not returning a char **, personally i think bool PDFDoc::getId(GooString *id1, GooString *id2); and GooString id1, id2; if (doc->getId(&id1, &id2)) { } is better since actually you are using GooStrings inside anyway. Agree mostly with other Pino comments. Albert From aacid at kde.org Tue Jun 15 14:20:03 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 22:20:03 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100614033713.GA11727@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> Message-ID: <201006152220.03167.aacid@kde.org> A Dilluns, 14 de juny de 2010, Guillermo Amaral va escriure: > On Sun, Jun 13, 2010 at 11:02:56PM +0100, Albert Astals Cid wrote: > > A Diumenge, 13 de juny de 2010, Guillermo Amaral va escriure: > > > On Sun, Jun 13, 2010 at 10:21:35AM +0200, Carlos Garcia Campos wrote: > > > > Excerpts from Guillermo Amaral's message of dom jun 13 04:40:44 +0200 > > > > 2010: > > > > > Albert Astals Cid wrote: > > > > > > A Dissabte, 12 de juny de 2010, Guillermo Amaral va escriure: > > > > > >> I wanted to send in these patches, they allow handling of > > > > > >> reset-form and print actions respectably. > > > > > >> > > > > > >> Please check them out, and if you have any questions please > > > > > >> don't hesitate to ask. > > > > > > > > > > > > Do you have a document that uses them? > > > > > > > > > > > I do, but I dunno if I can share them ATM, looking into it. > > > > > But I did make a test pdf that uses both features. :-) > > > > > > > > > > > Also what is the point of > > > > > > > > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > > + action = new LinkResetForm(obj2.getName()); > > > > > > > > > > > As usual, you are right aacid :) I try a little to hard not to > > > > > break the flow of other programs, I think I went to far lol > > > > > (fixed) > > > > > > > > > > > And > > > > > > if (obj->dictLookup("AA", &tmp)->isDict()) > > > > > > seems like an unrelated fix, can you please explain it too? > > > > > > > > > > > Mixed them up, that one should be in the print patch (moved). > > > > > Sometimes the AA dict is used to hold a ref to the named object. > > > > > I have seen it in two docs so far, it seems to happen when > > > > > people set an action to happen on mouse down instead of mouse > > > > > up. It should not break anything else (as far as I can see). > > > > > > > > We should definitely add support for additional actions properly in > > > > poppler. > > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > > index 5d7b779..e3d6ce7 100644 > > > > > --- a/poppler/Link.cc > > > > > +++ b/poppler/Link.cc > > > > > @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object > > > > > *obj, GooString *baseURI) { > > > > > > > > > > } else if (obj2.isName("SetOCGState")) { > > > > > > > > > > action = new LinkOCGState(obj); > > > > > > > > > > + // ResetForm action > > > > > + } else if (obj2.isName("ResetForm")) { > > > > > + action = new LinkResetForm(); > > > > > + > > > > > > > > > > // unknown action > > > > > } else if (obj2.isName()) { > > > > > > > > > > action = new LinkUnknown(obj2.getName()); > > > > > > > > > > @@ -856,6 +860,18 @@ LinkOCGState::StateList::~StateList() { > > > > > > > > > > } > > > > > > > > > > //---------------------------------------------------------------- > > > > > ---- ---- > > > > > > > > > > +// LinkFormClear > > > > > +//---------------------------------------------------------------- > > > > > ---- ---- + > > > > > +LinkResetForm::LinkResetForm() { > > > > > + action = new GooString("ResetForm"); > > > > > > > > this is redundant, you already know it's a LinkResetForm object. You > > > > should parse Fields and Flags here. > > > > > > > Yeah it's a partial patch, it allows the client to know it has to > > > reset.. I guess I could make it reset the fields in the fieldlist > > > here and just notify the client the form values have changed or > > > something? what do you guys think? > > > > > > As far as it being redundant T_T yep totally. but I do see that > > > the getAction() accessor returns said action GooString ptr, as I said > > > > > > before I don't want to rock the boat; I'm guessing that method is used > > > some place else so I don't want to take it out willy nilly. But I do > > > want to make it clear (if it's not totally obvious already) that I'm > > > not completely familiar with the popplers code. ;-) > > > > getAction() used somewhere? It's not virtual and you don't use it > > anywhere, so where is it going to be used? > > Mmm thought it was lol, dammit. > Anyway, I added the missing features to the reset form patch today, check > it out. > > Cheers, > GA Some more comments: + fieldList->append(obj2.getString()->copy()); you need to check obj2 is a string before doing this + if (obj->dictLookup("Flags", &obj1)->isNum()) { + flags = obj1.getInt(); + } Here you check for num but then getInt, you probably want to go with isInt Albert From pino at kemper.freedesktop.org Tue Jun 15 14:51:35 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 14:51:35 -0700 (PDT) Subject: [poppler] 2 commits - qt4/src Message-ID: <20100615215135.B1AED10057@kemper.freedesktop.org> qt4/src/poppler-annotation.cc | 3 +++ qt4/src/poppler-link.h | 3 ++- qt4/src/poppler-page.cc | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) New commits: commit 71ad18c3b6b73e23d71600d07ce00bdfaf0bef60 Author: Pino Toscano Date: Tue Jun 15 23:51:01 2010 +0200 [Qt4] recognize the 'Print' named action here too diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc index 98573c0..66715d5 100644 --- a/qt4/src/poppler-annotation.cc +++ b/qt4/src/poppler-annotation.cc @@ -1603,6 +1603,9 @@ void LinkAnnotation::store( QDomNode & node, QDomDocument & document ) const case Poppler::LinkAction::Close: hyperlinkElement.setAttribute( "action", "Close" ); break; + case Poppler::LinkAction::Print: + hyperlinkElement.setAttribute( "action", "Print" ); + break; } break; } commit 96f60f2748ba76de0d296a9838dbd7181f506e36 Author: Guillermo Amaral Date: Tue Jun 15 23:47:46 2010 +0200 [Qt4] recognize 'Print' as name in named actions diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 6d42cbe..48b558d 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -357,7 +357,8 @@ class POPPLER_QT4_EXPORT LinkAction : public Link EndPresentation = 9, Find = 10, GoToPage = 11, - Close = 12 }; + Close = 12, + Print = 13 }; /** * The action of the current LinkAction diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 6dbf50f..8aea6ce 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -129,6 +129,8 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo popplerLink = new LinkAction( linkArea, LinkAction::Find ); else if ( !strcmp( name, "FullScreen" ) ) popplerLink = new LinkAction( linkArea, LinkAction::Presentation ); + else if ( !strcmp( name, "Print" ) ) + popplerLink = new LinkAction( linkArea, LinkAction::Print ); else if ( !strcmp( name, "Close" ) ) { // acroread closes the document always, doesnt care whether From pino at kemper.freedesktop.org Tue Jun 15 14:54:15 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 14:54:15 -0700 (PDT) Subject: [poppler] qt4/src Message-ID: <20100615215415.3630410057@kemper.freedesktop.org> qt4/src/poppler-link.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) New commits: commit b54e5ac49f69bd1c906e517edcb436e042199cd5 Author: Pino Toscano Date: Tue Jun 15 23:53:50 2010 +0200 [Qt4/apidox] add the proper version for the new 'Print' diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 48b558d..ffb2564 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -358,7 +358,8 @@ class POPPLER_QT4_EXPORT LinkAction : public Link Find = 10, GoToPage = 11, Close = 12, - Print = 13 }; + Print = 13 ///< \since 0.14 + }; /** * The action of the current LinkAction From pino at kemper.freedesktop.org Tue Jun 15 14:56:17 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 14:56:17 -0700 (PDT) Subject: [poppler] qt4/src Message-ID: <20100615215617.2A7C610057@kemper.freedesktop.org> qt4/src/poppler-link.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) New commits: commit 8b32c3e9826d4462fd9d16fab4200ebb23251046 Author: Pino Toscano Date: Tue Jun 15 23:55:01 2010 +0200 [Qt4/apidox] ok, now the *proper* version for 'Print'... diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index ffb2564..2e38c9e 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -358,7 +358,7 @@ class POPPLER_QT4_EXPORT LinkAction : public Link Find = 10, GoToPage = 11, Close = 12, - Print = 13 ///< \since 0.14 + Print = 13 ///< \since 0.16 }; /** From aacid at kemper.freedesktop.org Tue Jun 15 14:57:18 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 14:57:18 -0700 (PDT) Subject: [poppler] splash/Splash.cc Message-ID: <20100615215718.C9BC910057@kemper.freedesktop.org> splash/Splash.cc | 6 ++++++ 1 file changed, 6 insertions(+) New commits: commit 9838edf8c7497858e3bac2743784a3259f61cfdd Author: Albert Astals Cid Date: Tue Jun 15 22:54:34 2010 +0100 Protect us against negative y coordinates Happens very rarely, like in bug 28480 diff --git a/splash/Splash.cc b/splash/Splash.cc index 8b11583..bea4706 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -42,6 +42,9 @@ #include "SplashGlyphBitmap.h" #include "Splash.h" +// to get the unlikely definition +#include "Object.h" + //------------------------------------------------------------------------ // distance of Bezier control point from center for circle approximation @@ -646,6 +649,9 @@ inline void Splash::pipeIncX(SplashPipe *pipe) { } inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) { + if (unlikely(y < 0)) + return; + if (noClip || state->clip->test(x, y)) { pipeSetXY(pipe, x, y); pipeRun(pipe); From aacid at kemper.freedesktop.org Tue Jun 15 14:58:17 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 14:58:17 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - splash/Splash.cc Message-ID: <20100615215817.D272C10057@kemper.freedesktop.org> splash/Splash.cc | 6 ++++++ 1 file changed, 6 insertions(+) New commits: commit 288ca37b907d6dfaee9bff244bb591429558d8f5 Author: Albert Astals Cid Date: Tue Jun 15 22:54:34 2010 +0100 Protect us against negative y coordinates Happens very rarely, like in bug 28480 diff --git a/splash/Splash.cc b/splash/Splash.cc index 8b11583..bea4706 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -42,6 +42,9 @@ #include "SplashGlyphBitmap.h" #include "Splash.h" +// to get the unlikely definition +#include "Object.h" + //------------------------------------------------------------------------ // distance of Bezier control point from center for circle approximation @@ -646,6 +649,9 @@ inline void Splash::pipeIncX(SplashPipe *pipe) { } inline void Splash::drawPixel(SplashPipe *pipe, int x, int y, GBool noClip) { + if (unlikely(y < 0)) + return; + if (noClip || state->clip->test(x, y)) { pipeSetXY(pipe, x, y); pipeRun(pipe); From aacid at kemper.freedesktop.org Tue Jun 15 15:06:19 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 15:06:19 -0700 (PDT) Subject: [poppler] goo/GooLikely.h goo/Makefile.am poppler/Object.h splash/Splash.cc Message-ID: <20100615220619.84B1810057@kemper.freedesktop.org> goo/GooLikely.h | 22 ++++++++++++++++++++++ goo/Makefile.am | 1 + poppler/Object.h | 9 +-------- splash/Splash.cc | 4 +--- 4 files changed, 25 insertions(+), 11 deletions(-) New commits: commit 38bf54bbad40288be763c6a1a89d90477c9ef89d Author: Albert Astals Cid Date: Tue Jun 15 23:05:43 2010 +0100 move the declaration of likely/unlikely to an own file in goo/ diff --git a/goo/GooLikely.h b/goo/GooLikely.h new file mode 100644 index 0000000..724ccf0 --- /dev/null +++ b/goo/GooLikely.h @@ -0,0 +1,22 @@ +//======================================================================== +// +// GooLikely.h +// +// This file is licensed under the GPLv2 or later +// +// Copyright (C) 2008 Kees Cook +// +//======================================================================== + +#ifndef GOOLIKELY_H +#define GOOLIKELY_H + +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif + +#endif diff --git a/goo/Makefile.am b/goo/Makefile.am index 39d2683..e15c7ac 100644 --- a/goo/Makefile.am +++ b/goo/Makefile.am @@ -17,6 +17,7 @@ poppler_goo_include_HEADERS = \ PNGWriter.h \ JpegWriter.h \ ImgWriter.h \ + GooLikely.h \ gstrtod.h endif diff --git a/poppler/Object.h b/poppler/Object.h index 2b9f20c..3038d0c 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -35,16 +35,9 @@ #include "goo/gtypes.h" #include "goo/gmem.h" #include "goo/GooString.h" +#include "goo/GooLikely.h" #include "Error.h" -#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) -# define likely(x) __builtin_expect((x), 1) -# define unlikely(x) __builtin_expect((x), 0) -#else -# define likely(x) (x) -# define unlikely(x) (x) -#endif - #define OBJECT_TYPE_CHECK(wanted_type) \ if (unlikely(type != wanted_type)) { \ error(0, (char *) "Call to Object where the object was type %d, " \ diff --git a/splash/Splash.cc b/splash/Splash.cc index bea4706..562c7cc 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -29,6 +29,7 @@ #include #include #include "goo/gmem.h" +#include "goo/GooLikely.h" #include "SplashErrorCodes.h" #include "SplashMath.h" #include "SplashBitmap.h" @@ -42,9 +43,6 @@ #include "SplashGlyphBitmap.h" #include "Splash.h" -// to get the unlikely definition -#include "Object.h" - //------------------------------------------------------------------------ // distance of Bezier control point from center for circle approximation From pino at kemper.freedesktop.org Tue Jun 15 15:15:34 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 15:15:34 -0700 (PDT) Subject: [poppler] qt4/src Message-ID: <20100615221534.58B6710057@kemper.freedesktop.org> qt4/src/poppler-link.h | 3 ++- qt4/src/poppler-page.cc | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) New commits: commit 2ba752aabc8dad4bb35a351697b1590795c54ca4 Author: Pino Toscano Date: Wed Jun 16 00:06:30 2010 +0200 update copyrights diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 2e38c9e..1aa6d78 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -1,6 +1,7 @@ /* poppler-link.h: qt interface to poppler * Copyright (C) 2006, Albert Astals Cid - * Copyright (C) 2007-2008, Pino Toscano + * Copyright (C) 2007-2008, 2010, Pino Toscano + * Copyright (C) 2010, Guillermo Amaral * Adapting code from * Copyright (C) 2004 by Enrico Ros * diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index 8aea6ce..ae67b11 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -6,6 +6,7 @@ * Copyright (C) 2006-2010, Pino Toscano * Copyright (C) 2008 Carlos Garcia Campos * Copyright (C) 2009 Shawn Rutledge + * Copyright (C) 2010, Guillermo Amaral * * 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 From aacid at kde.org Tue Jun 15 15:18:06 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 15 Jun 2010 23:18:06 +0100 Subject: [poppler] Accessibility of PDF documents (patch attached) In-Reply-To: References: Message-ID: <201006152318.07163.aacid@kde.org> A Dimarts, 15 de juny de 2010, leena chourey va escriure: > Dear developers, > > The poppler patch is attached related with "accessibility of pdf document", > please check it and give your feedback. Hi, some comments: * when i apply your patch the code doesn't compile /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc: In member function ?GooString* HtmlFontAccu::CSStyle(int, int)?: /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc:359: error: ?jstr? was not declared in this scope After fixing that, the code does not compile again /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function ?void HtmlPage::dumpAsXML(FILE*, int)?: /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:753: error: no matching function for call to ?HtmlFontAccu::getCSStyle(int&, GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, GooString*) /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function ?void HtmlPage::dumpComplex(FILE*, int)?: /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:837: error: no matching function for call to ?HtmlFontAccu::getCSStyle(int&, GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, GooString*) So i'd appreciate a patch that builds, after that we can start speaking about the functionality/code quailty, etc. Albert > > On Mon, Jun 14, 2010 at 12:44 PM, leena chourey wrote: > > Dear Albert, > > > > Thanks for responding. > > The poppler patch related with our changes will be submitted soon to > > poppler developers for feedback. > > > > with regards > > Leena > > > > On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid wrote: > >> A Divendres, 11 de juny de 2010, leena chourey va escriure: > >> > Dear all, > >> > > >> > This is in continuation to our last communication related with > >> > *Accessibility of Pdf document.* As discussed last time, we have now > >> > completed the first prototype version of the same and we are making it > >> > available for your testing and valuable comments/feedback. As > >> > mentioned last time, we convert the PDF file into HTML format and > >> > open the same automatically in Firefox. > >> > > >> > Enclosed with this email is the ReadMe file which explains the steps > >> > to download, install and run this enhancement. Please try out the > >> > same and give us your valuable feedback. > >> > > >> > > >> > We have tested it at our end by different teams and have found that it > >> > works well in most cases. Some places where we feel work is required > >> > are > >> > > >> > as follows: > >> > - Sometimes Orca in not able to read header and footer of page > >> > - Some character combinations are displayed as garbage like 'ft', > >> > >> 'tt' > >> > >> > - Content in table format is spoken by orca but it does not say the > >> > >> row > >> > >> > and column reference. Means a user can not find out that orca is > >> > >> reading > >> > >> > table content. (as orca does table reading in openoffice writer) > >> > > >> > We are working on these. Waiting to hear more from all. > >> > >> Quick question, do you have any patches on top of the poppler you use? > >> > >> Albert > >> > >> > With regards > >> > Leena C > >> > >> _______________________________________________ > >> poppler mailing list > >> poppler at lists.freedesktop.org > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > -- > > Leena C > > Thanks & Regards From pino at kemper.freedesktop.org Tue Jun 15 15:18:34 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 15:18:34 -0700 (PDT) Subject: [poppler] CMakeLists.txt Message-ID: <20100615221834.4759B10057@kemper.freedesktop.org> CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) New commits: commit 53c003f36af5d77f50fe238eaec4c5f7c3a485c7 Author: Pino Toscano Date: Wed Jun 16 00:18:13 2010 +0200 [CMake] install the new goo/GooLikely.h diff --git a/CMakeLists.txt b/CMakeLists.txt index cf8a47a..746a9f8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -449,6 +449,7 @@ if(ENABLE_XPDF_HEADERS) goo/gfile.h goo/FixedPoint.h goo/ImgWriter.h + goo/GooLikely.h goo/gstrtod.h DESTINATION include/poppler/goo) if(PNG_FOUND) From pino at kemper.freedesktop.org Tue Jun 15 15:23:29 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Tue, 15 Jun 2010 15:23:29 -0700 (PDT) Subject: [poppler] qt4/src Message-ID: <20100615222329.5B60510057@kemper.freedesktop.org> qt4/src/poppler-annotation.cc | 2 ++ 1 file changed, 2 insertions(+) New commits: commit 6e9fe8832c37b560ac4d0b0e32d618bde70ee117 Author: Pino Toscano Date: Wed Jun 16 00:22:59 2010 +0200 [Qt4] and support 'Print' named action here too... diff --git a/qt4/src/poppler-annotation.cc b/qt4/src/poppler-annotation.cc index 66715d5..88a3f99 100644 --- a/qt4/src/poppler-annotation.cc +++ b/qt4/src/poppler-annotation.cc @@ -1477,6 +1477,8 @@ LinkAnnotation::LinkAnnotation( const QDomNode & node ) act = Poppler::LinkAction::GoToPage; else if ( actString == "Close" ) act = Poppler::LinkAction::Close; + else if ( actString == "Print" ) + act = Poppler::LinkAction::Print; else found = false; if (found) From onkarpotdar at gmail.com Tue Jun 15 22:30:18 2010 From: onkarpotdar at gmail.com (omkar) Date: Wed, 16 Jun 2010 11:00:18 +0530 Subject: [poppler] Accessibility of PDF documents (corrected patch attached) Message-ID: Dear Albert, Please find the corrected patch for "accessibility of pdf document " and give your feedback. Thanks & regards Onkar (for CDAC Accessibility Team) On Wed, Jun 16, 2010 at 3:48 AM, Albert Astals Cid wrote: > A Dimarts, 15 de juny de 2010, leena chourey va escriure: > > Dear developers, > > > > The poppler patch is attached related with "accessibility of pdf > document", > > please check it and give your feedback. > > Hi, some comments: > * when i apply your patch the code doesn't compile > > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc: In member function > ?GooString* > HtmlFontAccu::CSStyle(int, int)?: > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc:359: error: ?jstr? was not > declared in this scope > > After fixing that, the code does not compile again > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > ?void > HtmlPage::dumpAsXML(FILE*, int)?: > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:753: error: no matching > function for call to ?HtmlFontAccu::getCSStyle(int&, GooString*&)? > /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: candidates are: > GooString* HtmlFontAccu::getCSStyle(int, int, GooString*) > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > ?void > HtmlPage::dumpComplex(FILE*, int)?: > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:837: error: no matching > function for call to ?HtmlFontAccu::getCSStyle(int&, GooString*&)? > /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: candidates are: > GooString* HtmlFontAccu::getCSStyle(int, int, GooString*) > > > So i'd appreciate a patch that builds, after that we can start speaking > about > the functionality/code quailty, etc. > > Albert > > > > > On Mon, Jun 14, 2010 at 12:44 PM, leena chourey > wrote: > > > Dear Albert, > > > > > > Thanks for responding. > > > The poppler patch related with our changes will be submitted soon to > > > poppler developers for feedback. > > > > > > with regards > > > Leena > > > > > > On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid > wrote: > > >> A Divendres, 11 de juny de 2010, leena chourey va escriure: > > >> > Dear all, > > >> > > > >> > This is in continuation to our last communication related with > > >> > *Accessibility of Pdf document.* As discussed last time, we have now > > >> > completed the first prototype version of the same and we are making > it > > >> > available for your testing and valuable comments/feedback. As > > >> > mentioned last time, we convert the PDF file into HTML format and > > >> > open the same automatically in Firefox. > > >> > > > >> > Enclosed with this email is the ReadMe file which explains the steps > > >> > to download, install and run this enhancement. Please try out the > > >> > same and give us your valuable feedback. > > >> > > > >> > > > >> > We have tested it at our end by different teams and have found that > it > > >> > works well in most cases. Some places where we feel work is required > > >> > are > > >> > > > >> > as follows: > > >> > - Sometimes Orca in not able to read header and footer of page > > >> > - Some character combinations are displayed as garbage like 'ft', > > >> > > >> 'tt' > > >> > > >> > - Content in table format is spoken by orca but it does not say > the > > >> > > >> row > > >> > > >> > and column reference. Means a user can not find out that orca is > > >> > > >> reading > > >> > > >> > table content. (as orca does table reading in openoffice writer) > > >> > > > >> > We are working on these. Waiting to hear more from all. > > >> > > >> Quick question, do you have any patches on top of the poppler you use? > > >> > > >> Albert > > >> > > >> > With regards > > >> > Leena C > > >> > > >> _______________________________________________ > > >> poppler mailing list > > >> poppler at lists.freedesktop.org > > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > -- > > > Leena C > > > > Thanks & Regards > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-By-CDAC-Developers_accesspdf.patch Type: text/x-diff Size: 7632 bytes Desc: not available URL: From buchner.johannes at gmx.at Tue Jun 15 22:48:39 2010 From: buchner.johannes at gmx.at (Johannes Buchner) Date: Wed, 16 Jun 2010 17:48:39 +1200 Subject: [poppler] KMP for search In-Reply-To: <201006151905.25318.aacid@kde.org> References: <20100615223716.8513ae9d.buchner.johannes@gmx.at> <201006151905.25318.aacid@kde.org> Message-ID: <20100616174839.dcf5a0be.buchner.johannes@gmx.at> Hi On Tue, 15 Jun 2010 19:05:25 +0100 Albert Astals Cid wrote: > > I implemented the KMP search algorithm in [1] but I feel it doesn't > > get attention. Please apply [2] and test it. > > You sent a mail yesterday and already complain you are being ignored? No, I added the patch the day before, and since only 3 adresses are notified about it, I thought it would be worth mentioning on the mailing list aswell. > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821 > > [2] https://bugs.freedesktop.org/attachment.cgi?id=36255 > > > > To be honest, the gain is small; > > If the gain is small i'd prefer to stay with our tested code than to > switch to something totally new. I understand where you're coming from; I've seen a improvement of factor 3 for certain cases, and I've never seen a lower speed compared to the naive implementation. It shows that the factors of O(n*m) are comparable to the factors of the new O(n). So it has a gain. I tested the KMP code with several instances before integrating it into poppler, and afterwards using the glib-demo program. The code is not "totally new" in the sense that KMP is old, and I kept to implementations I found on the web. The change [1] is small (~10 lines changed plus two new functions), although the additional indentation level makes it look bigger. https://bugs.freedesktop.org/review?bug=8821&attachment=36292 So, yes, I think it should go in. > > I find it odd that the search > > function is page-based and runs per block (sorry, I'm new to > > poppler). It strikes me that no wrapped words can ever be found. -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From taneraruk at gmail.com Wed Jun 16 01:51:45 2010 From: taneraruk at gmail.com (Taner ARUK) Date: Wed, 16 Jun 2010 11:51:45 +0300 Subject: [poppler] compile Poppler with windows Message-ID: Hi, I can't compile poppler with windows. I use visual studio 2008, is there any where compiled version of poppler and how can i find it?... Thanks. -------------- next part -------------- An HTML attachment was scrubbed... URL: From srinivas.adicherla at gmail.com Wed Jun 16 02:00:28 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Wed, 16 Jun 2010 14:30:28 +0530 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary Message-ID: Hi, Considering the suggestions from all I made a new patch for getting/setting the pdf ID. Please find the new patch attached new patch with this mail. I need suggestions from all. Please let me know when you commit this patch. -- Thanks & regards A srinivas -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler_api.patch Type: text/x-patch Size: 7315 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler.patch Type: text/x-patch Size: 7683 bytes Desc: not available URL: From srinivas.adicherla at gmail.com Wed Jun 16 02:52:17 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Wed, 16 Jun 2010 15:22:17 +0530 Subject: [poppler] poppler Digest, Vol 64, Issue 23 In-Reply-To: References: Message-ID: Hi Carlos Garcia Campos, You mentioned about the new function "poppler_page_get_bounding_box()". It returns the effective bounding box of the page. What do you mean by effective bounding box? Is it the page bounding box excluding the margins on left,right,top,bottom ? If So, I am also trying the same thing for getting the bounding box of the page. I need some suggestions. Iam doing something like this 1) we have the way to get the TextBlocks bounding boxes from the TextOutPutDev file. Taking the minX,minY,maxX,maxY of all TextBlocks bounding box will give the page bounding box excluding margins. But some pdf files having Graphic Streams at the start and end of the pages. For those pages it wil not give the correct bounding box. Give me any ideas how to do those. 2) In poppler_page_get_image_mapping() it will give the starting (x,y) co-ordinates and width,height of the image. But how do we know scaling factor of the image stored in the file. ( this is for all) Thanks & Regards -- A Srinivas On Wed, Jun 16, 2010 at 12:30 AM, wrote: > Send poppler mailing list submissions to > poppler at lists.freedesktop.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freedesktop.org/mailman/listinfo/poppler > or, via email, send a message with subject or body 'help' to > poppler-request at lists.freedesktop.org > > You can reach the person managing the list at > poppler-owner at lists.freedesktop.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of poppler digest..." > > > Today's Topics: > > 1. glib/poppler-document.cc glib/poppler-page.cc > (Carlos Garcia Campos) > 2. Re: KMP for search (Albert Astals Cid) > 3. Changes and possible api break in glib frontend for 0.16 > (Carlos Garcia Campos) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Tue, 15 Jun 2010 08:45:41 -0700 (PDT) > From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) > Subject: [poppler] glib/poppler-document.cc glib/poppler-page.cc > To: poppler at lists.freedesktop.org > Message-ID: <20100615154542.6AB4B10057 at kemper.freedesktop.org> > > glib/poppler-document.cc | 12 ++++++------ > glib/poppler-page.cc | 17 ++++++++++------- > 2 files changed, 16 insertions(+), 13 deletions(-) > > New commits: > commit 25494311c5b8eb88d43df420ec91a1aedad20d05 > Author: Carlos Garcia Campos > Date: Tue Jun 15 17:44:23 2010 +0200 > > [glib] Add some G_UNLIKELY() > > diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc > index 76a05a1..b265a34 100644 > --- a/glib/poppler-document.cc > +++ b/glib/poppler-document.cc > @@ -1171,7 +1171,7 @@ poppler_index_iter_next (PopplerIndexIter *iter) > void > poppler_index_iter_free (PopplerIndexIter *iter) > { > - if (iter == NULL) > + if (G_UNLIKELY (iter == NULL)) > return; > > g_object_unref (iter->document); > @@ -1305,7 +1305,7 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter) > void > poppler_fonts_iter_free (PopplerFontsIter *iter) > { > - if (iter == NULL) > + if (G_UNLIKELY (iter == NULL)) > return; > > deleteGooList (iter->items, FontInfo); > @@ -1424,7 +1424,7 @@ layer_new (OptionalContentGroup *oc) > static void > layer_free (Layer *layer) > { > - if (!layer) > + if (G_UNLIKELY (!layer)) > return; > > if (layer->kids) { > @@ -1589,8 +1589,8 @@ _poppler_document_get_layers (PopplerDocument > *document) > static void > poppler_document_layers_free (PopplerDocument *document) > { > - if (!document->layers) > - return; > + if (G_UNLIKELY (!document->layers)) > + return; > > g_list_foreach (document->layers, (GFunc)layer_free, NULL); > g_list_free (document->layers); > @@ -1644,7 +1644,7 @@ poppler_layers_iter_copy (PopplerLayersIter *iter) > void > poppler_layers_iter_free (PopplerLayersIter *iter) > { > - if (iter == NULL) > + if (G_UNLIKELY (iter == NULL)) > return; > > g_object_unref (iter->document); > diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc > index 14601a6..19ea941 100644 > --- a/glib/poppler-page.cc > +++ b/glib/poppler-page.cc > @@ -891,7 +891,7 @@ poppler_page_get_selection_region (PopplerPage > *page, > void > poppler_page_selection_region_free (GList *region) > { > - if (!region) > + if (G_UNLIKELY (!region)) > return; > > g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL); > @@ -1137,7 +1137,7 @@ poppler_page_get_image (PopplerPage *page, > void > poppler_page_free_image_mapping (GList *list) > { > - if (list == NULL) > + if (G_UNLIKELY (list == NULL)) > return; > > g_list_foreach (list, (GFunc)poppler_image_mapping_free, NULL); > @@ -1317,7 +1317,7 @@ poppler_page_get_link_mapping (PopplerPage *page) > void > poppler_page_free_link_mapping (GList *list) > { > - if (list == NULL) > + if (G_UNLIKELY (list == NULL)) > return; > > g_list_foreach (list, (GFunc)poppler_link_mapping_free, NULL); > @@ -1380,7 +1380,7 @@ poppler_page_get_form_field_mapping (PopplerPage > *page) > void > poppler_page_free_form_field_mapping (GList *list) > { > - if (list == NULL) > + if (G_UNLIKELY (list == NULL)) > return; > > g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL); > @@ -1507,7 +1507,7 @@ poppler_page_get_annot_mapping (PopplerPage *page) > void > poppler_page_free_annot_mapping (GList *list) > { > - if (!list) > + if (G_UNLIKELY (!list)) > return; > > g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL); > @@ -1593,6 +1593,9 @@ poppler_link_mapping_copy (PopplerLinkMapping > *mapping) > void > poppler_link_mapping_free (PopplerLinkMapping *mapping) > { > + if (G_UNLIKELY (!mapping)) > + return; > + > if (mapping->action) > poppler_action_free (mapping->action); > > @@ -1677,7 +1680,7 @@ poppler_form_field_mapping_copy > (PopplerFormFieldMapping *mapping) > void > poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping) > { > - if (!mapping) > + if (G_UNLIKELY (!mapping)) > return; > > if (mapping->field) > @@ -1713,7 +1716,7 @@ poppler_annot_mapping_copy (PopplerAnnotMapping > *mapping) > void > poppler_annot_mapping_free (PopplerAnnotMapping *mapping) > { > - if (!mapping) > + if (G_UNLIKELY (!mapping)) > return; > > if (mapping->annot) > > > ------------------------------ > > Message: 2 > Date: Tue, 15 Jun 2010 19:05:25 +0100 > From: Albert Astals Cid > Subject: Re: [poppler] KMP for search > To: poppler at lists.freedesktop.org > Message-ID: <201006151905.25318.aacid at kde.org> > Content-Type: Text/Plain; charset="us-ascii" > > A Dimarts, 15 de juny de 2010, Johannes Buchner va escriure: > > Hi! > > Hi > > > I implemented the KMP search algorithm in [1] but I feel it doesn't > > get attention. Please apply [2] and test it. > > You sent a mail yesterday and already complain you are being ignored? > > > > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821 > > [2] https://bugs.freedesktop.org/attachment.cgi?id=36255 > > > > To be honest, the gain is small; > > If the gain is small i'd prefer to stay with our tested code than to switch > to > something totally new. > > > I find it odd that the search > > function is page-based and runs per block (sorry, I'm new to poppler). > > It strikes me that no wrapped words can ever be found. > > > > Perhaps it would also make sense to put a '#pragma omp for' in front of > > the whole-document search? (For those not familiar with OpenMP, > > this simply parallizes the search over the available CPUs.) > > I don't think depending on OpenMP is an option. > > Albert > > > > > Cheers, > > Johannes > > > ------------------------------ > > Message: 3 > Date: Tue, 15 Jun 2010 20:44:50 +0200 > From: Carlos Garcia Campos > Subject: [poppler] Changes and possible api break in glib frontend for > 0.16 > To: poppler > Message-ID: <1276617261-sup-4132 at charmaleon> > Content-Type: text/plain; charset="utf8" > > Hi all, > > there are some planned changes and possible api breakages for this > devel cycle that I would like to comment here. > > - The GDK api will be marked as deprecated for 0.16 and definitely > removed in 0.17/0.18. In this moment GDK api is just a wrapper over > the cairo one, so it doesn't make sense to depend on gdk just for > that. > > - poppler_page_get_selection_region(). This method was already > changed to return a GList * of PopplerRectangles instead of a > GdkRegion when we made gdk an optional dependency. Now that gdk > api is deprecated it probably makes sense to return a cairo_region_t > * instead. The main problem is that cairo_region is cairo 1.10 api, so > we need to trust it will be released on August as planned. > > - poppler_page_get_text(). This method is confusing, it receives a > PopplerRectangle and PopplerSelectionStyle, so I think it might be > renamed to poppler_page_get_selected_text(), since it actually > returns the text contained in the selection contained in the given > rectangle. Then we can add poppler_page_get_text() as convenient > method to get the whole text of the page. > > - poppler_page_get_text_layout(). Daniel Garcia is already working on > this. It returns an array of PopplerRectangles that are the bounding > boxes of every character in the page. The array index is the > character offset of the string returned by (the new) > poppler_page_get_text(). > > - printing options. I would like to add a way to specify options when > rendering for printing, like not rendering annotations. We could add > an options parameter to poppler_page_render_for_printing() or maybe > we can avoid breaking the api and just add > poppler_page_render_for_printing_with_options(). > > - In PopplerDocument, linearized property is an string containing > "Yes" or "No", it should be a boolean. I plan to add accessors for > all properties in PopplerDocument and PopplerPage, to make properties > easier to discover. > > - poppler_page_get_bounding_box(). This will be a new method that > returns the effective bounding box of the page. It would allow > viewers to implement fit-to-contents zoom as well as FitB* > destinations. This needs cairo 1.10 (recording surface) > > - GObject introspection support. > > I think I don't forget anything. Comments? Objections? > > Regards, > -- > Carlos Garcia Campos > PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 > -------------- next part -------------- > A non-text attachment was scrubbed... > Name: signature.asc > Type: application/pgp-signature > Size: 198 bytes > Desc: not available > URL: < > http://lists.freedesktop.org/archives/poppler/attachments/20100615/2994e31e/attachment-0001.pgp > > > > ------------------------------ > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > > > End of poppler Digest, Vol 64, Issue 23 > *************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: From carlosgc at kemper.freedesktop.org Wed Jun 16 02:56:15 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Wed, 16 Jun 2010 02:56:15 -0700 (PDT) Subject: [poppler] 2 commits - glib/demo glib/poppler-page.cc glib/poppler-page.h Message-ID: <20100616095615.869E510057@kemper.freedesktop.org> glib/demo/text.c | 182 +++++++++++++++++++++++++++++++++++++++++++++------ glib/poppler-page.cc | 91 +++++++++++++++++++++++++ glib/poppler-page.h | 4 - 3 files changed, 258 insertions(+), 19 deletions(-) New commits: commit 35e87d2062b1d82db0d765de5a6187122a0fa99c Author: Carlos Garcia Campos Date: Wed Jun 16 11:52:25 2010 +0200 [gib-demo] Add demo for poppler_page_get_text_layout() diff --git a/glib/demo/text.c b/glib/demo/text.c index e119082..b7a5c91 100644 --- a/glib/demo/text.c +++ b/glib/demo/text.c @@ -20,11 +20,22 @@ #include "text.h" +enum { + TEXT_X1_COLUMN, + TEXT_Y1_COLUMN, + TEXT_X2_COLUMN, + TEXT_Y2_COLUMN, + TEXT_OFFSET_COLUMN, + TEXT_OFFPTR_COLUMN, + N_COLUMNS +}; + typedef struct { PopplerDocument *doc; GtkWidget *timer_label; GtkTextBuffer *buffer; + GtkListStore *model; gint page; } PgdTextDemo; @@ -45,6 +56,11 @@ pgd_text_free (PgdTextDemo *demo) demo->buffer = NULL; } + if (demo->model) { + g_object_unref (demo->model); + demo->model = NULL; + } + g_free (demo); } @@ -52,16 +68,21 @@ static void pgd_text_get_text (GtkWidget *button, PgdTextDemo *demo) { - PopplerPage *page; - PopplerRectangle rect; - gdouble width, height; - gchar *text; - GTimer *timer; + PopplerPage *page; + PopplerRectangle rect; + PopplerRectangle *recs = NULL; + guint n_recs; + gdouble width, height; + gchar *text; + GTimer *timer; + gint i; page = poppler_document_get_page (demo->doc, demo->page); if (!page) return; + gtk_list_store_clear (demo->model); + poppler_page_get_size (page, &width, &height); rect.x1 = rect.y1 = 0; rect.x2 = width; @@ -72,10 +93,17 @@ pgd_text_get_text (GtkWidget *button, g_timer_stop (timer); if (text) { - gchar *str; + gchar *str; + gdouble text_elapsed; - str = g_strdup_printf ("got text in %.4f seconds", - g_timer_elapsed (timer, NULL)); + text_elapsed = g_timer_elapsed (timer, NULL); + + g_timer_start (timer); + poppler_page_get_text_layout (page, &recs, &n_recs); + g_timer_stop (timer); + + str = g_strdup_printf ("got text in %.4f seconds, text layout in %.4f seconds", + text_elapsed, g_timer_elapsed (timer, NULL)); gtk_label_set_markup (GTK_LABEL (demo->timer_label), str); g_free (str); } else { @@ -89,8 +117,62 @@ pgd_text_get_text (GtkWidget *button, gtk_text_buffer_set_text (demo->buffer, text, strlen (text)); g_free (text); } + + for (i = 0; i < n_recs; i++) { + GtkTreeIter iter; + gchar *x1, *y1, *x2, *y2; + gchar *offset; + + x1 = g_strdup_printf ("%.2f", recs[i].x1); + y1 = g_strdup_printf ("%.2f", recs[i].y1); + x2 = g_strdup_printf ("%.2f", recs[i].x2); + y2 = g_strdup_printf ("%.2f", recs[i].y2); + + offset = g_strdup_printf ("%d", i); + + gtk_list_store_append (demo->model, &iter); + gtk_list_store_set (demo->model, &iter, + TEXT_X1_COLUMN, x1, + TEXT_Y1_COLUMN, y1, + TEXT_X2_COLUMN, x2, + TEXT_Y2_COLUMN, y2, + TEXT_OFFSET_COLUMN, offset, + TEXT_OFFPTR_COLUMN, GINT_TO_POINTER (i), + -1); + + g_free (x1); + g_free (y1); + g_free (x2); + g_free (y2); + g_free (offset); + } + + g_free (recs); +} + +static void +pgd_text_selection_changed (GtkTreeSelection *treeselection, + PgdTextDemo *demo) +{ + GtkTreeModel *model; + GtkTreeIter iter; + + if (gtk_tree_selection_get_selected (treeselection, &model, &iter)) { + gpointer offset; + GtkTextIter begin_iter, end_iter; + + gtk_tree_model_get (model, &iter, + TEXT_OFFPTR_COLUMN, &offset, + -1); + + gtk_text_buffer_get_iter_at_offset (demo->buffer, &begin_iter, GPOINTER_TO_INT (offset)); + end_iter = begin_iter; + gtk_text_iter_forward_char (&end_iter); + gtk_text_buffer_select_range (demo->buffer, &begin_iter, &end_iter); + } } + static void pgd_text_page_selector_value_changed (GtkSpinButton *spinbutton, PgdTextDemo *demo) @@ -101,14 +183,17 @@ pgd_text_page_selector_value_changed (GtkSpinButton *spinbutton, GtkWidget * pgd_text_create_widget (PopplerDocument *document) { - PgdTextDemo *demo; - GtkWidget *label; - GtkWidget *vbox; - GtkWidget *hbox, *page_selector; - GtkWidget *button; - GtkWidget *swindow, *textview; - gchar *str; - gint n_pages; + PgdTextDemo *demo; + GtkWidget *label; + GtkWidget *vbox; + GtkWidget *hbox, *page_selector; + GtkWidget *button; + GtkWidget *swindow, *textview, *treeview; + GtkTreeSelection *selection; + GtkWidget *hpaned; + GtkCellRenderer *renderer; + gchar *str; + gint n_pages; demo = g_new0 (PgdTextDemo, 1); @@ -153,20 +238,81 @@ pgd_text_create_widget (PopplerDocument *document) gtk_box_pack_start (GTK_BOX (vbox), demo->timer_label, FALSE, TRUE, 0); gtk_widget_show (demo->timer_label); + hpaned = gtk_hpaned_new (); + gtk_paned_set_position (GTK_PANED (hpaned), 300); + + swindow = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + + demo->model = gtk_list_store_new (N_COLUMNS, + G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_POINTER); + treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (demo->model)); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + TEXT_X1_COLUMN, "X1", + renderer, + "text", TEXT_X1_COLUMN, + NULL); + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + TEXT_Y1_COLUMN, "Y1", + renderer, + "text", TEXT_Y1_COLUMN, + NULL); + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + TEXT_X2_COLUMN, "X2", + renderer, + "text", TEXT_X2_COLUMN, + NULL); + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + TEXT_Y2_COLUMN, "Y2", + renderer, + "text", TEXT_Y2_COLUMN, + NULL); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), + TEXT_OFFSET_COLUMN, "Offset", + renderer, + "text", TEXT_OFFSET_COLUMN, + NULL); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); + g_signal_connect (selection, "changed", + G_CALLBACK (pgd_text_selection_changed), + (gpointer) demo); + + gtk_container_add (GTK_CONTAINER (swindow), treeview); + gtk_widget_show (treeview); + + gtk_paned_add1 (GTK_PANED (hpaned), swindow); + gtk_widget_show (swindow); + swindow = gtk_scrolled_window_new (NULL, NULL); gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - + demo->buffer = gtk_text_buffer_new (NULL); textview = gtk_text_view_new_with_buffer (demo->buffer); gtk_container_add (GTK_CONTAINER (swindow), textview); gtk_widget_show (textview); - gtk_box_pack_start (GTK_BOX (vbox), swindow, TRUE, TRUE, 0); + gtk_paned_add2 (GTK_PANED (hpaned), swindow); gtk_widget_show (swindow); + gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0); + gtk_widget_show (hpaned); + g_object_weak_ref (G_OBJECT (vbox), (GWeakNotify)pgd_text_free, demo); commit ddcea568b3a7334e062d6214f43d0a2c2ec95be4 Author: Daniel Garcia Date: Tue Jun 15 16:57:32 2010 +0200 [glib] Add poppler_page_get_text_layout() Returns an array of PopplerRectangle items and each Rectangle is a text character position. The position in this array represent the offset in text returned by poppler_page_get_text diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 19ea941..01d5540 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1736,3 +1736,94 @@ poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect) rect->y2 = cropBox->y2; } +/** + * poppler_page_get_text_layout: + * @page: A #PopplerPage + * @rectangles: return location for an array of #PopplerRectangle + * @n_rectangles: length of returned array + * + * Obtains the layout of the text as a list of #PopplerRectangle + * This array must be freed with g_free () when done. + * + * The position in the array represents an offset in the text returned by + * poppler_page_get_text + * + * Return value: %TRUE if the page contains text, %FALSE otherwise + **/ +gboolean +poppler_page_get_text_layout (PopplerPage *page, + PopplerRectangle **rectangles, + guint *n_rectangles) +{ + TextPage *text; + TextWordList *wordlist; + TextWord *word, *nextword; + PopplerRectangle *rect; + int i, j, offset = 0; + gdouble x1, y1, x2, y2; + gdouble x3, y3, x4, y4; + + g_return_val_if_fail (POPPLER_IS_PAGE (page), FALSE); + + *n_rectangles = 0; + + text = poppler_page_get_text_page (page); + wordlist = text->makeWordList (gFalse); + + if (wordlist->getLength () <= 0) + return FALSE; + + // Getting the array size + for (i = 0; i < wordlist->getLength (); i++) + { + word = wordlist->get (i); + *n_rectangles += word->getLength () + 1; + } + + *rectangles = g_new (PopplerRectangle, *n_rectangles); + + // Calculating each char position + for (i = 0; i < wordlist->getLength (); i++) + { + word = wordlist->get (i); + for (j = 0; j < word->getLength (); j++) + { + rect = *rectangles + offset; + word->getCharBBox (j, + &(rect->x1), + &(rect->y1), + &(rect->x2), + &(rect->y2)); + offset++; + } + + // adding spaces and break lines + rect = *rectangles + offset; + word->getBBox (&x1, &y1, &x2, &y2); + + nextword = word->getNext (); + if (nextword) + { + nextword->getBBox (&x3, &y3, &x4, &y4); + // space is from one word to other and with the same height as + // first word. + rect->x1 = x2; + rect->y1 = y1; + rect->x2 = x3; + rect->y2 = y2; + } + else + { + // end of line + rect->x1 = x2; + rect->y1 = y2; + rect->x2 = x2; + rect->y2 = y2; + } + offset++; + } + + delete wordlist; + + return TRUE; +} diff --git a/glib/poppler-page.h b/glib/poppler-page.h index 20dc20f..3a31acd 100644 --- a/glib/poppler-page.h +++ b/glib/poppler-page.h @@ -114,7 +114,9 @@ GList *poppler_page_get_annot_mapping (PopplerPage *pa void poppler_page_free_annot_mapping (GList *list); void poppler_page_get_crop_box (PopplerPage *page, PopplerRectangle *rect); - +gboolean poppler_page_get_text_layout (PopplerPage *page, + PopplerRectangle **rectangles, + guint *n_rectangles); /* A rectangle on a page, with coordinates in PDF points. */ #define POPPLER_TYPE_RECTANGLE (poppler_rectangle_get_type ()) From carlosgc at gnome.org Wed Jun 16 03:04:36 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Wed, 16 Jun 2010 12:04:36 +0200 Subject: [poppler] poppler Digest, Vol 64, Issue 23 In-Reply-To: References: Message-ID: <1276682503-sup-1019@charmaleon> Excerpts from srinivas adicherla's message of mi? jun 16 11:52:17 +0200 2010: > Hi Carlos Garcia Campos, Hi, > You mentioned about the new function "poppler_page_get_bounding_box()". > It returns the effective bounding box of the page. What do you mean by > effective bounding box? Is it the page bounding box excluding the margins on > left,right,top,bottom ? If So, I am also trying the same thing for getting > the bounding box of the page. > > I need some suggestions. Iam doing something like this > 1) we have the way to get the TextBlocks bounding boxes from the > TextOutPutDev file. Taking the minX,minY,maxX,maxY of all TextBlocks > bounding box will give the page bounding box excluding margins. But some pdf > files having Graphic Streams at the start and end of the pages. For those > pages it wil not give the correct bounding box. Give me any ideas how to do > those. > > 2) In poppler_page_get_image_mapping() it will give the starting (x,y) > co-ordinates and width,height of the image. But how do we know scaling > factor of the image stored in the file. ( this is for all) Using a cairo recording surface it's pretty easy, this is the function I'll add as soon as cairo 1.10 is out (maybe before with #ifdefs): void poppler_page_get_bounding_box (PopplerPage *page, PopplerRectangle *rect) { cairo_surface_t *rsurface; cairo_t *cr; double x, y, width, height; rsurface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR, NULL); cr = cairo_create (rsurface); poppler_page_render (page, cr); cairo_destroy (cr); cairo_recording_surface_ink_extents (rsurface, &x, &y, &width, &height); cairo_surface_destroy (rsurface); rect->x1 = x; rect->x2 = x + width; rect->y1 = y; rect->y2 = y + height; } > Thanks & Regards > -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From pino at kde.org Wed Jun 16 06:45:49 2010 From: pino at kde.org (Pino Toscano) Date: Wed, 16 Jun 2010 15:45:49 +0200 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary In-Reply-To: References: Message-ID: <201006161546.02901.pino@kde.org> Hi, Alle mercoled? 16 giugno 2010, srinivas adicherla ha scritto: > Index: poppler/poppler-poppler-document.html > Index: poppler/poppler-poppler.html > [...] > Generated by GTK-Doc V1.11 The HTML files are autogenerated, so pretty unuseful. I'm not familiar with gtk-doc, so I cannot tell you what to do (Carlos?). > + // Return the PDF ID contains in the trailer dictionary > + GBool getID(GooString *permanent_id,GooString *update_id); > + // Set the PDF ID in the trailer dictionary > + GBool setID(); A bit more of clean indentation: add a space after a comma, and just once space instead of few. (This applies also for other parts.) > +GBool PDFDoc::getID(GooString *permanent_id,GooString *update_id) { > + > + Object *trailer = xref->getTrailerDict(); We don't use tabs in the poppler core, so please use the same indentation used in this file. > + char *Id1 = val1.getString()->getCString(); > + char *Id2 = val2.getString()->getCString(); > + > + char **pdfids = (char**)malloc(2*sizeof(char*)); > + pdfids[0] = (char*)malloc(32*sizeof(char)); > + pdfids[1] = (char*)malloc(32*sizeof(char)); > + > + get_id(Id1,pdfids[0]); > + get_id(Id2,pdfids[1]); > + > + permanent_id->append(pdfids[0],32); > + update_id->append(pdfids[1],32); > + > + free(Id1); > + free(Id2); Still malloc() abuse... char tmpid[33]; get_id(val1.getString()->getCString(), tmpid); permanent_id->append(tmpid, 32); get_id(val2.getString()->getCString(), tmpid); update_id->append(tmpid, 32); Plus, you must free() the two Objects read. > +GBool PDFDoc::setID() { > + > + GooString permanent_id,update_id; > + > + if(getID(&permanent_id,&update_id)) { return false; } > + else { > + char *filename = getFileName()->getCString(); Still there is no handling of non-files documents, where this line with crash with a NULL pointer usage. > + // gets filename from the path > + char *file = strrchr(filename,'/'); > + if(!file) strrchr(filename,'\\'); Is this supposed to handle either Unix or Windows paths? If so, see the SLASH define in utils/HtmlOutputDev.h for a way to just use the proper character with no need to lookup twice. > + // file name > + if(filename) > + message.append(file+1); > + else > + message.append("emptyfilename.pdf"); What is this supposed to do? Also note strrchr() will return NULL is cannot find the character, meaning opening a document like "somedocument.pdf" (ie in the current directory) will make this code crash. Also, I think writing a new file, with a fixed name and in the same directory is a really bad idea, as a) you cannot be sure the current directory is writeable b) that could be a security issue It could be much better to just take a OutStream* as parameter, and let the caller create the actual kind of OutStream (file, buffer, etc). This also mean the glib function using setID() should take a file name (ow other glib IO stuff, which I do not know). > + FILE *f; > + f = fopen(filename,"r"); > + fseek(f,0,SEEK_END); > + fileSize = ftell(f); You are not doing any check for all of the three calls above (especially fopen), not even closing the file. > + fflush(stdout); uh? > Index: poppler-0.14.0/glib/poppler-document.cc > [...] > + g_object_class_install_property > + (G_OBJECT_CLASS (klass), > + PROP_PERMANENT_ID, > + g_param_spec_string ("permanent-id", > + "Permanent Id", > + "Permanent Id of the Pdf Document", > + NULL, > + G_PARAM_READABLE)); > + > + g_object_class_install_property > + (G_OBJECT_CLASS (klass), > + PROP_UPDATE_ID, > + g_param_spec_string ("update-id", > + "Update Id", > + "Update Id of the Pdf Document", > + NULL, > + G_PARAM_READABLE)); Still, "Pdf" -> "PDF". > +PopplerDocumentId* > +poppler_document_get_pdf_id (PopplerDocument *document) > +{ > + > + GooString permanent_id,update_id; > + > + if(document->doc->getID(&permanent_id,&update_id)) { > + > + PopplerDocumentId *doc_id = > g_new(PopplerDocumentId,1); > + strcpy(doc_id->permanent_id,permanent_id.getCString( > )); > + strcpy(doc_id->update_id,update_id.getCString()); I suppose there are better glib functions instead of strcpy(). -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 190 bytes Desc: This is a digitally signed message part. URL: From ludewich at users.sourceforge.net Wed Jun 16 11:56:33 2010 From: ludewich at users.sourceforge.net (Christian Feuersaenger) Date: Wed, 16 Jun 2010 20:56:33 +0200 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <201006142207.27550.aacid@kde.org> References: <4C1684DE.201@users.sourceforge.net> <201006142207.27550.aacid@kde.org> Message-ID: <4C191E61.9050702@users.sourceforge.net> Dear Poppler Developers, attached you find my bugfix proposal to improve rendering of Type 4/5 Shadings (Gouraud Interpolated Triangle Shadings). What it does is: 1. implement the Function lookup to fix buggy display of parameterized shadings, 2. Improve the triangle refinement control such that it runs 5 times faster, 3. Share path memory between successive flat triangles which gains another 10% runtime improvement (avoids many new/delete operations). I believe the changes are stable and should work without problems. The attached patch file patches against branch poppler-0.14 . Note that I changed the access policies to GfxSubPath: it has no setter methods which allows to re-use the same path with different coordinates (Point 3 of the list above). Looking forward to your opinions, best regards Christian PS I will send patch files for the implemented draft of *real* gouraud interpolated shadings when they become more or less stable. Am 14.06.2010 23:07, schrieb Albert Astals Cid: > A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: >> Hi Albert, >> >> thank you for the fast reply and your positive answer! >> >> I will use the next days to apply the xpdf patches to libpoppler. >> >> I intent to patch the patched triangle refinement to your stable branch, >> which appears to be the poppler-0.14 (?). I consider it to be a bugfix. > > Right poppler 0.14 is our stable branch. > >> >> The interpolated shader is not yet stable and may need some revisions. I >> will continue working on it, preferrable on a separate branch. >> If you like, I can try to make a www git repository somewhere such that >> you can fetch my changes and merge them to whereever you want. > > Personally i'd prefer that you send the patches to the mailing list, makes > easier for more people to see them and comment if they feel like. > > Albert > >> >> For the moment, you find my test.pdf attached. it has been generated >> with latex and the unstable version of \usepackage{pgfplots}, >> http://pgfplots.sourceforge.net/; I also attached the .tex sources. >> >> So, thank you for the positive feedback. >> >> Best regards >> >> Christian >> >> >> > I am sure my additions are valueable and propose them for usage in >> >> > libpoppler: the bugfix/speed improvement is directly usable and >> >> stable >> >> >> > and the lowlevel shader will need some more time. I could also >> >> use some >> >> >> > advice to get the integration with transparency, blending and >> >> whatever >> >> >> > correctly. I started with the xpdf sources, so I would also >> >> appreciate >> >> >> > any hints how you communicate changes between xpdf and libpoppler >> >> if you >> >> >> > are interested in my proposal. >> > >> > Yes, we are interested in your patches, basically what we would need >> >> you is to >> >> > provide a patch over poppler sources, you can choose wheter you want >> >> to make >> >> > it against git master branch, git poppler-0.14 branch or the released >> >> 0.14.0 >> >> > tarball. >> > >> > Also it would be interesting to have the PDF you have used for testing. >> > >> > Thanks, >> > >> > Albert >> >> _______________________________________________ >> poppler mailing list >> poppler at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/poppler > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler -------------- next part -------------- A non-text attachment was scrubbed... Name: test.pdf Type: application/pdf Size: 73326 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: triangleshadingbugfix.patch Type: text/x-patch Size: 11700 bytes Desc: not available URL: From ludewich at users.sourceforge.net Wed Jun 16 12:54:31 2010 From: ludewich at users.sourceforge.net (Christian Feuersaenger) Date: Wed, 16 Jun 2010 21:54:31 +0200 Subject: [poppler] Viewers + developer version of poppler? Message-ID: <4C192BF7.3040604@users.sourceforge.net> Hello, I am working on the developer version of libpoppler and I am wondering how to link the resulting library against any of the final viewer applications. As far as I know, evince and okular both rely on libpoppler. Is there a (simple) way to make them use the developer-version compiled library at runtime? Best regards Christian From aacid at kde.org Wed Jun 16 13:45:50 2010 From: aacid at kde.org (Albert Astals Cid) Date: Wed, 16 Jun 2010 21:45:50 +0100 Subject: [poppler] Viewers + developer version of poppler? In-Reply-To: <4C192BF7.3040604@users.sourceforge.net> References: <4C192BF7.3040604@users.sourceforge.net> Message-ID: <201006162145.51240.aacid@kde.org> A Dimecres, 16 de juny de 2010, Christian Feuersaenger va escriure: > Hello, > > I am working on the developer version of libpoppler and I am wondering > how to link the resulting library against any of the final viewer > applications. > > As far as I know, evince and okular both rely on libpoppler. > > Is there a (simple) way to make them use the developer-version compiled > library at runtime? If the system version has the same soversion than the one you are compiling (that is the same libpoppler.so.number) then changing LD_LIBRARY_PATH should be enough, if that's not the case you will probably need to recompile your application. On the other hand we have demo and tests applications inside poppler so you shouldn't really need to recompile okular/evince to test your changes. Albert > > Best regards > > Christian > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kde.org Wed Jun 16 15:44:02 2010 From: aacid at kde.org (Albert Astals Cid) Date: Wed, 16 Jun 2010 23:44:02 +0100 Subject: [poppler] Accessibility of PDF documents (corrected patch attached) In-Reply-To: References: Message-ID: <201006162344.03291.aacid@kde.org> A Dimecres, 16 de juny de 2010, omkar va escriure: > Dear Albert, > > Please find the corrected patch for "accessibility of pdf document " and > give your feedback. Hi, some comments: * The comments like // One more parameter(int j) is added in the getCSStyle function by CDAC developer Team need to be removed, if each line had near it who coded it, the code will be twice as big and much more unreadable * The spacing of your patches could be better, that is GooString* HtmlFontAccu::getCSStyle(int i, GooString* content ,int j){ should be +GooString* HtmlFontAccu::getCSStyle(int i, GooString* content, int j){ but that's nothing huge, i can fix it * You are leaking (i.e. not deleting) jStr in both HtmlFontAccu::getCSStyle and HtmlFontAccu::CSStyle * I see that the new HtmlPage::complexHtml and the old HtmlPage::dumpComplex are very simple, i if you reused the code instead of copying it * This introduces a behavioural change that is unaccetable, i understand you want pdftohtml to produce a different (in your opinion better) output, for that you'll have to introduce a new comandline option to pdftohtml (something like --singlehtml) or something like that Thanks for your work :-) Albert > > Thanks & regards > Onkar > (for CDAC Accessibility Team) > > On Wed, Jun 16, 2010 at 3:48 AM, Albert Astals Cid wrote: > > A Dimarts, 15 de juny de 2010, leena chourey va escriure: > > > Dear developers, > > > > > > The poppler patch is attached related with "accessibility of pdf > > > > document", > > > > > please check it and give your feedback. > > > > Hi, some comments: > > * when i apply your patch the code doesn't compile > > > > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc: In member function > > ?GooString* > > HtmlFontAccu::CSStyle(int, int)?: > > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc:359: error: ?jstr? was not > > declared in this scope > > > > After fixing that, the code does not compile again > > > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > > ?void > > HtmlPage::dumpAsXML(FILE*, int)?: > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:753: error: no > > matching function for call to ?HtmlFontAccu::getCSStyle(int&, > > GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: > > candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, > > GooString*) > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > > ?void > > HtmlPage::dumpComplex(FILE*, int)?: > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:837: error: no > > matching function for call to ?HtmlFontAccu::getCSStyle(int&, > > GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: > > candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, > > GooString*) > > > > > > So i'd appreciate a patch that builds, after that we can start speaking > > about > > the functionality/code quailty, etc. > > > > Albert > > > > > On Mon, Jun 14, 2010 at 12:44 PM, leena chourey > > > > wrote: > > > > Dear Albert, > > > > > > > > Thanks for responding. > > > > The poppler patch related with our changes will be submitted soon to > > > > poppler developers for feedback. > > > > > > > > with regards > > > > Leena > > > > > > > > On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid > > > > wrote: > > > >> A Divendres, 11 de juny de 2010, leena chourey va escriure: > > > >> > Dear all, > > > >> > > > > >> > This is in continuation to our last communication related with > > > >> > *Accessibility of Pdf document.* As discussed last time, we have > > > >> > now completed the first prototype version of the same and we are > > > >> > making > > > > it > > > > > >> > available for your testing and valuable comments/feedback. As > > > >> > mentioned last time, we convert the PDF file into HTML format and > > > >> > open the same automatically in Firefox. > > > >> > > > > >> > Enclosed with this email is the ReadMe file which explains the > > > >> > steps to download, install and run this enhancement. Please try > > > >> > out the same and give us your valuable feedback. > > > >> > > > > >> > > > > >> > We have tested it at our end by different teams and have found > > > >> > that > > > > it > > > > > >> > works well in most cases. Some places where we feel work is > > > >> > required are > > > >> > > > > >> > as follows: > > > >> > - Sometimes Orca in not able to read header and footer of page > > > >> > - Some character combinations are displayed as garbage like > > > >> > 'ft', > > > >> > > > >> 'tt' > > > >> > > > >> > - Content in table format is spoken by orca but it does not say > > > > the > > > > > >> row > > > >> > > > >> > and column reference. Means a user can not find out that orca > > > >> > is > > > >> > > > >> reading > > > >> > > > >> > table content. (as orca does table reading in openoffice > > > >> > writer) > > > >> > > > > >> > We are working on these. Waiting to hear more from all. > > > >> > > > >> Quick question, do you have any patches on top of the poppler you > > > >> use? > > > >> > > > >> Albert > > > >> > > > >> > With regards > > > >> > Leena C > > > >> > > > >> _______________________________________________ > > > >> poppler mailing list > > > >> poppler at lists.freedesktop.org > > > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > > > -- > > > > Leena C > > > > > > Thanks & Regards From aacid at kde.org Wed Jun 16 16:00:38 2010 From: aacid at kde.org (Albert Astals Cid) Date: Thu, 17 Jun 2010 00:00:38 +0100 Subject: [poppler] KMP for search In-Reply-To: <20100616174839.dcf5a0be.buchner.johannes@gmx.at> References: <20100615223716.8513ae9d.buchner.johannes@gmx.at> <201006151905.25318.aacid@kde.org> <20100616174839.dcf5a0be.buchner.johannes@gmx.at> Message-ID: <201006170000.38520.aacid@kde.org> A Dimecres, 16 de juny de 2010, Johannes Buchner va escriure: > Hi > > On Tue, 15 Jun 2010 19:05:25 +0100 > > Albert Astals Cid wrote: > > > I implemented the KMP search algorithm in [1] but I feel it doesn't > > > get attention. Please apply [2] and test it. > > > > You sent a mail yesterday and already complain you are being ignored? > > No, I added the patch the day before, and since only 3 adresses are > notified about it, One of them being a mailing list (not this one, a different one) ;-) > I thought it would be worth mentioning on the > mailing list aswell. Ok, no problemo. > > > > [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821 > > > [2] https://bugs.freedesktop.org/attachment.cgi?id=36255 > > > > > > To be honest, the gain is small; > > > > If the gain is small i'd prefer to stay with our tested code than to > > switch to something totally new. > > I understand where you're coming from; I've seen a improvement of factor > 3 for certain cases, and I've never seen a lower speed compared to the > naive implementation. It shows that the factors of O(n*m) are comparable > to the factors of the new O(n). So it has a gain. > I tested the KMP code with several instances before integrating it into > poppler, and afterwards using the glib-demo program. The code is not > "totally new" in the sense that KMP is old, and I kept to > implementations I found on the web. The change [1] is small (~10 > lines changed plus two new functions), although the additional > indentation level makes it look bigger. > https://bugs.freedesktop.org/review?bug=8821&attachment=36292 > > So, yes, I think it should go in. Carlos do you feel like reviewing it? After all Okular is not using poppler search code so i think you have more at stake if that patch introduces a regression than me ;-) Albert > > > > I find it odd that the search > > > function is page-based and runs per block (sorry, I'm new to > > > poppler). It strikes me that no wrapped words can ever be found. From aacid at kde.org Wed Jun 16 16:04:32 2010 From: aacid at kde.org (Albert Astals Cid) Date: Thu, 17 Jun 2010 00:04:32 +0100 Subject: [poppler] compile Poppler with windows In-Reply-To: References: Message-ID: <201006170004.32568.aacid@kde.org> A Dimecres, 16 de juny de 2010, Taner ARUK va escriure: > Hi, > > I can't compile poppler with windows. We don't read minds (yet) so if you don't give us the error you get we can't help you. > I use visual studio 2008, is there > any where compiled version of poppler and how can i find it?... The poppler project does not provide binary packages of poppler for any platform. Albert > > Thanks. From leenagour at gmail.com Wed Jun 16 21:20:43 2010 From: leenagour at gmail.com (leena chourey) Date: Thu, 17 Jun 2010 09:50:43 +0530 Subject: [poppler] Accessibility of PDF documents (corrected patch attached) In-Reply-To: <201006162344.03291.aacid@kde.org> References: <201006162344.03291.aacid@kde.org> Message-ID: Dear Albert, Thanks for detail comments, we will work on it and send the updated one as guided by you. Also will find the possibility of a new command line option to pdftohtml as suggested by you. With regards Leena C On Thu, Jun 17, 2010 at 4:14 AM, Albert Astals Cid wrote: > A Dimecres, 16 de juny de 2010, omkar va escriure: > > Dear Albert, > > > > Please find the corrected patch for "accessibility of pdf document " and > > give your feedback. > > Hi, some comments: > * The comments like > // One more parameter(int j) is added in the getCSStyle function by CDAC > developer Team > need to be removed, if each line had near it who coded it, the code will > be > twice as big and much more unreadable > * The spacing of your patches could be better, that is > GooString* HtmlFontAccu::getCSStyle(int i, GooString* content ,int j){ > should be > +GooString* HtmlFontAccu::getCSStyle(int i, GooString* content, int j){ > but that's nothing huge, i can fix it > * You are leaking (i.e. not deleting) jStr in both > HtmlFontAccu::getCSStyle > and HtmlFontAccu::CSStyle > * I see that the new HtmlPage::complexHtml and the old > HtmlPage::dumpComplex > are very simple, i if you reused the code instead of copying it > * This introduces a behavioural change that is unaccetable, i understand > you > want pdftohtml to produce a different (in your opinion better) output, for > that you'll have to introduce a new comandline option to pdftohtml > (something > like --singlehtml) or something like that > > Thanks for your work :-) > > Albert > > > > > Thanks & regards > > Onkar > > (for CDAC Accessibility Team) > > > > On Wed, Jun 16, 2010 at 3:48 AM, Albert Astals Cid > wrote: > > > A Dimarts, 15 de juny de 2010, leena chourey va escriure: > > > > Dear developers, > > > > > > > > The poppler patch is attached related with "accessibility of pdf > > > > > > document", > > > > > > > please check it and give your feedback. > > > > > > Hi, some comments: > > > * when i apply your patch the code doesn't compile > > > > > > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc: In member function > > > ?GooString* > > > HtmlFontAccu::CSStyle(int, int)?: > > > /home/tsdgeos/devel/poppler/utils/HtmlFonts.cc:359: error: ?jstr? was > not > > > declared in this scope > > > > > > After fixing that, the code does not compile again > > > > > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > > > ?void > > > HtmlPage::dumpAsXML(FILE*, int)?: > > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:753: error: no > > > matching function for call to ?HtmlFontAccu::getCSStyle(int&, > > > GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: > > > candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, > > > GooString*) > > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc: In member function > > > ?void > > > HtmlPage::dumpComplex(FILE*, int)?: > > > /home/tsdgeos/devel/poppler/utils/HtmlOutputDev.cc:837: error: no > > > matching function for call to ?HtmlFontAccu::getCSStyle(int&, > > > GooString*&)? /home/tsdgeos/devel/poppler/utils/HtmlFonts.h:93: note: > > > candidates are: GooString* HtmlFontAccu::getCSStyle(int, int, > > > GooString*) > > > > > > > > > So i'd appreciate a patch that builds, after that we can start speaking > > > about > > > the functionality/code quailty, etc. > > > > > > Albert > > > > > > > On Mon, Jun 14, 2010 at 12:44 PM, leena chourey > > > > > > > wrote: > > > > > Dear Albert, > > > > > > > > > > Thanks for responding. > > > > > The poppler patch related with our changes will be submitted soon > to > > > > > poppler developers for feedback. > > > > > > > > > > with regards > > > > > Leena > > > > > > > > > > On Mon, Jun 14, 2010 at 3:02 AM, Albert Astals Cid > > > > > > wrote: > > > > >> A Divendres, 11 de juny de 2010, leena chourey va escriure: > > > > >> > Dear all, > > > > >> > > > > > >> > This is in continuation to our last communication related with > > > > >> > *Accessibility of Pdf document.* As discussed last time, we have > > > > >> > now completed the first prototype version of the same and we are > > > > >> > making > > > > > > it > > > > > > > >> > available for your testing and valuable comments/feedback. As > > > > >> > mentioned last time, we convert the PDF file into HTML format > and > > > > >> > open the same automatically in Firefox. > > > > >> > > > > > >> > Enclosed with this email is the ReadMe file which explains the > > > > >> > steps to download, install and run this enhancement. Please try > > > > >> > out the same and give us your valuable feedback. > > > > >> > > > > > >> > > > > > >> > We have tested it at our end by different teams and have found > > > > >> > that > > > > > > it > > > > > > > >> > works well in most cases. Some places where we feel work is > > > > >> > required are > > > > >> > > > > > >> > as follows: > > > > >> > - Sometimes Orca in not able to read header and footer of > page > > > > >> > - Some character combinations are displayed as garbage like > > > > >> > 'ft', > > > > >> > > > > >> 'tt' > > > > >> > > > > >> > - Content in table format is spoken by orca but it does not > say > > > > > > the > > > > > > > >> row > > > > >> > > > > >> > and column reference. Means a user can not find out that orca > > > > >> > is > > > > >> > > > > >> reading > > > > >> > > > > >> > table content. (as orca does table reading in openoffice > > > > >> > writer) > > > > >> > > > > > >> > We are working on these. Waiting to hear more from all. > > > > >> > > > > >> Quick question, do you have any patches on top of the poppler you > > > > >> use? > > > > >> > > > > >> Albert > > > > >> > > > > >> > With regards > > > > >> > Leena C > > > > >> > > > > >> _______________________________________________ > > > > >> poppler mailing list > > > > >> poppler at lists.freedesktop.org > > > > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > > > > > -- > > > > > Leena C > > > > > > > > Thanks & Regards > -- Leena C -------------- next part -------------- An HTML attachment was scrubbed... URL: From Johnny.Mariethoz at rero.ch Wed Jun 16 23:31:54 2010 From: Johnny.Mariethoz at rero.ch (=?iso-8859-1?Q?Johnny_Mari=E9thoz?=) Date: Thu, 17 Jun 2010 08:31:54 +0200 Subject: [poppler] Private TextPage destructor Message-ID: Dear all, I try to use swig to create a python wrapper to poppler (not on poppler-glib but on the poppler base classes), and I note that the destructor of TextPage is private. As swig do not wrap private/protected methods I have memory leaks. Are they good reasons to make the destructor private? From TextOutputDev.h private: // Destructor. ~TextPage(); Many thanks in advance. ---------------------------------------------------------------------- Johnny Mari?thoz RERO, Av. de la Gare 45, CH - 1920 MARTIGNY T?l?phone: +41(0)27 721 8579 Fax : +41(0)27 721 8586 Web : http://www.rero.ch ReroDoc : http://doc.rero.ch, doc.support at rero.ch ---------------------------------------------------------------------- From carlosgc at gnome.org Thu Jun 17 00:35:17 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Thu, 17 Jun 2010 09:35:17 +0200 Subject: [poppler] Private TextPage destructor In-Reply-To: References: Message-ID: <1276760028-sup-7806@charmaleon> Excerpts from Johnny Mari?thoz's message of jue jun 17 08:31:54 +0200 2010: > Dear all, > > I try to use swig to create a python wrapper to poppler (not on poppler-glib but on the poppler base classes), and I note that the destructor of TextPage is private. > > As swig do not wrap private/protected methods I have memory leaks. Are they good reasons to make the destructor > private? Yes, TextPage has a reference counter, so you should never call delete on a TextPage instance, but ::decRefCnt(). > From TextOutputDev.h > > private: > > // Destructor. > ~TextPage(); > > Many thanks in advance. -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From carlosgc at gnome.org Thu Jun 17 01:11:59 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Thu, 17 Jun 2010 10:11:59 +0200 Subject: [poppler] Patch to Get/Set PDF ID in the trailer dictionary In-Reply-To: <201006161546.02901.pino@kde.org> References: <201006161546.02901.pino@kde.org> Message-ID: <1276761859-sup-9604@charmaleon> Excerpts from Pino Toscano's message of mi? jun 16 15:45:49 +0200 2010: > Hi, > > Alle mercoled? 16 giugno 2010, srinivas adicherla ha scritto: > > Index: poppler/poppler-poppler-document.html > > Index: poppler/poppler-poppler.html > > [...] > > Generated by GTK-Doc V1.11 > > The HTML files are autogenerated, so pretty unuseful. I'm not familiar > with gtk-doc, so I cannot tell you what to do (Carlos?). Documentation should be added as comments in source code, HTML is generated by gtk-doc. > > + // Return the PDF ID contains in the trailer dictionary > > + GBool getID(GooString *permanent_id,GooString *update_id); > > + // Set the PDF ID in the trailer dictionary > > + GBool setID(); > > A bit more of clean indentation: add a space after a comma, and just > once space instead of few. (This applies also for other parts.) > > > +GBool PDFDoc::getID(GooString *permanent_id,GooString *update_id) { > > + > > + Object *trailer = xref->getTrailerDict(); > > We don't use tabs in the poppler core, so please use the same > indentation used in this file. > > > + char *Id1 = val1.getString()->getCString(); > > + char *Id2 = val2.getString()->getCString(); > > + > > + char **pdfids = (char**)malloc(2*sizeof(char*)); > > + pdfids[0] = (char*)malloc(32*sizeof(char)); > > + pdfids[1] = (char*)malloc(32*sizeof(char)); > > + > > + get_id(Id1,pdfids[0]); > > + get_id(Id2,pdfids[1]); > > + > > + permanent_id->append(pdfids[0],32); > > + update_id->append(pdfids[1],32); > > + > > + free(Id1); > > + free(Id2); > > Still malloc() abuse... > char tmpid[33]; > get_id(val1.getString()->getCString(), tmpid); > permanent_id->append(tmpid, 32); > get_id(val2.getString()->getCString(), tmpid); > update_id->append(tmpid, 32); > > Plus, you must free() the two Objects read. > > > +GBool PDFDoc::setID() { > > + > > + GooString permanent_id,update_id; > > + > > + if(getID(&permanent_id,&update_id)) { return false; } > > + else { > > + char *filename = getFileName()->getCString(); > > Still there is no handling of non-files documents, where this line with > crash with a NULL pointer usage. > > > + // gets filename from the path > > + char *file = strrchr(filename,'/'); > > + if(!file) strrchr(filename,'\\'); > > Is this supposed to handle either Unix or Windows paths? > If so, see the SLASH define in utils/HtmlOutputDev.h for a way to just > use the proper character with no need to lookup twice. > > > + // file name > > + if(filename) > > + message.append(file+1); > > + else > > + message.append("emptyfilename.pdf"); > > What is this supposed to do? > Also note strrchr() will return NULL is cannot find the character, > meaning opening a document like "somedocument.pdf" (ie in the current > directory) will make this code crash. > Also, I think writing a new file, with a fixed name and in the same > directory is a really bad idea, as > a) you cannot be sure the current directory is writeable > b) that could be a security issue > It could be much better to just take a OutStream* as parameter, and let > the caller create the actual kind of OutStream (file, buffer, etc). This > also mean the glib function using setID() should take a file name (ow > other glib IO stuff, which I do not know). > > > + FILE *f; > > + f = fopen(filename,"r"); > > + fseek(f,0,SEEK_END); > > + fileSize = ftell(f); > > You are not doing any check for all of the three calls above (especially > fopen), not even closing the file. > > > + fflush(stdout); > > uh? > > > Index: poppler-0.14.0/glib/poppler-document.cc > > [...] > > + g_object_class_install_property > > + (G_OBJECT_CLASS (klass), > > + PROP_PERMANENT_ID, > > + g_param_spec_string ("permanent-id", > > + "Permanent Id", > > + "Permanent Id of the Pdf Document", > > + NULL, > > + G_PARAM_READABLE)); > > + > > + g_object_class_install_property > > + (G_OBJECT_CLASS (klass), > > + PROP_UPDATE_ID, > > + g_param_spec_string ("update-id", > > + "Update Id", > > + "Update Id of the Pdf Document", > > + NULL, > > + G_PARAM_READABLE)); > > Still, "Pdf" -> "PDF". > > > +PopplerDocumentId* > > +poppler_document_get_pdf_id (PopplerDocument *document) > > +{ > > + > > + GooString permanent_id,update_id; > > + > > + if(document->doc->getID(&permanent_id,&update_id)) { > > + > > + PopplerDocumentId *doc_id = > > g_new(PopplerDocumentId,1); > > + strcpy(doc_id->permanent_id,permanent_id.getCString( > > )); > > + strcpy(doc_id->update_id,update_id.getCString()); > > I suppose there are better glib functions instead of strcpy(). > Yes, indeed. Also, I would rename the function to something like poppler_document_get_id(), since a poppler document is always a pdf file. Instead of returning a new allocated struct, it would be better to return it as an out argument, so that the struct can be allocated in the stack by the caller. I still don't see the point of set_id(). The document id should be changed only when the document changes, and it's already done by saveAs(). Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aacid at kemper.freedesktop.org Thu Jun 17 15:04:09 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Thu, 17 Jun 2010 15:04:09 -0700 (PDT) Subject: [poppler] 2 commits - poppler/GfxState.cc splash/Splash.cc Message-ID: <20100617220409.389FE10057@kemper.freedesktop.org> poppler/GfxState.cc | 11 +++++++---- splash/Splash.cc | 34 ++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 12 deletions(-) New commits: commit 7cbe3d1521aea8b484efb8663e75684e05b6fb61 Author: Albert Astals Cid Date: Thu Jun 17 23:01:21 2010 +0100 Optimize Splash::compositeBackground Optimization takes into account the two most common cases, the pixel not being painted at all (alpha == 0) meaning we just copy the paperColor and the pixel being opage meaning we have to do nothing diff --git a/splash/Splash.cc b/splash/Splash.cc index 562c7cc..4f2419f 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -3113,10 +3113,19 @@ void Splash::compositeBackground(SplashColorPtr color) { q = &bitmap->alpha[y * bitmap->width]; for (x = 0; x < bitmap->width; ++x) { alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } p += 3; } } @@ -3130,10 +3139,19 @@ void Splash::compositeBackground(SplashColorPtr color) { q = &bitmap->alpha[y * bitmap->width]; for (x = 0; x < bitmap->width; ++x) { alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } p[3] = 255; p += 4; } commit f323e5e4cdcc20075ee7c722f7adc088c0772249 Author: Albert Astals Cid Date: Thu Jun 17 22:59:37 2010 +0100 Check the objects are num before reading them Might have caused the kde bug #241995 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 12e14d6..76cb010 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -1465,13 +1465,16 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, Gfx *gfx) { cs = new GfxICCBasedColorSpace(nCompsA, altA, &iccProfileStreamA); if (dict->lookup("Range", &obj2)->isArray() && obj2.arrayGetLength() == 2 * nCompsA) { + Object obj4; for (i = 0; i < nCompsA; ++i) { obj2.arrayGet(2*i, &obj3); - cs->rangeMin[i] = obj3.getNum(); - obj3.free(); - obj2.arrayGet(2*i+1, &obj3); - cs->rangeMax[i] = obj3.getNum(); + obj2.arrayGet(2*i+1, &obj4); + if (obj3.isNum() && obj4.isNum()) { + cs->rangeMin[i] = obj3.getNum(); + cs->rangeMax[i] = obj4.getNum(); + } obj3.free(); + obj4.free(); } } obj2.free(); From aacid at kemper.freedesktop.org Thu Jun 17 15:05:39 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Thu, 17 Jun 2010 15:05:39 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - 2 commits - poppler/GfxState.cc splash/Splash.cc Message-ID: <20100617220539.E22CE10057@kemper.freedesktop.org> poppler/GfxState.cc | 11 +++++++---- splash/Splash.cc | 34 ++++++++++++++++++++++++++-------- 2 files changed, 33 insertions(+), 12 deletions(-) New commits: commit fb08e3d0ff34c4d5757b95ae500a882bb1a35b07 Author: Albert Astals Cid Date: Thu Jun 17 23:01:21 2010 +0100 Optimize Splash::compositeBackground Optimization takes into account the two most common cases, the pixel not being painted at all (alpha == 0) meaning we just copy the paperColor and the pixel being opage meaning we have to do nothing diff --git a/splash/Splash.cc b/splash/Splash.cc index bea4706..8af2859 100644 --- a/splash/Splash.cc +++ b/splash/Splash.cc @@ -3115,10 +3115,19 @@ void Splash::compositeBackground(SplashColorPtr color) { q = &bitmap->alpha[y * bitmap->width]; for (x = 0; x < bitmap->width; ++x) { alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } p += 3; } } @@ -3132,10 +3141,19 @@ void Splash::compositeBackground(SplashColorPtr color) { q = &bitmap->alpha[y * bitmap->width]; for (x = 0; x < bitmap->width; ++x) { alpha = *q++; - alpha1 = 255 - alpha; - p[0] = div255(alpha1 * color0 + alpha * p[0]); - p[1] = div255(alpha1 * color1 + alpha * p[1]); - p[2] = div255(alpha1 * color2 + alpha * p[2]); + if (alpha == 0) + { + p[0] = color0; + p[1] = color1; + p[2] = color2; + } + else if (alpha != 255) + { + alpha1 = 255 - alpha; + p[0] = div255(alpha1 * color0 + alpha * p[0]); + p[1] = div255(alpha1 * color1 + alpha * p[1]); + p[2] = div255(alpha1 * color2 + alpha * p[2]); + } p[3] = 255; p += 4; } commit b45d60e9c750b7ee892e2008da48b5893ab0f0d3 Author: Albert Astals Cid Date: Thu Jun 17 22:59:37 2010 +0100 Check the objects are num before reading them Might have caused the kde bug #241995 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 12e14d6..76cb010 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -1465,13 +1465,16 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, Gfx *gfx) { cs = new GfxICCBasedColorSpace(nCompsA, altA, &iccProfileStreamA); if (dict->lookup("Range", &obj2)->isArray() && obj2.arrayGetLength() == 2 * nCompsA) { + Object obj4; for (i = 0; i < nCompsA; ++i) { obj2.arrayGet(2*i, &obj3); - cs->rangeMin[i] = obj3.getNum(); - obj3.free(); - obj2.arrayGet(2*i+1, &obj3); - cs->rangeMax[i] = obj3.getNum(); + obj2.arrayGet(2*i+1, &obj4); + if (obj3.isNum() && obj4.isNum()) { + cs->rangeMin[i] = obj3.getNum(); + cs->rangeMax[i] = obj4.getNum(); + } obj3.free(); + obj4.free(); } } obj2.free(); From srinivas.adicherla at gmail.com Thu Jun 17 23:16:22 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Fri, 18 Jun 2010 11:46:22 +0530 Subject: [poppler] Get/Set PDF ID Message-ID: Hi, First of all thank you all for giving me suggestions & comments. I made changes to the previous patch and attached the new patch for getting/setting PDF ID. I attached the patch without having the API Documentation. I will do it as early as possible. I think I made indentation correctly this time. Mean while, send me suggestions/comments about this patch. If possible tell me how to add API documentation. @Carlos Garcia : I also thought that PDFDoc::SaveAS() will set the ID in the document. But that is not always. In PDFDoc::saveAs(GooString *filename,PDFWriteMode mode). We have to pass the mode as writeForceRewrite then only it generates the ID and set it. But I tried with some PDF files, It is setting the ID in the trailer dictionary, but it is loosing the data. I don't know why it is happening. It has happened for all pdf files I have checked so far. Thanks -- A srinivas Sorry If you receive multiple copies of the mail -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler_new.patch Type: text/x-patch Size: 7706 bytes Desc: not available URL: From zorglub421 at gmail.com Fri Jun 18 03:35:51 2010 From: zorglub421 at gmail.com (Zorg 421) Date: Fri, 18 Jun 2010 12:35:51 +0200 Subject: [poppler] compiling on OSX / non standard paths Message-ID: hello poppler users, as a bug impact the jpeg2000 lib of osx, I wanted to give a try to poppler based pdf readers. but: it seems poppler is mostly used on linux using standard paths, fontconfig is tested for presence by autotools, but it's specific location doesn't seem to be considered when compiling. at least int tests. on osx (10.5.8) i use macports which install free sw under /opt/local. i'm trying both 0.14.0 and git poppler. on 0.14.0: -- PKG_CONFIG_PATH="/opt/local/lib/pkgconfig/" CFLAGS="-I/opt/local/include" LDFLAGS="-L/opt/local/lib" ./configure --disable-libjpeg --enable-libopenjpeg=/opt/alt-pdf/ --prefix=/opt/alt-pdf/ ... Building poppler with support for: font configuration: fontconfig splash output: yes cairo output: yes abiword output: yes qt wrapper: no qt4 wrapper: no glib wrapper: yes use GDK: yes cpp wrapper: yes use gtk-doc: no use libjpeg: no use libpng: yes use zlib: no use libcurl: no use libopenjpeg: /opt/alt-pdf/ use cms: yes command line utils: yes Warning: Using libjpeg is recommended Warning: Using libopenjpeg is recommended ... Making all in test CXX gtk-splash-test.o CXXLD gtk-splash-test CXX gtk-cairo-test.o CXXLD gtk-cairo-test CXX pdf-inspector.o CXXLD pdf_inspector CXX perf-test.o CXX perf-test-preview-dummy.o CXXLD perf-test CXX pdf-fullrewrite.o CXXLD pdf-fullrewrite Making all in cpp Making all in . CXX libpoppler_cpp_la-poppler-document.lo In file included from poppler-document.cpp:31: ../poppler/GlobalParams.h:42:35: error: fontconfig/fontconfig.h: No such file or directory make[3]: *** [libpoppler_cpp_la-poppler-document.lo] Error 1 make[2]: *** [all-recursive] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 -- reenabling libjpeg: -- philou at bookpro-rj45:~/src/poppler-0.14.0$ make make all-recursive Making all in goo CXX gfile.lo CXX gmempp.lo CXX GooHash.lo CXX GooList.lo CXX GooTimer.lo CXX GooString.lo CXX gmem.lo CXX FixedPoint.lo CXX PNGWriter.lo CXX JpegWriter.lo In file included from JpegWriter.cc:13: JpegWriter.h:25:21: error: jpeglib.h: No such file or directory JpegWriter.h:45: error: field ?cinfo? has incomplete type JpegWriter.h:46: error: field ?jerr? has incomplete type JpegWriter.cc:19: error: variable or field ?outputMessage? declared void JpegWriter.cc:19: error: ?j_common_ptr? was not declared in this scope JpegWriter.cc:20: error: expected ?,? or ?;? before ?{? token JpegWriter.cc: In destructor ?virtual JpegWriter::~JpegWriter()?: JpegWriter.cc:43: error: ?cinfo? was not declared in this scope JpegWriter.cc:43: error: ?jpeg_destroy_compress? was not declared in this scope JpegWriter.cc: In member function ?virtual bool JpegWriter::init(FILE*, int, int, int, int)?: JpegWriter.cc:49: error: ?cinfo? was not declared in this scope JpegWriter.cc:49: error: ?jerr? was not declared in this scope JpegWriter.cc:49: error: ?jpeg_std_error? was not declared in this scope JpegWriter.cc:53: error: ?jpeg_create_compress? was not declared in this scope JpegWriter.cc:56: error: ?jpeg_stdio_dest? was not declared in this scope JpegWriter.cc:65: error: ?JCS_RGB? was not declared in this scope JpegWriter.cc:66: error: ?jpeg_set_defaults? was not declared in this scope JpegWriter.cc:70: error: ?jpeg_set_quality? was not declared in this scope JpegWriter.cc:75: error: ?jpeg_simple_progression? was not declared in this scope JpegWriter.cc:79: error: ?TRUE? was not declared in this scope JpegWriter.cc:79: error: ?jpeg_start_compress? was not declared in this scope JpegWriter.cc: In member function ?virtual bool JpegWriter::writePointers(unsigned char**, int)?: JpegWriter.cc:87: error: ?cinfo? was not declared in this scope JpegWriter.cc:87: error: ?jpeg_write_scanlines? was not declared in this scope JpegWriter.cc: In member function ?virtual bool JpegWriter::writeRow(unsigned char**)?: JpegWriter.cc:95: error: ?cinfo? was not declared in this scope JpegWriter.cc:95: error: ?jpeg_write_scanlines? was not declared in this scope JpegWriter.cc: In member function ?virtual bool JpegWriter::close()?: JpegWriter.cc:102: error: ?cinfo? was not declared in this scope JpegWriter.cc:102: error: ?jpeg_finish_compress? was not declared in this scope make[2]: *** [JpegWriter.lo] Error 1 make[1]: *** [all-recursive] Error 1 make: *** [all] Error 2 philou at bookpro-rj45:~/src/poppler-0.14.0$ -- git poppler gives me trouble with the autogen.sh, it's disable the presence of gettext, or miss looking in /opt/local/share/aclocal for m4 includes: -- philou at bookpro-rj45:~/src/poppler-git$ ./autogen.sh Checking for automake >= 1.7... -n Testing automake-1.11... found 1.11.1 autoreconf: Entering directory `.' autoreconf: configure.ac: not using Gettext autoreconf: running: aclocal -I m4 configure.ac:524: warning: AC_LIB_PREPARE_PREFIX is m4_require'd but not m4_defun'd m4/iconv.m4:18: AM_ICONV_LINKFLAGS_BODY is expanded from... m4/iconv.m4:152: AM_ICONV_LINK is expanded from... m4/iconv.m4:180: AM_ICONV is expanded from... configure.ac:524: the top level autoreconf: configure.ac: tracing configure.ac:524: warning: AC_LIB_PREPARE_PREFIX is m4_require'd but not m4_defun'd m4/iconv.m4:18: AM_ICONV_LINKFLAGS_BODY is expanded from... m4/iconv.m4:152: AM_ICONV_LINK is expanded from... m4/iconv.m4:180: AM_ICONV is expanded from... configure.ac:524: the top level autoreconf: running: glibtoolize --copy configure.ac:524: warning: AC_LIB_PREPARE_PREFIX is m4_require'd but not m4_defun'd m4/iconv.m4:18: AM_ICONV_LINKFLAGS_BODY is expanded from... m4/iconv.m4:152: AM_ICONV_LINK is expanded from... m4/iconv.m4:180: AM_ICONV is expanded from... configure.ac:524: the top level autoreconf: running: /usr/bin/autoconf configure.ac:524: warning: AC_LIB_PREPARE_PREFIX is m4_require'd but not m4_defun'd m4/iconv.m4:18: AM_ICONV_LINKFLAGS_BODY is expanded from... m4/iconv.m4:152: AM_ICONV_LINK is expanded from... m4/iconv.m4:180: AM_ICONV is expanded from... configure.ac:524: the top level configure:24601: error: possibly undefined macro: AC_MSG_FAILURE If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure:24700: error: possibly undefined macro: AC_LIB_PREPARE_PREFIX configure:24704: error: possibly undefined macro: AC_LIB_LINKFLAGS_BODY configure:24712: error: possibly undefined macro: AC_LIB_APPENDTOVAR autoreconf: /usr/bin/autoconf failed with exit status: 1 configure: error: cannot find install-sh or install.sh in "." "./.." "./../.." philou at bookpro-rj45:~/src/poppler-git$ -- right after, trying: -- philou at bookpro-rj45:~/src/poppler-git$ aclocal -I /opt/local/share/aclocal -I m4 philou at bookpro-rj45:~/src/poppler-git$ autoconf philou at bookpro-rj45:~/src/poppler-git$ automake configure.ac:524: required file `./config.rpath' not found configure.ac:9: required file `./missing' not found configure.ac:9: `automake --add-missing' can install `missing' configure.ac:9: required file `./install-sh' not found configure.ac:9: `automake --add-missing' can install `install-sh' cpp/Makefile.am: required file `./depcomp' not found cpp/Makefile.am: `automake --add-missing' can install `depcomp' configure.ac:11: required file `config.h.in' not found philou at bookpro-rj45:~/src/poppler-git$ automake --add-missing configure.ac:524: required file `./config.rpath' not found configure.ac:9: installing `./missing' configure.ac:9: installing `./install-sh' cpp/Makefile.am: installing `./depcomp' gives: configure.ac:11: required file `config.h.in' not found regards. From carlosgc at gnome.org Fri Jun 18 03:50:14 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Fri, 18 Jun 2010 12:50:14 +0200 Subject: [poppler] Get/Set PDF ID In-Reply-To: References: Message-ID: <1276858088-sup-257@charmaleon> Excerpts from srinivas adicherla's message of vie jun 18 08:16:22 +0200 2010: > Hi, > > First of all thank you all for giving me suggestions & comments. I made > changes to the previous patch and attached the new patch for getting/setting > PDF ID. > I attached the patch without having the API Documentation. I will do it as > early as possible. I think I made indentation correctly this time. Mean > while, send me suggestions/comments about this patch. > If possible tell me how to add API documentation. > > @Carlos Garcia : I also thought that PDFDoc::SaveAS() will set the ID in the > document. But that is not always. > > In PDFDoc::saveAs(GooString *filename,PDFWriteMode mode). We have to pass > the mode as writeForceRewrite then only it generates the ID and set it. But > I tried with some PDF files, It is setting the ID in the trailer dictionary, > but it is loosing the data. I don't know why it is happening. It has > happened for all pdf files I have checked so far. In that case it's a bug in saveAs(), let's fix it instead of adding a new method to work around it. > Thanks -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From carlosgc at gnome.org Fri Jun 18 04:39:00 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Fri, 18 Jun 2010 13:39:00 +0200 Subject: [poppler] Get/Set PDF ID In-Reply-To: References: <1276858088-sup-257@charmaleon> Message-ID: <1276861031-sup-6@charmaleon> Excerpts from srinivas adicherla's message of vie jun 18 13:17:39 +0200 2010: > Hi Carlos, > > Yes, we can fix the bug. But I need a suggestion that for setting the ID > which is the better way? > > 1) One method is using my function PDFDoc::setID(). Here I just add the ID > to the trailer dictionary, and saving it using Incremental Update. It just > adds few lines to the end of the pdf file containing the new trailer > dictionary. > > 2) Second method is using PDFDoc::saveAs(). we need to pass the > writeForceRewrite mode to this function to add the ID to the document. But > the process is slow ( it has to rewrite the all objects in the pdf). But > still this rewriting is not working for all pdfs. > > What i am thinking is let me add function setID(), and later i will fix the > bug in the saveAs() for saveCompleteRewrite mode. > > Please give me suggestions. The thing is that I still don't see the point of allowing the user to set the ID, it should be set automatically when the document changes. > On Fri, Jun 18, 2010 at 4:20 PM, Carlos Garcia Campos wrote: > > > Excerpts from srinivas adicherla's message of vie jun 18 08:16:22 +0200 > > 2010: > > > Hi, > > > > > > First of all thank you all for giving me suggestions & comments. I > > made > > > changes to the previous patch and attached the new patch for > > getting/setting > > > PDF ID. > > > I attached the patch without having the API Documentation. I will do it > > as > > > early as possible. I think I made indentation correctly this time. Mean > > > while, send me suggestions/comments about this patch. > > > If possible tell me how to add API documentation. > > > > > > @Carlos Garcia : I also thought that PDFDoc::SaveAS() will set the ID in > > the > > > document. But that is not always. > > > > > > In PDFDoc::saveAs(GooString *filename,PDFWriteMode mode). We have to pass > > > the mode as writeForceRewrite then only it generates the ID and set it. > > But > > > I tried with some PDF files, It is setting the ID in the trailer > > dictionary, > > > but it is loosing the data. I don't know why it is happening. It has > > > happened for all pdf files I have checked so far. > > > > In that case it's a bug in saveAs(), let's fix it instead of adding a > > new method to work around it. > > > > > Thanks > > -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From srinivas.adicherla at gmail.com Thu Jun 17 22:06:20 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Fri, 18 Jun 2010 10:36:20 +0530 Subject: [poppler] Get/Set PDF ID Message-ID: Hi, First of all thank you all for giving me suggestions & comments. I made changes to the previous patch and attached the new patch for getting/setting PDF ID. I attached the patch without having the API Documentation. I will do it as early as possible. I think I made indentation correctly this time. Mean while, send me suggestions/comments about this patch. If possible tell me how to add API documentation. @Carlos Garcia : I also thought that PDFDoc::SaveAS() will set the ID in the document. But that is not always. In PDFDoc::saveAs(GooString *filename,PDFWriteMode mode). We have to pass the mode as writeForceRewrite then only it generates the ID and set it. But I tried with some PDF files, It is setting the ID in the trailer dictionary, but it is loosing the data. I don't know why it is happening. If you want you can check I attached that PDF (bigtable-osdi06.pdf) file also. It has happened for all pdf files I have checked so far. Thanks -- A srinivas -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler_new.patch Type: text/x-patch Size: 7706 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: bigtable-osdi06.pdf Type: application/pdf Size: 221195 bytes Desc: not available URL: From aacid at kde.org Fri Jun 18 10:58:54 2010 From: aacid at kde.org (Albert Astals Cid) Date: Fri, 18 Jun 2010 18:58:54 +0100 Subject: [poppler] compiling on OSX / non standard paths In-Reply-To: References: Message-ID: <201006181858.54973.aacid@kde.org> A Divendres, 18 de juny de 2010, Zorg 421 va escriure: > hello poppler users, > > as a bug impact the jpeg2000 lib of osx, I wanted to give a try to > poppler based pdf readers. > > but: it seems poppler is mostly used on linux using standard paths, > fontconfig is tested for presence by autotools, but it's specific > location doesn't seem to be considered when compiling. at least int > tests. Hi, as you said we mostly use linux so you have two options there, send patches to fix your problems or send us a Mac Os X computer we can use. I understand you probably want to do the first thing ;-) Albert > > regards. > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kemper.freedesktop.org Fri Jun 18 11:22:53 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Fri, 18 Jun 2010 11:22:53 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - goo/ImgWriter.h goo/JpegWriter.h poppler/SplashOutputDev.cc Message-ID: <20100618182253.2BB6410057@kemper.freedesktop.org> goo/ImgWriter.h | 3 ++- goo/JpegWriter.h | 3 ++- poppler/SplashOutputDev.cc | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) New commits: commit 9bf18e685fccba9c4b7bbde26c37ec158a6186f7 Author: Brian Cameron Date: Fri Jun 18 19:22:17 2010 +0100 Compile with Sun Studio diff --git a/goo/ImgWriter.h b/goo/ImgWriter.h index e11a30b..f44c85d 100644 --- a/goo/ImgWriter.h +++ b/goo/ImgWriter.h @@ -7,6 +7,7 @@ // Copyright (C) 2009 Stefan Thomas // Copyright (C) 2009 Albert Astals Cid // Copyright (C) 2010 Adrian Johnson +// Copyright (C) 2010 Brian Cameron // //======================================================================== @@ -14,7 +15,7 @@ #define IMGWRITER_H #include -#include +#include class ImgWriter { diff --git a/goo/JpegWriter.h b/goo/JpegWriter.h index 3b98da2..1f7a738 100644 --- a/goo/JpegWriter.h +++ b/goo/JpegWriter.h @@ -8,6 +8,7 @@ // Copyright (C) 2010 Adrian Johnson // Copyright (C) 2010 J??rg Billeter // Copyright (C) 2010 Harry Roberts +// Copyright (C) 2010 Brian Cameron // //======================================================================== @@ -18,7 +19,7 @@ #ifdef ENABLE_LIBJPEG -#include +#include #include "ImgWriter.h" extern "C" { diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 00aae92..21d7be6 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -24,6 +24,7 @@ // Copyright (C) 2009 Carlos Garcia Campos // Copyright (C) 2009 William Bader // Copyright (C) 2010 Patrick Spendrin +// Copyright (C) 2010 Brian Cameron // // 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 @@ -72,6 +73,11 @@ extern "C" int unlink(char *filename); #define isfinite(x) _finite(x) #endif +#ifdef __sun +#include +#define isfinite(x) finite(x) +#endif + //------------------------------------------------------------------------ // Divide a 16-bit value (in [0, 255*255]) by 255, returning an 8-bit result. From aacid at kemper.freedesktop.org Fri Jun 18 11:23:35 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Fri, 18 Jun 2010 11:23:35 -0700 (PDT) Subject: [poppler] goo/ImgWriter.h goo/JpegWriter.h poppler/SplashOutputDev.cc Message-ID: <20100618182335.C5C9F10057@kemper.freedesktop.org> goo/ImgWriter.h | 3 ++- goo/JpegWriter.h | 3 ++- poppler/SplashOutputDev.cc | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) New commits: commit 62975737bcaa6e0a2ecab981aa3e0c8f2ff10571 Author: Brian Cameron Date: Fri Jun 18 19:22:17 2010 +0100 Compile with Sun Studio diff --git a/goo/ImgWriter.h b/goo/ImgWriter.h index e11a30b..f44c85d 100644 --- a/goo/ImgWriter.h +++ b/goo/ImgWriter.h @@ -7,6 +7,7 @@ // Copyright (C) 2009 Stefan Thomas // Copyright (C) 2009 Albert Astals Cid // Copyright (C) 2010 Adrian Johnson +// Copyright (C) 2010 Brian Cameron // //======================================================================== @@ -14,7 +15,7 @@ #define IMGWRITER_H #include -#include +#include class ImgWriter { diff --git a/goo/JpegWriter.h b/goo/JpegWriter.h index 3b98da2..1f7a738 100644 --- a/goo/JpegWriter.h +++ b/goo/JpegWriter.h @@ -8,6 +8,7 @@ // Copyright (C) 2010 Adrian Johnson // Copyright (C) 2010 J??rg Billeter // Copyright (C) 2010 Harry Roberts +// Copyright (C) 2010 Brian Cameron // //======================================================================== @@ -18,7 +19,7 @@ #ifdef ENABLE_LIBJPEG -#include +#include #include "ImgWriter.h" extern "C" { diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc index 00aae92..21d7be6 100644 --- a/poppler/SplashOutputDev.cc +++ b/poppler/SplashOutputDev.cc @@ -24,6 +24,7 @@ // Copyright (C) 2009 Carlos Garcia Campos // Copyright (C) 2009 William Bader // Copyright (C) 2010 Patrick Spendrin +// Copyright (C) 2010 Brian Cameron // // 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 @@ -72,6 +73,11 @@ extern "C" int unlink(char *filename); #define isfinite(x) _finite(x) #endif +#ifdef __sun +#include +#define isfinite(x) finite(x) +#endif + //------------------------------------------------------------------------ // Divide a 16-bit value (in [0, 255*255]) by 255, returning an 8-bit result. From aacid at kde.org Fri Jun 18 13:24:46 2010 From: aacid at kde.org (Albert Astals Cid) Date: Fri, 18 Jun 2010 21:24:46 +0100 Subject: [poppler] Get/Set PDF ID In-Reply-To: <1276861031-sup-6@charmaleon> References: <1276861031-sup-6@charmaleon> Message-ID: <201006182124.46751.aacid@kde.org> A Divendres, 18 de juny de 2010, Carlos Garcia Campos va escriure: > Excerpts from srinivas adicherla's message of vie jun 18 13:17:39 +0200 2010: > > Hi Carlos, > > > > Yes, we can fix the bug. But I need a suggestion that for setting the > > ID > > > > which is the better way? > > > > 1) One method is using my function PDFDoc::setID(). Here I just add the > > ID > > > > to the trailer dictionary, and saving it using Incremental Update. It > > just adds few lines to the end of the pdf file containing the new > > trailer dictionary. > > > > 2) Second method is using PDFDoc::saveAs(). we need to pass the > > > > writeForceRewrite mode to this function to add the ID to the document. > > But the process is slow ( it has to rewrite the all objects in the pdf). > > But still this rewriting is not working for all pdfs. > > > > What i am thinking is let me add function setID(), and later i will fix > > the bug in the saveAs() for saveCompleteRewrite mode. > > > > Please give me suggestions. > > The thing is that I still don't see the point of allowing the user to > set the ID, it should be set automatically when the document changes. I'm with Carlos here, if the SaveAs methods should update the PDF ID and they don't, let's fix that. Albert From aacid at kde.org Fri Jun 18 13:43:54 2010 From: aacid at kde.org (Albert Astals Cid) Date: Fri, 18 Jun 2010 21:43:54 +0100 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <4C191E61.9050702@users.sourceforge.net> References: <201006142207.27550.aacid@kde.org> <4C191E61.9050702@users.sourceforge.net> Message-ID: <201006182143.54507.aacid@kde.org> A Dimecres, 16 de juny de 2010, Christian Feuersaenger va escriure: > Dear Poppler Developers, > > attached you find my bugfix proposal to improve rendering of Type 4/5 > Shadings (Gouraud Interpolated Triangle Shadings). > > What it does is: > 1. implement the Function lookup to fix buggy display of parameterized > shadings, > > 2. Improve the triangle refinement control such that it runs 5 times > faster, > > 3. Share path memory between successive flat triangles which gains > another 10% runtime improvement (avoids many new/delete operations). > > I believe the changes are stable and should work without problems. The > attached patch file patches against branch poppler-0.14 . Note that I > changed the access policies to GfxSubPath: it has no setter methods > which allows to re-use the same path with different coordinates (Point 3 > of the list above). I'm running the regression testing with your patch, if no regressions are detected then we can look at the code and see if we like it or not :D Thanks for the patch :-) Albert > > Looking forward to your opinions, > > best regards > > Christian > > PS > I will send patch files for the implemented draft of *real* gouraud > interpolated shadings when they become more or less stable. > > Am 14.06.2010 23:07, schrieb Albert Astals Cid: > > A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: > >> Hi Albert, > >> > >> thank you for the fast reply and your positive answer! > >> > >> I will use the next days to apply the xpdf patches to libpoppler. > >> > >> I intent to patch the patched triangle refinement to your stable branch, > >> which appears to be the poppler-0.14 (?). I consider it to be a bugfix. > > > > Right poppler 0.14 is our stable branch. > > > >> The interpolated shader is not yet stable and may need some revisions. I > >> will continue working on it, preferrable on a separate branch. > >> If you like, I can try to make a www git repository somewhere such that > >> you can fetch my changes and merge them to whereever you want. > > > > Personally i'd prefer that you send the patches to the mailing list, > > makes easier for more people to see them and comment if they feel like. > > > > Albert > > > >> For the moment, you find my test.pdf attached. it has been generated > >> with latex and the unstable version of \usepackage{pgfplots}, > >> http://pgfplots.sourceforge.net/; I also attached the .tex sources. > >> > >> So, thank you for the positive feedback. > >> > >> Best regards > >> > >> Christian > >> > >> >> > I am sure my additions are valueable and propose them for > >> >> > usage in libpoppler: the bugfix/speed improvement is directly > >> >> > usable and > >> > >> stable > >> > >> >> > and the lowlevel shader will need some more time. I could also > >> > >> use some > >> > >> >> > advice to get the integration with transparency, blending and > >> > >> whatever > >> > >> >> > correctly. I started with the xpdf sources, so I would also > >> > >> appreciate > >> > >> >> > any hints how you communicate changes between xpdf and > >> >> > libpoppler > >> > >> if you > >> > >> >> > are interested in my proposal. > >> > > >> > Yes, we are interested in your patches, basically what we would > >> > need > >> > >> you is to > >> > >> > provide a patch over poppler sources, you can choose wheter you > >> > want > >> > >> to make > >> > >> > it against git master branch, git poppler-0.14 branch or the > >> > released > >> > >> 0.14.0 > >> > >> > tarball. > >> > > >> > Also it would be interesting to have the PDF you have used for > >> > testing. > >> > > >> > Thanks, > >> > > >> > Albert > >> > >> _______________________________________________ > >> poppler mailing list > >> poppler at lists.freedesktop.org > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > _______________________________________________ > > poppler mailing list > > poppler at lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/poppler From pino at kemper.freedesktop.org Fri Jun 18 15:03:08 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Fri, 18 Jun 2010 15:03:08 -0700 (PDT) Subject: [poppler] cpp/tests Message-ID: <20100618220308.B31F510057@kemper.freedesktop.org> cpp/tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) New commits: commit d9504c0a288c84b68a516f715505d6bc94b911f5 Author: Pino Toscano Date: Fri Jun 18 23:59:04 2010 +0200 [autotools] link the 'cpp' tests against libpoppler as well ... this way gatof() can be found correctly should fix bug #28605 diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am index b01d3b9..d2544a5 100644 --- a/cpp/tests/Makefile.am +++ b/cpp/tests/Makefile.am @@ -4,6 +4,7 @@ INCLUDES = \ -I$(top_srcdir)/cpp LDADDS = \ + $(top_builddir)/poppler/libpoppler.la \ $(top_builddir)/cpp/libpoppler-cpp.la From pino at kemper.freedesktop.org Fri Jun 18 15:03:08 2010 From: pino at kemper.freedesktop.org (Pino Toscano) Date: Fri, 18 Jun 2010 15:03:08 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - cpp/tests Message-ID: <20100618220308.CD11010058@kemper.freedesktop.org> cpp/tests/Makefile.am | 1 + 1 file changed, 1 insertion(+) New commits: commit 5563ccbb20e4a19ec8415d0108b0089a079b9ab2 Author: Pino Toscano Date: Fri Jun 18 23:59:04 2010 +0200 [autotools] link the 'cpp' tests against libpoppler as well ... this way gatof() can be found correctly should fix bug #28605 diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am index b01d3b9..d2544a5 100644 --- a/cpp/tests/Makefile.am +++ b/cpp/tests/Makefile.am @@ -4,6 +4,7 @@ INCLUDES = \ -I$(top_srcdir)/cpp LDADDS = \ + $(top_builddir)/poppler/libpoppler.la \ $(top_builddir)/cpp/libpoppler-cpp.la From carlosgc at kemper.freedesktop.org Sat Jun 19 01:40:04 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Sat, 19 Jun 2010 01:40:04 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - glib/poppler-page.cc Message-ID: <20100619084005.2B56F10057@kemper.freedesktop.org> glib/poppler-page.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) New commits: commit 010713061e7bee0b00e83cfc90f114e5ea288319 Author: Carlos Garcia Campos Date: Sat Jun 19 10:36:39 2010 +0200 [glib] Fix links/annots area for rotated documents with page CropBox not starting at 0,0 Fixes bug #28588. diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 39645bd..eaae692 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1261,6 +1261,11 @@ poppler_page_get_link_mapping (PopplerPage *page) mapping->action = _poppler_action_new (page->document, link_action, NULL); link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2); + + rect.x1 -= page->page->getCropBox()->x1; + rect.x2 -= page->page->getCropBox()->x1; + rect.y1 -= page->page->getCropBox()->y1; + rect.y2 -= page->page->getCropBox()->y1; switch (page->page->getRotate ()) { @@ -1291,12 +1296,7 @@ poppler_page_get_link_mapping (PopplerPage *page) mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } - - mapping->area.x1 -= page->page->getCropBox()->x1; - mapping->area.x2 -= page->page->getCropBox()->x1; - mapping->area.y1 -= page->page->getCropBox()->y1; - mapping->area.y2 -= page->page->getCropBox()->y1; - + map_list = g_list_prepend (map_list, mapping); } @@ -1456,10 +1456,10 @@ poppler_page_get_annot_mapping (PopplerPage *page) } annot_rect = annot->getRect (); - rect.x1 = annot_rect->x1; - rect.y1 = annot_rect->y1; - rect.x2 = annot_rect->x2; - rect.y2 = annot_rect->y2; + rect.x1 = annot_rect->x1 - page->page->getCropBox()->x1; + rect.y1 = annot_rect->y1 - page->page->getCropBox()->y1; + rect.x2 = annot_rect->x2 - page->page->getCropBox()->x1; + rect.y2 = annot_rect->y2 - page->page->getCropBox()->y1; if (! (annot->getFlags () & Annot::flagNoRotate)) rotation = page->page->getRotate (); @@ -1491,11 +1491,6 @@ poppler_page_get_annot_mapping (PopplerPage *page) mapping->area.y2 = rect.y2; } - mapping->area.x1 -= page->page->getCropBox()->x1; - mapping->area.x2 -= page->page->getCropBox()->x1; - mapping->area.y1 -= page->page->getCropBox()->y1; - mapping->area.y2 -= page->page->getCropBox()->y1; - map_list = g_list_prepend (map_list, mapping); } From carlosgc at kemper.freedesktop.org Sat Jun 19 01:40:18 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Sat, 19 Jun 2010 01:40:18 -0700 (PDT) Subject: [poppler] glib/poppler-page.cc Message-ID: <20100619084018.5535010057@kemper.freedesktop.org> glib/poppler-page.cc | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) New commits: commit 9365c05c1f66b3000febf32c45cef2ffe79e041a Author: Carlos Garcia Campos Date: Sat Jun 19 10:36:39 2010 +0200 [glib] Fix links/annots area for rotated documents with page CropBox not starting at 0,0 Fixes bug #28588. diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index 01d5540..a3f378b 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -1261,6 +1261,11 @@ poppler_page_get_link_mapping (PopplerPage *page) mapping->action = _poppler_action_new (page->document, link_action, NULL); link->getRect (&rect.x1, &rect.y1, &rect.x2, &rect.y2); + + rect.x1 -= page->page->getCropBox()->x1; + rect.x2 -= page->page->getCropBox()->x1; + rect.y1 -= page->page->getCropBox()->y1; + rect.y2 -= page->page->getCropBox()->y1; switch (page->page->getRotate ()) { @@ -1291,12 +1296,7 @@ poppler_page_get_link_mapping (PopplerPage *page) mapping->area.x2 = rect.x2; mapping->area.y2 = rect.y2; } - - mapping->area.x1 -= page->page->getCropBox()->x1; - mapping->area.x2 -= page->page->getCropBox()->x1; - mapping->area.y1 -= page->page->getCropBox()->y1; - mapping->area.y2 -= page->page->getCropBox()->y1; - + map_list = g_list_prepend (map_list, mapping); } @@ -1449,10 +1449,10 @@ poppler_page_get_annot_mapping (PopplerPage *page) } annot_rect = annot->getRect (); - rect.x1 = annot_rect->x1; - rect.y1 = annot_rect->y1; - rect.x2 = annot_rect->x2; - rect.y2 = annot_rect->y2; + rect.x1 = annot_rect->x1 - page->page->getCropBox()->x1; + rect.y1 = annot_rect->y1 - page->page->getCropBox()->y1; + rect.x2 = annot_rect->x2 - page->page->getCropBox()->x1; + rect.y2 = annot_rect->y2 - page->page->getCropBox()->y1; if (! (annot->getFlags () & Annot::flagNoRotate)) rotation = page->page->getRotate (); @@ -1484,11 +1484,6 @@ poppler_page_get_annot_mapping (PopplerPage *page) mapping->area.y2 = rect.y2; } - mapping->area.x1 -= page->page->getCropBox()->x1; - mapping->area.x2 -= page->page->getCropBox()->x1; - mapping->area.y1 -= page->page->getCropBox()->y1; - mapping->area.y2 -= page->page->getCropBox()->y1; - map_list = g_list_prepend (map_list, mapping); } From aacid at kde.org Sun Jun 20 07:43:44 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 20 Jun 2010 15:43:44 +0100 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <201006182143.54507.aacid@kde.org> References: <4C191E61.9050702@users.sourceforge.net> <201006182143.54507.aacid@kde.org> Message-ID: <201006201543.44620.aacid@kde.org> A Divendres, 18 de juny de 2010, Albert Astals Cid va escriure: > A Dimecres, 16 de juny de 2010, Christian Feuersaenger va escriure: > > Dear Poppler Developers, > > > > attached you find my bugfix proposal to improve rendering of Type 4/5 > > Shadings (Gouraud Interpolated Triangle Shadings). > > > > What it does is: > > 1. implement the Function lookup to fix buggy display of parameterized > > shadings, > > > > 2. Improve the triangle refinement control such that it runs 5 times > > faster, > > > > 3. Share path memory between successive flat triangles which gains > > another 10% runtime improvement (avoids many new/delete operations). > > > > I believe the changes are stable and should work without problems. The > > attached patch file patches against branch poppler-0.14 . Note that I > > changed the access policies to GfxSubPath: it has no setter methods > > which allows to re-use the same path with different coordinates (Point 3 > > of the list above). > > I'm running the regression testing with your patch, if no regressions are > detected then we can look at the code and see if we like it or not :D > > Thanks for the patch :-) Passed the regression testing fine, will have a look at the code later today. Albert > > Albert > > > Looking forward to your opinions, > > > > best regards > > > > Christian > > > > PS > > I will send patch files for the implemented draft of *real* gouraud > > interpolated shadings when they become more or less stable. > > > > Am 14.06.2010 23:07, schrieb Albert Astals Cid: > > > A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: > > >> Hi Albert, > > >> > > >> thank you for the fast reply and your positive answer! > > >> > > >> I will use the next days to apply the xpdf patches to libpoppler. > > >> > > >> I intent to patch the patched triangle refinement to your stable > > >> branch, which appears to be the poppler-0.14 (?). I consider it to be > > >> a bugfix. > > > > > > Right poppler 0.14 is our stable branch. > > > > > >> The interpolated shader is not yet stable and may need some revisions. > > >> I will continue working on it, preferrable on a separate branch. If > > >> you like, I can try to make a www git repository somewhere such that > > >> you can fetch my changes and merge them to whereever you want. > > > > > > Personally i'd prefer that you send the patches to the mailing list, > > > makes easier for more people to see them and comment if they feel like. > > > > > > Albert > > > > > >> For the moment, you find my test.pdf attached. it has been generated > > >> with latex and the unstable version of \usepackage{pgfplots}, > > >> http://pgfplots.sourceforge.net/; I also attached the .tex sources. > > >> > > >> So, thank you for the positive feedback. > > >> > > >> Best regards > > >> > > >> Christian > > >> > > >> >> > I am sure my additions are valueable and propose them for > > >> >> > usage in libpoppler: the bugfix/speed improvement is > > >> >> > directly usable and > > >> > > >> stable > > >> > > >> >> > and the lowlevel shader will need some more time. I could > > >> >> > also > > >> > > >> use some > > >> > > >> >> > advice to get the integration with transparency, blending > > >> >> > and > > >> > > >> whatever > > >> > > >> >> > correctly. I started with the xpdf sources, so I would also > > >> > > >> appreciate > > >> > > >> >> > any hints how you communicate changes between xpdf and > > >> >> > libpoppler > > >> > > >> if you > > >> > > >> >> > are interested in my proposal. > > >> > > > >> > Yes, we are interested in your patches, basically what we would > > >> > need > > >> > > >> you is to > > >> > > >> > provide a patch over poppler sources, you can choose wheter you > > >> > want > > >> > > >> to make > > >> > > >> > it against git master branch, git poppler-0.14 branch or the > > >> > released > > >> > > >> 0.14.0 > > >> > > >> > tarball. > > >> > > > >> > Also it would be interesting to have the PDF you have used for > > >> > testing. > > >> > > > >> > Thanks, > > >> > > > >> > Albert > > >> > > >> _______________________________________________ > > >> poppler mailing list > > >> poppler at lists.freedesktop.org > > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > _______________________________________________ > > > poppler mailing list > > > poppler at lists.freedesktop.org > > > http://lists.freedesktop.org/mailman/listinfo/poppler > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From srinivas.adicherla at gmail.com Sun Jun 20 23:42:42 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Mon, 21 Jun 2010 12:12:42 +0530 Subject: [poppler] Patch go Get PDF ID Message-ID: Hi, I made some changes to the recent patch. I removed the function setID(). Please let me know when you commit this patch. Thanks & regards A Srinivas -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler.patch Type: text/x-patch Size: 7129 bytes Desc: not available URL: From carlosgc at kemper.freedesktop.org Mon Jun 21 08:24:51 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Mon, 21 Jun 2010 08:24:51 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - poppler/GfxState.cc Message-ID: <20100621152451.8D82110057@kemper.freedesktop.org> poppler/GfxState.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit ef199a210394a0935b83156795c3b09c37dfc7e4 Author: Carlos Garcia Campos Date: Mon Jun 21 17:19:22 2010 +0200 Reduce pow operations in GfxCalRGBColorSpace::getXYZ() We were doing the same pow operation 3 times!. It makes document attached to bug #28591 render a little faster. diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 76cb010..61dac24 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -909,12 +909,12 @@ void GfxCalRGBColorSpace::getXYZ(GfxColor *color, double *pX, double *pY, double *pZ) { double A, B, C; - A = colToDbl(color->c[0]); - B = colToDbl(color->c[1]); - C = colToDbl(color->c[2]); - *pX = mat[0]*pow(A,gammaR)+mat[3]*pow(B,gammaG)+mat[6]*pow(C,gammaB); - *pY = mat[1]*pow(A,gammaR)+mat[4]*pow(B,gammaG)+mat[7]*pow(C,gammaB); - *pZ = mat[2]*pow(A,gammaR)+mat[5]*pow(B,gammaG)+mat[8]*pow(C,gammaB); + A = pow(colToDbl(color->c[0]), gammaR); + B = pow(colToDbl(color->c[1]), gammaG); + C = pow(colToDbl(color->c[2]), gammaB); + *pX = mat[0] * A + mat[3] * B + mat[6] * C; + *pY = mat[1] * A + mat[4] * B + mat[7] * C; + *pZ = mat[2] * A + mat[5] * B + mat[8] * C; } void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) { From carlosgc at kemper.freedesktop.org Mon Jun 21 08:25:03 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Mon, 21 Jun 2010 08:25:03 -0700 (PDT) Subject: [poppler] poppler/GfxState.cc Message-ID: <20100621152503.3467110057@kemper.freedesktop.org> poppler/GfxState.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 65c14073a3b1035ca5fe3bd6667abd315272841e Author: Carlos Garcia Campos Date: Mon Jun 21 17:19:22 2010 +0200 Reduce pow operations in GfxCalRGBColorSpace::getXYZ() We were doing the same pow operation 3 times!. It makes document attached to bug #28591 render a little faster. diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 76cb010..61dac24 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -909,12 +909,12 @@ void GfxCalRGBColorSpace::getXYZ(GfxColor *color, double *pX, double *pY, double *pZ) { double A, B, C; - A = colToDbl(color->c[0]); - B = colToDbl(color->c[1]); - C = colToDbl(color->c[2]); - *pX = mat[0]*pow(A,gammaR)+mat[3]*pow(B,gammaG)+mat[6]*pow(C,gammaB); - *pY = mat[1]*pow(A,gammaR)+mat[4]*pow(B,gammaG)+mat[7]*pow(C,gammaB); - *pZ = mat[2]*pow(A,gammaR)+mat[5]*pow(B,gammaG)+mat[8]*pow(C,gammaB); + A = pow(colToDbl(color->c[0]), gammaR); + B = pow(colToDbl(color->c[1]), gammaG); + C = pow(colToDbl(color->c[2]), gammaB); + *pX = mat[0] * A + mat[3] * B + mat[6] * C; + *pY = mat[1] * A + mat[4] * B + mat[7] * C; + *pZ = mat[2] * A + mat[5] * B + mat[8] * C; } void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) { From aacid at kemper.freedesktop.org Mon Jun 21 11:25:06 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 11:25:06 -0700 (PDT) Subject: [poppler] 2 commits - poppler/Catalog.cc poppler/DCTStream.cc poppler/DCTStream.h poppler/GfxFont.cc poppler/GfxState.cc poppler/JPEG2000Stream.cc poppler/JPEG2000Stream.h poppler/Link.cc poppler/Object.h poppler/Stream.cc poppler/Stream.h Message-ID: <20100621182507.A8E1CF811A@kemper.freedesktop.org> poppler/Catalog.cc | 12 ---- poppler/DCTStream.cc | 51 ++++++++++++++----- poppler/DCTStream.h | 3 + poppler/GfxFont.cc | 22 +------- poppler/GfxState.cc | 36 ++++---------- poppler/JPEG2000Stream.cc | 67 +++++++------------------- poppler/JPEG2000Stream.h | 38 ++++++++++++++ poppler/Link.cc | 14 +---- poppler/Object.h | 4 + poppler/Stream.cc | 90 +++++++++++++++++++---------------- poppler/Stream.h | 118 +++++++++++++++++++++++++++++++++++++++++++++- 11 files changed, 282 insertions(+), 173 deletions(-) New commits: commit 58a53ca0a4e8434e8478f8fe121067dcf05c017d Author: Albert Astals Cid Date: Mon Jun 21 19:24:20 2010 +0100 sqrt is much faster than pow 0.5 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index b7dd8c7..7140efc 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -965,9 +965,9 @@ void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r), 0.5)); - rgb->g = dblToCol(pow(clip01(g), 0.5)); - rgb->b = dblToCol(pow(clip01(b), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r))); + rgb->g = dblToCol(sqrt(clip01(g))); + rgb->b = dblToCol(sqrt(clip01(b))); } void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { commit bf86a9fc464aca57ebec207a213dcc2cc6031940 Author: Albert Astals Cid Date: Mon Jun 21 19:20:47 2010 +0100 introduce getChars to save some method calls Can give us a decent speedup when we go a lot though this methods diff --git a/poppler/Catalog.cc b/poppler/Catalog.cc index 900cdd7..dbf9af2 100644 --- a/poppler/Catalog.cc +++ b/poppler/Catalog.cc @@ -192,7 +192,6 @@ GooString *Catalog::readMetadata() { GooString *s; Dict *dict; Object obj; - int c; if (metadata.isNone()) { Object catDict; @@ -217,10 +216,7 @@ GooString *Catalog::readMetadata() { } obj.free(); s = new GooString(); - metadata.streamReset(); - while ((c = metadata.streamGetChar()) != EOF) { - s->append(c); - } + metadata.getStream()->fillGooString(s); metadata.streamClose(); return s; } @@ -409,11 +405,7 @@ GooString *Catalog::getJS(int i) else if (obj2.isStream()) { Stream *stream = obj2.getStream(); js = new GooString(); - stream->reset(); - int j; - while ((j = stream->getChar()) != EOF) { - js->append((char)j); - } + stream->fillGooString(js); } obj2.free(); obj.free(); diff --git a/poppler/DCTStream.cc b/poppler/DCTStream.cc index 5cbaced..1b15619 100644 --- a/poppler/DCTStream.cc +++ b/poppler/DCTStream.cc @@ -145,27 +145,48 @@ void DCTStream::reset() { } } +// we can not go with inline since gcc +// refuses to inline because of setjmp +#define DO_GET_CHAR \ + if (current == limit) { \ + if (cinfo.output_scanline < cinfo.output_height) \ + { \ + if (!setjmp(src.setjmp_buffer)) \ + { \ + if (!jpeg_read_scanlines(&cinfo, row_buffer, 1)) c = EOF; \ + else { \ + current = &row_buffer[0][0]; \ + limit = &row_buffer[0][(cinfo.output_width - 1) * cinfo.output_components] + cinfo.output_components; \ + c = *current; \ + ++current; \ + } \ + } \ + else c = EOF; \ + } \ + else c = EOF; \ + } else { \ + c = *current; \ + ++current; \ + } \ + int DCTStream::getChar() { int c; - if (current == limit) { - if (cinfo.output_scanline < cinfo.output_height) - { - if (!setjmp(src.setjmp_buffer)) - { - if (!jpeg_read_scanlines(&cinfo, row_buffer, 1)) return EOF; - current = &row_buffer[0][0]; - limit = &row_buffer[0][(cinfo.output_width - 1) * cinfo.output_components] + cinfo.output_components; - } - else return EOF; - } - else return EOF; - } - c = *current; - ++current; + DO_GET_CHAR + return c; } +int DCTStream::getChars(int nChars, Guchar *buffer) { + int c; + for (int i = 0; i < nChars; ++i) { + DO_GET_CHAR + if (likely(c != EOF)) buffer[i] = c; + else return i; + } + return nChars; +} + int DCTStream::lookChar() { return *current; } diff --git a/poppler/DCTStream.h b/poppler/DCTStream.h index 6768ff2..65196ec 100644 --- a/poppler/DCTStream.h +++ b/poppler/DCTStream.h @@ -69,6 +69,9 @@ public: private: void init(); + virtual GBool hasGetChars() { return true; } + virtual int getChars(int nChars, Guchar *buffer); + JSAMPLE *current; JSAMPLE *limit; struct jpeg_decompress_struct cinfo; diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc index f823faf..aeab6f3 100644 --- a/poppler/GfxFont.cc +++ b/poppler/GfxFont.cc @@ -10,7 +10,7 @@ // // Modified under the Poppler project - http://poppler.freedesktop.org // -// Copyright (C) 2005, 2006, 2008, 2009 Albert Astals Cid +// Copyright (C) 2005, 2006, 2008-2010 Albert Astals Cid // Copyright (C) 2005, 2006 Kristian H??gsberg // Copyright (C) 2006 Takashi Iwai // Copyright (C) 2007 Julien Rebetez @@ -421,17 +421,13 @@ CharCodeToUnicode *GfxFont::readToUnicodeCMap(Dict *fontDict, int nBits, CharCodeToUnicode *ctu) { GooString *buf; Object obj1; - int c; if (!fontDict->lookup("ToUnicode", &obj1)->isStream()) { obj1.free(); return NULL; } buf = new GooString(); - obj1.streamReset(); - while ((c = obj1.streamGetChar()) != EOF) { - buf->append(c); - } + obj1.getStream()->fillGooString(buf); obj1.streamClose(); obj1.free(); if (ctu) { @@ -488,8 +484,6 @@ char *GfxFont::readEmbFontFile(XRef *xref, int *len) { char *buf; Object obj1, obj2; Stream *str; - int c; - int size, i; obj1.initRef(embFontID.num, embFontID.gen); obj1.fetch(xref, &obj2); @@ -503,17 +497,7 @@ char *GfxFont::readEmbFontFile(XRef *xref, int *len) { } str = obj2.getStream(); - buf = NULL; - i = size = 0; - str->reset(); - while ((c = str->getChar()) != EOF) { - if (i == size) { - size += 4096; - buf = (char *)grealloc(buf, size); - } - buf[i++] = c; - } - *len = i; + buf = (char*)str->toUnsignedChars(len); str->close(); obj2.free(); diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 61dac24..b7dd8c7 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -1484,22 +1484,11 @@ GfxColorSpace *GfxICCBasedColorSpace::parse(Array *arr, Gfx *gfx) { arr->get(1, &obj1); dict = obj1.streamGetDict(); Guchar *profBuf; - unsigned int bufSize; Stream *iccStream = obj1.getStream(); - int c; - unsigned int size = 0; - - bufSize = 65536; - profBuf = (Guchar *)gmallocn(bufSize,1); - iccStream->reset(); - while ((c = iccStream->getChar()) != EOF) { - if (bufSize <= size) { - bufSize += 65536; - profBuf = (Guchar *)greallocn(profBuf,bufSize,1); - } - profBuf[size++] = c; - } - cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,size); + int length = 0; + + profBuf = iccStream->toUnsignedChars(&length, 65536, 65536); + cmsHPROFILE hp = cmsOpenProfileFromMem(profBuf,length); gfree(profBuf); if (hp == 0) { error(-1, "read ICCBased color space profile error"); @@ -1718,7 +1707,6 @@ GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, Gfx *gfx) { GfxColorSpace *baseA; int indexHighA; Object obj1; - int x; char *s; int n, i, j; @@ -1755,12 +1743,10 @@ GfxColorSpace *GfxIndexedColorSpace::parse(Array *arr, Gfx *gfx) { if (obj1.isStream()) { obj1.streamReset(); for (i = 0; i <= indexHighA; ++i) { - for (j = 0; j < n; ++j) { - if ((x = obj1.streamGetChar()) == EOF) { - error(-1, "Bad Indexed color space (lookup table stream too short) padding with zeroes"); - x = 0; - } - cs->lookup[i*n + j] = (Guchar)x; + const int readChars = obj1.streamGetChars(n, &cs->lookup[i*n]); + for (j = readChars; j < n; ++j) { + error(-1, "Bad Indexed color space (lookup table stream too short) padding with zeroes"); + cs->lookup[i*n + j] = 0; } } obj1.streamClose(); diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc index 3b301f7..d52f088 100644 --- a/poppler/JPEG2000Stream.cc +++ b/poppler/JPEG2000Stream.cc @@ -4,7 +4,7 @@ // // A JPX stream decoder using OpenJPEG // -// Copyright 2008, 2009 Albert Astals Cid +// Copyright 2008-2010 Albert Astals Cid // // Licensed under GPLv2 or later // @@ -43,42 +43,34 @@ int JPXStream::getPos() { return counter; } +int JPXStream::getChars(int nChars, Guchar *buffer) { + for (int i = 0; i < nChars; ++i) { + const int c = doGetChar(); + if (likely(c != EOF)) buffer[i] = c; + else return i; + } + return nChars; +} + int JPXStream::getChar() { - int result = lookChar(); - ++counter; - return result; + return doGetChar(); } -#define BUFFER_INCREASE 4096 +#define BUFFER_INITIAL_SIZE 4096 void JPXStream::init() { Object oLen; if (getDict()) getDict()->lookup("Length", &oLen); - int bufSize = BUFFER_INCREASE; + int bufSize = BUFFER_INITIAL_SIZE; if (oLen.isInt()) bufSize = oLen.getInt(); oLen.free(); - unsigned char *buf = (unsigned char*)gmallocn(bufSize, sizeof(unsigned char)); - int index = 0; - - str->reset(); - int c = str->getChar(); - while(c != EOF) - { - if (index >= bufSize) - { - bufSize += BUFFER_INCREASE; - buf = (unsigned char*)greallocn(buf, bufSize, sizeof(unsigned char)); - } - buf[index] = c; - ++index; - c = str->getChar(); - } - - init2(buf, index, CODEC_JP2); - + + int length = 0; + unsigned char *buf = str->toUnsignedChars(&length, bufSize); + init2(buf, length, CODEC_JP2); free(buf); counter = 0; @@ -143,30 +135,7 @@ error: } int JPXStream::lookChar() { - if (inited == gFalse) init(); - - if (!image) return EOF; - - int w = image->comps[0].w; - int h = image->comps[0].h; - - int y = (counter / image->numcomps) / w; - int x = (counter / image->numcomps) % w; - if (y >= h) return EOF; - - int component = counter % image->numcomps; - - int adjust = 0; - if (image->comps[component].prec > 8) { - adjust = image->comps[component].prec - 8; - } - - int r = image->comps[component].data[y * w + x]; - r += (image->comps[component].sgnd ? 1 << (image->comps[0].prec - 1) : 0); - - unsigned char rc = (unsigned char) ((r >> adjust)+((r >> (adjust-1))%2)); - - return rc; + return doLookChar(); } GooString *JPXStream::getPSFilter(int psLevel, char *indent) { diff --git a/poppler/JPEG2000Stream.h b/poppler/JPEG2000Stream.h index ea32093..adec1c3 100644 --- a/poppler/JPEG2000Stream.h +++ b/poppler/JPEG2000Stream.h @@ -4,7 +4,7 @@ // // A JPX stream decoder using OpenJPEG // -// Copyright 2008 Albert Astals Cid +// Copyright 2008, 2010 Albert Astals Cid // // Licensed under GPLv2 or later // @@ -39,6 +39,42 @@ private: void init(); void init2(unsigned char *buf, int bufLen, OPJ_CODEC_FORMAT format); + virtual GBool hasGetChars() { return true; } + virtual int getChars(int nChars, Guchar *buffer); + + inline int doGetChar() { + int result = doLookChar(); + ++counter; + return result; + } + + inline int doLookChar() { + if (inited == gFalse) init(); + + if (!image) return EOF; + + int w = image->comps[0].w; + int h = image->comps[0].h; + + int y = (counter / image->numcomps) / w; + int x = (counter / image->numcomps) % w; + if (y >= h) return EOF; + + int component = counter % image->numcomps; + + int adjust = 0; + if (image->comps[component].prec > 8) { + adjust = image->comps[component].prec - 8; + } + + int r = image->comps[component].data[y * w + x]; + r += (image->comps[component].sgnd ? 1 << (image->comps[0].prec - 1) : 0); + + unsigned char rc = (unsigned char) ((r >> adjust)+((r >> (adjust-1))%2)); + + return rc; + } + opj_image_t *image; opj_dinfo_t *dinfo; int counter; diff --git a/poppler/Link.cc b/poppler/Link.cc index 5d7b779..b6d7f2d 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -16,7 +16,7 @@ // Copyright (C) 2006, 2008 Pino Toscano // Copyright (C) 2007,2010 Carlos Garcia Campos // Copyright (C) 2008 Hugo Mercier -// Copyright (C) 2008, 2009 Albert Astals Cid +// Copyright (C) 2008-2010 Albert Astals Cid // Copyright (C) 2009 Kovid Goyal // Copyright (C) 2009 Ilya Gorenbein // @@ -704,11 +704,7 @@ LinkRendition::LinkRendition(Object *obj) { } else if (tmp.isStream()) { Stream *stream = tmp.getStream(); js = new GooString(); - stream->reset(); - int i; - while ((i = stream->getChar()) != EOF) { - js->append((char)i); - } + stream->fillGooString(js); } else { error(-1, "Invalid Rendition Action: JS not string or stream"); } @@ -766,11 +762,7 @@ LinkJavaScript::LinkJavaScript(Object *jsObj) { else if (jsObj->isStream()) { Stream *stream = jsObj->getStream(); js = new GooString(); - stream->reset(); - int i; - while ((i = stream->getChar()) != EOF) { - js->append((char)i); - } + stream->fillGooString(js); } } diff --git a/poppler/Object.h b/poppler/Object.h index 3038d0c..6d60d0f 100644 --- a/poppler/Object.h +++ b/poppler/Object.h @@ -223,6 +223,7 @@ public: void streamReset(); void streamClose(); int streamGetChar(); + int streamGetChars(int nChars, Guchar *buffer); int streamLookChar(); char *streamGetLine(char *buf, int size); Guint streamGetPos(); @@ -334,6 +335,9 @@ inline void Object::streamClose() inline int Object::streamGetChar() { OBJECT_TYPE_CHECK(objStream); return stream->getChar(); } +inline int Object::streamGetChars(int nChars, Guchar *buffer) + { OBJECT_TYPE_CHECK(objStream); return stream->doGetChars(nChars, buffer); } + inline int Object::streamLookChar() { OBJECT_TYPE_CHECK(objStream); return stream->lookChar(); } diff --git a/poppler/Stream.cc b/poppler/Stream.cc index 0771e25..988f99a 100644 --- a/poppler/Stream.cc +++ b/poppler/Stream.cc @@ -14,7 +14,7 @@ // under GPL version 2 or later // // Copyright (C) 2005 Jeff Muizelaar -// Copyright (C) 2006-2009 Albert Astals Cid +// Copyright (C) 2006-2010 Albert Astals Cid // Copyright (C) 2007 Krzysztof Kowalczyk // Copyright (C) 2008 Julien Rebetez // Copyright (C) 2009 Carlos Garcia Campos @@ -99,6 +99,15 @@ int Stream::getRawChar() { return EOF; } +int Stream::getChars(int nChars, Guchar *buffer) { + error(-1, "Internal: called getChars() on non-predictor stream"); + return 0; +} + +void Stream::getRawChars(int nChars, int *buffer) { + error(-1, "Internal: called getRawChars() on non-predictor stream"); +} + char *Stream::getLine(char *buf, int size) { int i; int c; @@ -461,9 +470,8 @@ Guchar *ImageStream::getLine() { } } else if (nBits == 8) { Guchar *line = imgLine; - for (i = 0; i < nVals; ++i) { - *line++ = str->getChar(); - } + int readChars = str->doGetChars(nVals, line); + for ( ; readChars < nVals; readChars++) line[readChars] = EOF; } else if (nBits == 16) { // this is a hack to support 16 bits images, everywhere // we assume a component fits in 8 bits, with this hack @@ -543,12 +551,17 @@ int StreamPredictor::lookChar() { } int StreamPredictor::getChar() { - if (predIdx >= rowBytes) { - if (!getNextLine()) { - return EOF; - } + return doGetChar(); +} + +int StreamPredictor::getChars(int nChars, Guchar *buffer) +{ + for (int i = 0; i < nChars; ++i) { + const int c = doGetChar(); + if (likely(c != EOF)) buffer[i] = c; + else return i; } - return predLine[predIdx++]; + return nChars; } GBool StreamPredictor::getNextLine() { @@ -571,13 +584,15 @@ GBool StreamPredictor::getNextLine() { } // read the raw line, apply PNG (byte) predictor + int *rawCharLine = new int[rowBytes - pixBytes]; + str->getRawChars(rowBytes - pixBytes, rawCharLine); memset(upLeftBuf, 0, pixBytes + 1); for (i = pixBytes; i < rowBytes; ++i) { for (j = pixBytes; j > 0; --j) { upLeftBuf[j] = upLeftBuf[j-1]; } upLeftBuf[0] = predLine[i]; - if ((c = str->getRawChar()) == EOF) { + if ((c = rawCharLine[i - pixBytes]) == EOF) { if (i > pixBytes) { // this ought to return false, but some (broken) PDF files // contain truncated image data, and Adobe apparently reads the @@ -621,6 +636,7 @@ GBool StreamPredictor::getNextLine() { break; } } + delete[] rawCharLine; // apply TIFF (component) predictor if (predictor == 2) { @@ -1237,16 +1253,13 @@ int LZWStream::lookChar() { return seqBuf[seqIndex]; } +void LZWStream::getRawChars(int nChars, int *buffer) { + for (int i = 0; i < nChars; ++i) + buffer[i] = doGetRawChar(); +} + int LZWStream::getRawChar() { - if (eof) { - return EOF; - } - if (seqIndex >= seqLength) { - if (!processNextCode()) { - return EOF; - } - } - return seqBuf[seqIndex++]; + return doGetRawChar(); } void LZWStream::reset() { @@ -4231,20 +4244,20 @@ void FlateStream::reset() { } int FlateStream::getChar() { - int c; + return doGetChar(); +} +int FlateStream::getChars(int nChars, Guchar *buffer) { if (pred) { - return pred->getChar(); - } - while (remain == 0) { - if (endOfBlock && eof) - return EOF; - readSome(); + return pred->getChars(nChars, buffer); + } else { + for (int i = 0; i < nChars; ++i) { + const int c = doGetChar(); + if (likely(c != EOF)) buffer[i] = c; + else return i; + } + return nChars; } - c = buf[index]; - index = (index + 1) & flateMask; - --remain; - return c; } int FlateStream::lookChar() { @@ -4262,18 +4275,13 @@ int FlateStream::lookChar() { return c; } -int FlateStream::getRawChar() { - int c; +void FlateStream::getRawChars(int nChars, int *buffer) { + for (int i = 0; i < nChars; ++i) + buffer[i] = doGetRawChar(); +} - while (remain == 0) { - if (endOfBlock && eof) - return EOF; - readSome(); - } - c = buf[index]; - index = (index + 1) & flateMask; - --remain; - return c; +int FlateStream::getRawChar() { + return doGetRawChar(); } GooString *FlateStream::getPSFilter(int psLevel, char *indent) { diff --git a/poppler/Stream.h b/poppler/Stream.h index 49ae8fb..583278f 100644 --- a/poppler/Stream.h +++ b/poppler/Stream.h @@ -15,7 +15,7 @@ // // Copyright (C) 2005 Jeff Muizelaar // Copyright (C) 2008 Julien Rebetez -// Copyright (C) 2008 Albert Astals Cid +// Copyright (C) 2008, 2010 Albert Astals Cid // Copyright (C) 2009 Carlos Garcia Campos // Copyright (C) 2009 Stefan Thomas // Copyright (C) 2010 Hib Eris @@ -106,6 +106,56 @@ public: // Close down the stream. virtual void close(); + inline int doGetChars(int nChars, Guchar *buffer) + { + if (hasGetChars()) { + return getChars(nChars, buffer); + } else { + for (int i = 0; i < nChars; ++i) { + const int c = getChar(); + if (likely(c != EOF)) buffer[i] = c; + else return i; + } + return nChars; + } + } + + inline void fillGooString(GooString *s) + { + Guchar readBuf[4096]; + int readChars; + reset(); + while ((readChars = doGetChars(4096, readBuf)) != 0) { + s->append((const char *)readBuf, readChars); + } + } + + inline Guchar *toUnsignedChars(int *length, int initialSize = 4096, int sizeIncrement = 4096) + { + int readChars; + Guchar *buf = (Guchar *)gmalloc(initialSize); + int size = initialSize; + *length = 0; + int charsToRead = initialSize; + bool continueReading = true; + reset(); + while (continueReading && (readChars = doGetChars(charsToRead, &buf[*length])) != 0) { + *length += readChars; + if (readChars == charsToRead) { + if (lookChar() != EOF) { + size += sizeIncrement; + charsToRead = initialSize; + buf = (Guchar *)grealloc(buf, size); + } else { + continueReading = false; + } + } else { + continueReading = false; + } + } + return buf; + } + // Get next char from stream. virtual int getChar() = 0; @@ -115,6 +165,7 @@ public: // Get next char from stream without using the predictor. // This is only used by StreamPredictor. virtual int getRawChar(); + virtual void getRawChars(int nChars, int *buffer); // Get next char directly from stream source, without filtering it virtual int getUnfilteredChar () = 0; @@ -166,6 +217,8 @@ public: Stream *addFilters(Object *dict); private: + virtual GBool hasGetChars() { return false; } + virtual int getChars(int nChars, Guchar *buffer); Stream *makeFilter(char *name, Stream *str, Object *params); @@ -347,11 +400,21 @@ public: int lookChar(); int getChar(); + int getChars(int nChars, Guchar *buffer); private: GBool getNextLine(); + inline int doGetChar() { + if (predIdx >= rowBytes) { + if (!getNextLine()) { + return EOF; + } + } + return predLine[predIdx++]; + } + Stream *str; // base stream int predictor; // predictor int width; // pixels per line @@ -383,7 +446,7 @@ public: virtual void reset(); virtual void close(); virtual int getChar() - { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + { return doGetChar(); } virtual int lookChar() { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr & 0xff); } virtual int getPos() { return bufPos + (bufPtr - buf); } @@ -397,6 +460,20 @@ public: private: GBool fillBuf(); + + inline int doGetChar() + { return (bufPtr >= bufEnd && !fillBuf()) ? EOF : (*bufPtr++ & 0xff); } + + virtual GBool hasGetChars() { return true; } + virtual int getChars(int nChars, Guchar *buffer) + { + for (int i = 0; i < nChars; ++i) { + const int c = doGetChar(); + if (likely(c != EOF)) buffer[i] = c; + else return i; + } + return nChars; + } FILE *f; Guint start; @@ -596,11 +673,24 @@ public: virtual int getChar(); virtual int lookChar(); virtual int getRawChar(); + virtual void getRawChars(int nChars, int *buffer); virtual GooString *getPSFilter(int psLevel, char *indent); virtual GBool isBinary(GBool last = gTrue); private: + inline int doGetRawChar() { + if (eof) { + return EOF; + } + if (seqIndex >= seqLength) { + if (!processNextCode()) { + return EOF; + } + } + return seqBuf[seqIndex++]; + } + StreamPredictor *pred; // predictor int early; // early parameter GBool eof; // true if at eof @@ -855,11 +945,35 @@ public: virtual int getChar(); virtual int lookChar(); virtual int getRawChar(); + virtual void getRawChars(int nChars, int *buffer); virtual GooString *getPSFilter(int psLevel, char *indent); virtual GBool isBinary(GBool last = gTrue); virtual void unfilteredReset (); private: + inline int doGetRawChar() { + int c; + + while (remain == 0) { + if (endOfBlock && eof) + return EOF; + readSome(); + } + c = buf[index]; + index = (index + 1) & flateMask; + --remain; + return c; + } + + inline int doGetChar() { + if (pred) { + return pred->getChar(); + } + return doGetRawChar(); + } + + virtual GBool hasGetChars() { return true; } + virtual int getChars(int nChars, Guchar *buffer); StreamPredictor *pred; // predictor Guchar buf[flateWindow]; // output data buffer From aacid at kemper.freedesktop.org Mon Jun 21 11:25:31 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 11:25:31 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - poppler/GfxState.cc Message-ID: <20100621182531.A917810057@kemper.freedesktop.org> poppler/GfxState.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) New commits: commit 34bed828d9165a6b21db9e00591c170d4700506e Author: Albert Astals Cid Date: Mon Jun 21 19:24:20 2010 +0100 sqrt is much faster than pow 0.5 diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 61dac24..4f83e61 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -965,9 +965,9 @@ void GfxCalRGBColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r), 0.5)); - rgb->g = dblToCol(pow(clip01(g), 0.5)); - rgb->b = dblToCol(pow(clip01(b), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r))); + rgb->g = dblToCol(sqrt(clip01(g))); + rgb->b = dblToCol(sqrt(clip01(b))); } void GfxCalRGBColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { From aacid at kde.org Mon Jun 21 11:28:33 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 19:28:33 +0100 Subject: [poppler] Addition of stream::getChars In-Reply-To: <201006141913.44053.aacid@kde.org> References: <201006141913.44053.aacid@kde.org> Message-ID: <201006211928.33524.aacid@kde.org> A Dilluns, 14 de juny de 2010, Albert Astals Cid va escriure: > Hi, this patch implements getChars as improvement to the getChar interface, > just by making the number of function calls smaller, i get around 10% speed > improvements in PDF files like 28225 and thought the number of changed > lines is quite big it doesn't add much code duplication (it removes some) > so it should not make code more difficult to maintain. > > I've run it thorugh my test suite and did get 100% exact results as the one > we get now. > > If noone disagrees i'll commit it to trunk on wednesday european night. I've just commited it to master. Albert > > Albert From aacid at kemper.freedesktop.org Mon Jun 21 12:38:22 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 12:38:22 -0700 (PDT) Subject: [poppler] poppler/GfxState.cc Message-ID: <20100621193823.4F08210057@kemper.freedesktop.org> poppler/GfxState.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 38e5d28a184d0ca8df71a7ea910ce85d7a225e4e Author: Albert Astals Cid Date: Mon Jun 21 20:38:00 2010 +0100 more pow 0.5 -> sqrt diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 7140efc..fe3ee77 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -672,9 +672,9 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r * kr))); + rgb->g = dblToCol(sqrt(clip01(g * kg))); + rgb->b = dblToCol(sqrt(clip01(b * kb))); rgb->r = rgb->g = rgb->b = clip01(color->c[0]); } @@ -1246,9 +1246,9 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r * kr))); + rgb->g = dblToCol(sqrt(clip01(g * kg))); + rgb->b = dblToCol(sqrt(clip01(b * kb))); } void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { From aacid at kemper.freedesktop.org Mon Jun 21 12:38:48 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 12:38:48 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - poppler/GfxState.cc Message-ID: <20100621193848.8814910057@kemper.freedesktop.org> poppler/GfxState.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) New commits: commit 714db8900b2f72bd63811a16bfb81beb23397bba Author: Albert Astals Cid Date: Mon Jun 21 20:38:00 2010 +0100 more pow 0.5 -> sqrt diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc index 4f83e61..b59a478 100644 --- a/poppler/GfxState.cc +++ b/poppler/GfxState.cc @@ -672,9 +672,9 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r * kr))); + rgb->g = dblToCol(sqrt(clip01(g * kg))); + rgb->b = dblToCol(sqrt(clip01(b * kb))); rgb->r = rgb->g = rgb->b = clip01(color->c[0]); } @@ -1246,9 +1246,9 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB *rgb) { r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); + rgb->r = dblToCol(sqrt(clip01(r * kr))); + rgb->g = dblToCol(sqrt(clip01(g * kg))); + rgb->b = dblToCol(sqrt(clip01(b * kb))); } void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { From aacid at kde.org Mon Jun 21 15:50:22 2010 From: aacid at kde.org (Albert Astals Cid) Date: Mon, 21 Jun 2010 23:50:22 +0100 Subject: [poppler] Patch go Get PDF ID In-Reply-To: References: Message-ID: <201006212350.23148.aacid@kde.org> A Dilluns, 21 de juny de 2010, srinivas adicherla va escriure: > Hi, > > I made some changes to the recent patch. I removed the function > setID(). > > > Please let me know when you commit this patch. > > Thanks & regards > A Srinivas Hi, some minor comments, just for safety + if (obj.isNull()) + { + obj.free(); + return NULL; + } should be + if (!obj.isArray()) + { + obj.free(); + return NULL; + } And you should be checking that val1 and val2 are strings too before doing getString(). And probably you want to call Set instead of append over permanent_id and update_id. Albert From aacid at kde.org Tue Jun 22 12:49:27 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 22 Jun 2010 20:49:27 +0100 Subject: [poppler] Accessibility of PDF documents (corrected patch attached) In-Reply-To: References: <201006162344.03291.aacid@kde.org> Message-ID: <201006222049.28076.aacid@kde.org> A Dimarts, 22 de juny de 2010, leena chourey va escriure: > Dear Albert, > > Thanks for giving detail comment to patch. > Please check updates given inline: Please do not forget to CC the poppler mailing list. > > On Thu, Jun 17, 2010 at 4:14 AM, Albert Astals Cid wrote: > > A Dimecres, 16 de juny de 2010, omkar va escriure: > > > Dear Albert, > > > > > > Please find the corrected patch for "accessibility of pdf document " > > > and give your feedback. > > > > Hi, some comments: > > * The comments like > > // One more parameter(int j) is added in the getCSStyle function by CDAC > > > > developer Team > > > > need to be removed, if each line had near it who coded it, the code > > will > > > > be > > twice as big and much more unreadable > > Done, deleted all unwanted comments > > > * The spacing of your patches could be better, that is > > > > GooString* HtmlFontAccu::getCSStyle(int i, GooString* content ,int j){ > > should be > > +GooString* HtmlFontAccu::getCSStyle(int i, GooString* content, int j){ > > but that's nothing huge, i can fix it > > Updated accordingly. > > > * You are leaking (i.e. not deleting) jStr in both > > > > HtmlFontAccu::getCSStyle > > and HtmlFontAccu::CSStyle > > Deleted jStr > > > * I see that the new HtmlPage::complexHtml and the old > > > > HtmlPage::dumpComplex > > are very simple, i if you reused the code instead of copying it > > > > * This introduces a behavioural change that is unaccetable, i understand > > > > you > > want pdftohtml to produce a different (in your opinion better) output, > > for that you'll have to introduce a new comandline option to pdftohtml > > (something > > like --singlehtml) or something like that > > For last 2 point we want some clarification. > As you said behavioural change is unacceptable and also suggested to > introduce a new command line option to generate single html. So if we do as > following, will it be acceptable? > > - *Existing is:* > Command line option: pdftohtml -c > Function called: > > > dumpComplex > () > { > Read from input file > Write into file to Generates pagewise html format > } > > > - *Proposed changes:* > New Command line option : pdftohtml -s //Checked, > nothing is already defined for -s (pdftohtml -c > will exists as it is) > > > - Function called: > > dumpSingle() //new function similar to > dumpComplex { > Read from input file > Write into file to append single html format > } > > - A function to ?Read from input file? can be defined and call it in > both dumpComplex() and dumpSingle(), So that code duplication can be > removed (for second last point of your mail). > - And with -s option (for --single Html) behavioural change will be > defined separately. (-c will not be affected) To be clear, pdftohtml -c should produce exactly the same output it did before your patch, pdftohtml -s you can output your version. So yes, i think i kind of agree with your proposal. Albert > > > For your opinion > > With Regards > Leena C & Onkar P > (for CDAC Accessibility Team) From aacid at kde.org Tue Jun 22 13:19:04 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 22 Jun 2010 21:19:04 +0100 Subject: [poppler] Question about code Message-ID: <201006222119.05126.aacid@kde.org> Hi Koji, in http://cgit.freedesktop.org/poppler/poppler/commit/?id=140b8ed97416f9c2ec02eb749ca45ca50bd651a8 you added + X *= whiteX; + Y *= whiteY; + Z *= whiteZ; + // convert XYZ to RGB, including gamut mapping and gamma correction + r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; + g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; + b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; + rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); + rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); + rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); + rgb->r = rgb->g = rgb->b = clip01(color->c[0]); to GfxCalGrayColorSpace::getRGB I was having a look and it seems the + rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); + rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); + rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); calls are not really needed since we overwrite the values with + rgb->r = rgb->g = rgb->b = clip01(color->c[0]); at the end, right? Can i safely remove those lines or there is something i'm missing? Thanks, Albert From oinos at web.de Tue Jun 22 14:01:06 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Tue, 22 Jun 2010 23:01:06 +0200 Subject: [poppler] possible improvement? Message-ID: <4C212492.1030102@web.de> Hi there, I wonder whether enabling compilation with libjpeg-turbo (http://libjpeg-turbo.virtualgl.org/) would make poppler faster when rendering jpeg images. I cannot code and I don't know whether this even makes sense. But it might be worth considering. Just in case it might help, Pablo From aacid at kde.org Tue Jun 22 14:39:31 2010 From: aacid at kde.org (Albert Astals Cid) Date: Tue, 22 Jun 2010 22:39:31 +0100 Subject: [poppler] possible improvement? In-Reply-To: <4C212492.1030102@web.de> References: <4C212492.1030102@web.de> Message-ID: <201006222239.51725.aacid@kde.org> A Dimarts, 22 de juny de 2010, Pablo Rodr?guez va escriure: > Hi there, > > I wonder whether enabling compilation with libjpeg-turbo > (http://libjpeg-turbo.virtualgl.org/) would make poppler faster when > rendering jpeg images. libjpeg and libjpeg-turbo and ABI and API compatible, so there is nothing we have to do, just use libjpeg-turbo and bedone. Albert > > I cannot code and I don't know whether this even makes sense. But it > might be worth considering. > > Just in case it might help, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From srinivas.adicherla at gmail.com Tue Jun 22 22:04:55 2010 From: srinivas.adicherla at gmail.com (srinivas adicherla) Date: Wed, 23 Jun 2010 10:34:55 +0530 Subject: [poppler] poppler Digest, Vol 64, Issue 38 In-Reply-To: References: Message-ID: Hi, Thank you all once again for giving me valuable suggestions. I modified the previous patch. I attached the new patch with this mail. Iam curiously waiting for to commit my patch. Please let me know when you commit this patch. Thanks -- A Srinivas On Wed, Jun 23, 2010 at 12:30 AM, wrote: > Send poppler mailing list submissions to > poppler at lists.freedesktop.org > > To subscribe or unsubscribe via the World Wide Web, visit > http://lists.freedesktop.org/mailman/listinfo/poppler > or, via email, send a message with subject or body 'help' to > poppler-request at lists.freedesktop.org > > You can reach the person managing the list at > poppler-owner at lists.freedesktop.org > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of poppler digest..." > > > Today's Topics: > > 1. poppler/GfxState.cc (Albert Astals Cid) > 2. Branch 'poppler-0.14' - poppler/GfxState.cc (Albert Astals Cid) > 3. Re: Patch go Get PDF ID (Albert Astals Cid) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Mon, 21 Jun 2010 12:38:22 -0700 (PDT) > From: aacid at kemper.freedesktop.org (Albert Astals Cid) > Subject: [poppler] poppler/GfxState.cc > To: poppler at lists.freedesktop.org > Message-ID: <20100621193823.4F08210057 at kemper.freedesktop.org> > > poppler/GfxState.cc | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > New commits: > commit 38e5d28a184d0ca8df71a7ea910ce85d7a225e4e > Author: Albert Astals Cid > Date: Mon Jun 21 20:38:00 2010 +0100 > > more pow 0.5 -> sqrt > > diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc > index 7140efc..fe3ee77 100644 > --- a/poppler/GfxState.cc > +++ b/poppler/GfxState.cc > @@ -672,9 +672,9 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, > GfxRGB *rgb) { > r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; > g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; > b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; > - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); > - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); > - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); > + rgb->r = dblToCol(sqrt(clip01(r * kr))); > + rgb->g = dblToCol(sqrt(clip01(g * kg))); > + rgb->b = dblToCol(sqrt(clip01(b * kb))); > rgb->r = rgb->g = rgb->b = clip01(color->c[0]); > } > > @@ -1246,9 +1246,9 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB > *rgb) { > r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; > g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; > b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; > - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); > - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); > - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); > + rgb->r = dblToCol(sqrt(clip01(r * kr))); > + rgb->g = dblToCol(sqrt(clip01(g * kg))); > + rgb->b = dblToCol(sqrt(clip01(b * kb))); > } > > void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { > > > ------------------------------ > > Message: 2 > Date: Mon, 21 Jun 2010 12:38:48 -0700 (PDT) > From: aacid at kemper.freedesktop.org (Albert Astals Cid) > Subject: [poppler] Branch 'poppler-0.14' - poppler/GfxState.cc > To: poppler at lists.freedesktop.org > Message-ID: <20100621193848.8814910057 at kemper.freedesktop.org> > > poppler/GfxState.cc | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > New commits: > commit 714db8900b2f72bd63811a16bfb81beb23397bba > Author: Albert Astals Cid > Date: Mon Jun 21 20:38:00 2010 +0100 > > more pow 0.5 -> sqrt > > diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc > index 4f83e61..b59a478 100644 > --- a/poppler/GfxState.cc > +++ b/poppler/GfxState.cc > @@ -672,9 +672,9 @@ void GfxCalGrayColorSpace::getRGB(GfxColor *color, > GfxRGB *rgb) { > r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; > g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; > b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; > - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); > - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); > - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); > + rgb->r = dblToCol(sqrt(clip01(r * kr))); > + rgb->g = dblToCol(sqrt(clip01(g * kg))); > + rgb->b = dblToCol(sqrt(clip01(b * kb))); > rgb->r = rgb->g = rgb->b = clip01(color->c[0]); > } > > @@ -1246,9 +1246,9 @@ void GfxLabColorSpace::getRGB(GfxColor *color, GfxRGB > *rgb) { > r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; > g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; > b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; > - rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); > - rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); > - rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); > + rgb->r = dblToCol(sqrt(clip01(r * kr))); > + rgb->g = dblToCol(sqrt(clip01(g * kg))); > + rgb->b = dblToCol(sqrt(clip01(b * kb))); > } > > void GfxLabColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { > > > ------------------------------ > > Message: 3 > Date: Mon, 21 Jun 2010 23:50:22 +0100 > From: Albert Astals Cid > Subject: Re: [poppler] Patch go Get PDF ID > To: poppler at lists.freedesktop.org > Message-ID: <201006212350.23148.aacid at kde.org> > Content-Type: Text/Plain; charset="us-ascii" > > A Dilluns, 21 de juny de 2010, srinivas adicherla va escriure: > > Hi, > > > > I made some changes to the recent patch. I removed the function > > setID(). > > > > > > Please let me know when you commit this patch. > > > > Thanks & regards > > A Srinivas > > Hi, some minor comments, just for safety > > + if (obj.isNull()) > + { > + obj.free(); > + return NULL; > + } > > should be > > + if (!obj.isArray()) > + { > + obj.free(); > + return NULL; > + } > > And you should be checking that val1 and val2 are strings too before doing > getString(). > > And probably you want to call Set instead of append over permanent_id and > update_id. > > Albert > > > ------------------------------ > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > > > End of poppler Digest, Vol 64, Issue 38 > *************************************** > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: srinivas_poppler.patch Type: text/x-patch Size: 7308 bytes Desc: not available URL: From sho at bbr.jp Tue Jun 22 22:35:44 2010 From: sho at bbr.jp (Koji Otani) Date: Wed, 23 Jun 2010 14:35:44 +0900 (JST) Subject: [poppler] Question about code In-Reply-To: <201006222119.05126.aacid@kde.org> References: <201006222119.05126.aacid@kde.org> Message-ID: <20100623.143544.71097702.sho@bbr.jp> From: Albert Astals Cid Subject: Question about code Date: Tue, 22 Jun 2010 21:19:04 +0100 Message-ID: <201006222119.05126.aacid at kde.org> aacid> Hi Koji, in aacid> http://cgit.freedesktop.org/poppler/poppler/commit/?id=140b8ed97416f9c2ec02eb749ca45ca50bd651a8 aacid> you added aacid> aacid> + X *= whiteX; aacid> + Y *= whiteY; aacid> + Z *= whiteZ; aacid> + // convert XYZ to RGB, including gamut mapping and gamma correction aacid> + r = xyzrgb[0][0] * X + xyzrgb[0][1] * Y + xyzrgb[0][2] * Z; aacid> + g = xyzrgb[1][0] * X + xyzrgb[1][1] * Y + xyzrgb[1][2] * Z; aacid> + b = xyzrgb[2][0] * X + xyzrgb[2][1] * Y + xyzrgb[2][2] * Z; aacid> + rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); aacid> + rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); aacid> + rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); aacid> + rgb->r = rgb->g = rgb->b = clip01(color->c[0]); aacid> aacid> to GfxCalGrayColorSpace::getRGB aacid> aacid> I was having a look and it seems the aacid> + rgb->r = dblToCol(pow(clip01(r * kr), 0.5)); aacid> + rgb->g = dblToCol(pow(clip01(g * kg), 0.5)); aacid> + rgb->b = dblToCol(pow(clip01(b * kb), 0.5)); aacid> calls are not really needed since we overwrite the values with aacid> + rgb->r = rgb->g = rgb->b = clip01(color->c[0]); aacid> at the end, right? aacid> aacid> Can i safely remove those lines or there is something i'm missing? aacid> aacid> Thanks, aacid> Albert aacid> I think that we should do gamut mapping and gamma correction etc. Please remove the line: rgb->r = rgb->g = rgb->b = clip01(color->c[0]); not other lines. ---- Koji Otani From cobra.yu at hyweb.com.tw Wed Jun 23 08:42:17 2010 From: cobra.yu at hyweb.com.tw (cobra.yu) Date: Wed, 23 Jun 2010 23:42:17 +0800 (CST) Subject: [poppler] Annotation ICONs Message-ID: <1277307737.14310.cobra.yu@hyweb.com.tw> Dear All, Does Poppler provide PDF annotation icons or should users make customized icon bitmaps? Any suggestions are welcome. Tks. Cobra From aacid at kde.org Wed Jun 23 13:55:43 2010 From: aacid at kde.org (Albert Astals Cid) Date: Wed, 23 Jun 2010 21:55:43 +0100 Subject: [poppler] Annotation ICONs In-Reply-To: <1277307737.14310.cobra.yu@hyweb.com.tw> References: <1277307737.14310.cobra.yu@hyweb.com.tw> Message-ID: <201006232155.44063.aacid@kde.org> A Dimecres, 23 de juny de 2010, cobra.yu va escriure: > Dear All, > > Does Poppler provide PDF annotation icons or should users make > customized icon bitmaps? Any suggestions are welcome. Tks. Please ask a better question. What does exactly mean "provide an icon" for you? Albert > > Cobra > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kde.org Thu Jun 24 00:37:29 2010 From: aacid at kde.org (Albert Astals Cid) Date: Thu, 24 Jun 2010 08:37:29 +0100 Subject: [poppler] Annotation ICONs In-Reply-To: <1277353793.7902.cobra.yu@hyweb.com.tw> References: <1277307737.14310.cobra.yu@hyweb.com.tw> <201006232155.44063.aacid@kde.org> <1277353793.7902.cobra.yu@hyweb.com.tw> Message-ID: <201006240837.29513.aacid@kde.org> A Dijous, 24 de juny de 2010, v?reu escriure: > For example, while finding a "Note" annotation, it's Poppler's capability > to show the "Note" icon or user's? Yes, poppler will show the icon. And please never mail me again when answering to the mailing list, mail the mailing list. Albert > > Cobra > -----Original message----- > From:Albert Astals Cid > To:poppler > Date:Wed, 23 Jun 2010 21:55:43 +0100 > Subject:Re: [poppler] Annotation ICONs > > A Dimecres, 23 de juny de 2010, cobra.yu va escriure: > > Dear All, > > > > Does Poppler provide PDF annotation icons or should users make > > > > customized icon bitmaps? Any suggestions are welcome. Tks. > > Please ask a better question. What does exactly mean "provide an icon" for > you? > > Albert > > > Cobra > > > > _______________________________________________ > > poppler mailing list > > poppler at lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/poppler > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From gamaral at kdab.com Fri Jun 25 21:23:59 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Fri, 25 Jun 2010 21:23:59 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <201006151253.58505.pino@kde.org> References: <20100613024041.GA2423@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <201006151253.58505.pino@kde.org> Message-ID: <20100626042235.GA10531@daedalus.localdomain> On Tue, Jun 15, 2010 at 12:53:53PM +0200, Pino Toscano wrote: > > Alle luned? 14 giugno 2010, Guillermo Amaral ha scritto: > > Anyway, I added the missing features to the reset form patch today, > > check it out. > > Some more notes other than what Albert and Carlos said already: > > > +LinkResetForm::LinkResetForm(Object *obj) { > > + Object obj1; > > + > > + fieldList = new GooList(); > > + flags = 0; > > + > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > + Object obj2; > > + obj1.arrayGetNF(i, &obj2); > > + fieldList->append(obj2.getString()->copy()); > > + obj2.free(); > > + } > > + } else { > > + error (-1, "Invalid ResetForm action"); > > + delete fieldList; > > + fieldList = NULL; > > + } > > + obj1.free(); > > [...] > > + // Was the LinkResetForm create successfully? > > + virtual GBool isOk() { return fieldList != NULL; } > > Basically this code makes the action valid only if Fields is specified > and valid, while that key is optional. > > > +class LinkFormActionPrivate : public LinkPrivate > > +{ > > + public: > > + LinkFormActionPrivate( const QRectF &area, > > LinkFormAction::ActionType actionType ); > > + > > + LinkFormAction::ActionType type; > > + const here > > > + bool LinkResetFormAction::isExcludeFieldList() const > > + { > > + Q_D( const LinkResetFormAction ); > > + return (1 == (d->flags % 1)); > > Err, you mean 'd->flags & 1'? > > > @@ -182,7 +184,8 @@ class POPPLER_QT4_EXPORT Link > > Action, ///< A "standard" action to be executed > > in the viewer > > Sound, ///< A link representing a sound to be > > played > > Movie, ///< An action to be executed on a movie > > - JavaScript ///< A JavaScript code to be > > interpreted \since 0.10 > > + JavaScript, ///< A > > JavaScript code to be interpreted \since 0.10 > > + FormAction ///< A "form" action to be > > executed in the viewer > > + \since 0.16 > > > @@ -484,6 +487,95 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link > > }; > > #endif > > > > +/** > > + * \brief "Form" action request. > > + * > > + * The LinkFormAction class represents a link that request a "form" > > action > > + * to be performed by the viewer on the displayed document. > > + */ > > as above, add \since 0.16 > > > +class POPPLER_QT4_EXPORT LinkFormAction : public Link > > +{ > > + public: > > + /** > > + * The possible types of actions > > + */ > > + enum ActionType { Submit = 1, > > + Reset = 2, > > + ImportData = 3 }; > > I'd use a slightly better name for the enum, like FormActionType. > > > + > > + /** > > + * The action of the current LinkFormAction > > + */ > > + ActionType actionType() const; > > likewise for the method naming > > > + /** > > + * Create a new Action link, that executes a > > specified action + * on the document. > > + * > > + * \param linkArea the active area of the link > > + * \param actionType which action should be executed > > + */ > > + LinkFormAction( const QRectF &linkArea, ActionType > > actionType ); > > I'd make this constructor protected, as LinkFormAction looks more an > intermediate action type which has no sense used alone. > > > +/** > > + * \brief "Form" action reset request. > > + * > > + * The LinkResetFormAction class represents a link that request a > > "ResetForm" action > > + * to be performed by the viewer on the displayed document. > > + */ > > ... guess what? ;) > > > +class POPPLER_QT4_EXPORT LinkResetFormAction : public LinkFormAction > > +{ > > + public: > > + typedef QList FieldList; > > Why not just a simple QStringList instead of this typedef? > > > + LinkResetFormAction( const QRectF &linkArea, const > > FieldList &_fieldList, int _flags ); > > [...] > > + int flags() const; > > [...] > > + bool isExcludeFieldList() const; > > This looks a bit too "raw"... what I would do is something like: > enum FormResetType { ResetAll, ResetIncluded, ResetExcluded } > and then use only this enum in both constructor and method. Maybe > ResetAll is not needed, stating in the apidox that you should check for > the emptiness of the field list. Ok guys, Let's see if I cought all the details ;-) Check it out -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions -------------- next part -------------- diff --git a/poppler/Link.cc b/poppler/Link.cc index b6d7f2d..d2079ea 100644 --- a/poppler/Link.cc +++ b/poppler/Link.cc @@ -124,6 +124,10 @@ LinkAction *LinkAction::parseAction(Object *obj, GooString *baseURI) { } else if (obj2.isName("SetOCGState")) { action = new LinkOCGState(obj); + // ResetForm action + } else if (obj2.isName("ResetForm")) { + action = new LinkResetForm(obj); + // unknown action } else if (obj2.isName()) { action = new LinkUnknown(obj2.getName()); @@ -848,6 +852,52 @@ LinkOCGState::StateList::~StateList() { } //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +LinkResetForm::LinkResetForm(Object *obj) { + Object obj1; + + fieldList = new GooList(); + flags = 0; + + if (obj->dictLookup("Fields", &obj1)->isArray()) { + for (int i = 0; i < obj1.arrayGetLength(); ++i) { + Object obj2; + + if (obj1.arrayGetNF(i, &obj2)->isString()) { + fieldList->append(obj2.getString()->copy()); + } else { + obj2.free(); + + if (obj1.arrayGet(i, &obj2)->isDict()) { + Object obj3; + + if (obj2.dictLookup("T", &obj3)->isString()) + fieldList->append(obj3.getString()->copy()); + + obj3.free(); + } + } + obj2.free(); + } + obj1.free(); + + if (obj->dictLookup("Flags", &obj1)->isInt()) { + flags = obj1.getInt(); + } + } else { + // If no Fields entry is found, reset everything. + flags = 1; + } + obj1.free(); +} + +LinkResetForm::~LinkResetForm() { + deleteGooList(fieldList, GooString); +} + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/poppler/Link.h b/poppler/Link.h index ea10375..3df61ae 100644 --- a/poppler/Link.h +++ b/poppler/Link.h @@ -53,6 +53,7 @@ enum LinkActionKind { actionSound, // sound action actionJavaScript, // JavaScript action actionOCGState, // Set-OCG-State action + actionResetForm, // Reset form action actionUnknown // anything else }; @@ -429,6 +430,34 @@ private: }; //------------------------------------------------------------------------ +// LinkResetForm +//------------------------------------------------------------------------ + +class LinkResetForm: public LinkAction { +public: + + // Build a LinkResetForm with the specified action type. + LinkResetForm(Object *obj); + + // Destructor. + virtual ~LinkResetForm(); + + // Was the LinkResetForm create successfully? + virtual GBool isOk() { return fieldList != NULL; } + + // Accessors. + virtual LinkActionKind getKind() { return actionResetForm; } + + GooList *getFieldList() { return fieldList; } + int getFlags() { return flags; } + +private: + + GooList *fieldList; + int flags; +}; + +//------------------------------------------------------------------------ // LinkUnknown //------------------------------------------------------------------------ diff --git a/qt4/src/poppler-link.cc b/qt4/src/poppler-link.cc index de06242..a3261de 100644 --- a/qt4/src/poppler-link.cc +++ b/qt4/src/poppler-link.cc @@ -179,6 +179,41 @@ class LinkMoviePrivate : public LinkPrivate } #endif +class LinkFormActionPrivate : public LinkPrivate +{ + public: + LinkFormActionPrivate( const QRectF &area, LinkFormAction::FormActionType formActionType ); + + const LinkFormAction::FormActionType type; +}; + + LinkFormActionPrivate::LinkFormActionPrivate( const QRectF &area, LinkFormAction::FormActionType formActionType ) + : LinkPrivate( area ), type( formActionType ) + { + } + +class LinkResetFormActionPrivate : public LinkFormActionPrivate +{ + public: + LinkResetFormActionPrivate( const QRectF &area, + const QStringList &_fieldList, int _flags ); + + const QStringList fieldList; + LinkResetFormAction::FormResetFlags flags; + +}; + + LinkResetFormActionPrivate::LinkResetFormActionPrivate( const QRectF &area, + const QStringList &_fieldList, int _flags ) + : LinkFormActionPrivate( area, LinkFormAction::Reset ), fieldList( _fieldList ) + { + // Check for Exclude Field List flag + if (_flags & 1) + flags.insert(LinkResetFormAction::ExcludeFieldList); + else + flags.insert(LinkResetFormAction::IncludeFieldList); + } + static void cvtUserToDev(::Page *page, double xu, double yu, int *xd, int *yd) { double ctm[6]; @@ -581,4 +616,52 @@ class LinkMoviePrivate : public LinkPrivate } #endif + // LinkFormAction + LinkFormAction::LinkFormAction( const QRectF &linkArea, FormActionType formActionType ) + : Link( *new LinkFormActionPrivate( linkArea, formActionType ) ) + { + } + + LinkFormAction::LinkFormAction( LinkFormActionPrivate &dd ) + : Link( dd ) + { + } + + LinkFormAction::~LinkFormAction() + { + } + + LinkFormAction::FormActionType LinkFormAction::formActionType() const + { + Q_D( const LinkFormAction ); + return d->type; + } + + Link::LinkType LinkFormAction::linkType() const + { + return FormAction; + } + + // LinkResetFormAction + LinkResetFormAction::LinkResetFormAction( const QRectF &linkArea, const QStringList &_fieldList, int _flags ) + : LinkFormAction( *new LinkResetFormActionPrivate( linkArea, _fieldList, _flags ) ) + { + } + + LinkResetFormAction::~LinkResetFormAction() + { + } + + QStringList LinkResetFormAction::fieldList() const + { + Q_D( const LinkResetFormAction ); + return d->fieldList; + } + + LinkResetFormAction::FormResetFlags LinkResetFormAction::flags() const + { + Q_D( const LinkResetFormAction ); + return d->flags; + } + } diff --git a/qt4/src/poppler-link.h b/qt4/src/poppler-link.h index 1aa6d78..93fbb16 100644 --- a/qt4/src/poppler-link.h +++ b/qt4/src/poppler-link.h @@ -40,6 +40,8 @@ class LinkJavaScriptPrivate; class LinkMoviePrivate; class LinkDestinationData; class LinkDestinationPrivate; +class LinkFormActionPrivate; +class LinkResetFormActionPrivate; class SoundObject; /** @@ -183,7 +185,8 @@ class POPPLER_QT4_EXPORT Link Action, ///< A "standard" action to be executed in the viewer Sound, ///< A link representing a sound to be played Movie, ///< An action to be executed on a movie - JavaScript ///< A JavaScript code to be interpreted \since 0.10 + JavaScript, ///< A JavaScript code to be interpreted \since 0.10 + FormAction ///< A "form" action to be executed in the viewer \since 0.16 }; /** @@ -487,6 +490,100 @@ class POPPLER_QT4_EXPORT LinkMovie : public Link }; #endif +/** + * \brief "Form" action request. + * + * The LinkFormAction class represents a link that request a "form" action + * to be performed by the viewer on the displayed document. \since 0.16 + */ +class POPPLER_QT4_EXPORT LinkFormAction : public Link +{ + public: + /** + * The possible types of actions + */ + enum FormActionType { Submit = 1, + Reset = 2, + ImportData = 3 }; + + /** + * The action of the current LinkFormAction + */ + FormActionType formActionType() const; + + /** + * Destructor. + */ + ~LinkFormAction(); + + LinkType linkType() const; + + protected: + /** + * Create a new Action link, that executes a specified action + * on the document. + * + * \param linkArea the active area of the link + * \param formActionType which action should be executed + */ + LinkFormAction( const QRectF &linkArea, FormActionType formActionType ); + + LinkFormAction( LinkFormActionPrivate &dd ); + + private: + Q_DECLARE_PRIVATE( LinkFormAction ) + Q_DISABLE_COPY( LinkFormAction ) +}; + +/** + * \brief "Form" action reset request. + * + * The LinkResetFormAction class represents a link that request a "ResetForm" action + * to be performed by the viewer on the displayed document. + */ +class POPPLER_QT4_EXPORT LinkResetFormAction : public LinkFormAction +{ + public: + /** + * Flags specifying how the reset should be performed by the + * viewer. + * + * Reset all fields usually includes the ExcludeFieldList + * flag with an empty field list. + */ + enum FormResetFlag { IncludeFieldList, ExcludeFieldList }; + typedef QSet FormResetFlags; + + /** + * Create a new LinkResetFormAction link, that + * resets form fields on document. + * + * \param linkArea the active area of the link + * \param fieldList list of field names + * \param flags action flags + */ + LinkResetFormAction( const QRectF &linkArea, const QStringList &_fieldList, int _flags ); + + /** + * Destructor. + */ + ~LinkResetFormAction(); + + /** + * The list of fields to either reset or ignore. + */ + QStringList fieldList() const; + + /** + * Reset Flags. + */ + FormResetFlags flags() const; + + private: + Q_DECLARE_PRIVATE( LinkResetFormAction ) + Q_DISABLE_COPY( LinkResetFormAction ) +}; + } #endif diff --git a/qt4/src/poppler-page.cc b/qt4/src/poppler-page.cc index ae67b11..2b4ee62 100644 --- a/qt4/src/poppler-page.cc +++ b/qt4/src/poppler-page.cc @@ -177,6 +177,23 @@ Link* PageData::convertLinkActionToLink(::LinkAction * a, DocumentData *parentDo copyString( m_uri, m->getTitle()->getCString() ); */ break; + case actionResetForm: + { + QStringList fieldList; + LinkResetForm * g = (LinkResetForm *) a; + GooList *gfieldList = g->getFieldList(); + + /* Convert GooString field list to FieldList */ + const int c = gfieldList->getLength(); + for ( int i = 0; i < c; ++i ) { + GooString *str = (GooString *) gfieldList->get( i ); + fieldList.append( str->getCString() ); + } + + popplerLink = new LinkResetFormAction( linkArea, fieldList, g->getFlags() ); + } + break; + case actionUnknown: break; } From carlosgc at gnome.org Sat Jun 26 01:08:55 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Sat, 26 Jun 2010 10:08:55 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <20100626042235.GA10531@daedalus.localdomain> References: <20100613024041.GA2423@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <201006151253.58505.pino@kde.org> <20100626042235.GA10531@daedalus.localdomain> Message-ID: <1277539297-sup-8655@charmaleon> Excerpts from Guillermo Amaral's message of s?b jun 26 06:23:59 +0200 2010: > > Ok guys, > > Let's see if I cought all the details ;-) > > Check it out > > diff --git a/poppler/Link.cc b/poppler/Link.cc > index b6d7f2d..d2079ea 100644 > --- a/poppler/Link.cc > +++ b/poppler/Link.cc > //------------------------------------------------------------------------ > +// LinkResetForm > +//------------------------------------------------------------------------ > + > +LinkResetForm::LinkResetForm(Object *obj) { > + Object obj1; > + > + fieldList = new GooList(); > + flags = 0; > + > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > + Object obj2; > + > + if (obj1.arrayGetNF(i, &obj2)->isString()) { > + fieldList->append(obj2.getString()->copy()); > + } else { > + obj2.free(); > + > + if (obj1.arrayGet(i, &obj2)->isDict()) { > + Object obj3; > + > + if (obj2.dictLookup("T", &obj3)->isString()) > + fieldList->append(obj3.getString()->copy()); This is not equivalent, in case of being a text string it represents the fully qualified name of a field, but T entry in the field dictionary is the partial filed Name, and it's optional, when it's not present we are loosing the field. The fully qualified name is not stored directly in the field dictionary, it should be built using partial names of fields in the hierarchy. I think we could just store the objects without parsing them, and let the frontends handle it. Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From gamaral at kdab.com Sat Jun 26 02:02:25 2010 From: gamaral at kdab.com (Guillermo Amaral) Date: Sat, 26 Jun 2010 02:02:25 -0700 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1277539297-sup-8655@charmaleon> References: <20100613024041.GA2423@daedalus.localdomain> <201006132302.56527.aacid@kde.org> <20100614033713.GA11727@daedalus.localdomain> <201006151253.58505.pino@kde.org> <20100626042235.GA10531@daedalus.localdomain> <1277539297-sup-8655@charmaleon> Message-ID: <20100626090225.GA18631@daedalus.localdomain> On Sat, Jun 26, 2010 at 10:08:55AM +0200, Carlos Garcia Campos wrote: > Excerpts from Guillermo Amaral's message of s?b jun 26 06:23:59 +0200 2010: > > > > Ok guys, > > > > Let's see if I cought all the details ;-) > > > > Check it out > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > index b6d7f2d..d2079ea 100644 > > --- a/poppler/Link.cc > > +++ b/poppler/Link.cc > > //------------------------------------------------------------------------ > > +// LinkResetForm > > +//------------------------------------------------------------------------ > > + > > +LinkResetForm::LinkResetForm(Object *obj) { > > + Object obj1; > > + > > + fieldList = new GooList(); > > + flags = 0; > > + > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > + Object obj2; > > + > > + if (obj1.arrayGetNF(i, &obj2)->isString()) { > > + fieldList->append(obj2.getString()->copy()); > > + } else { > > + obj2.free(); > > + > > + if (obj1.arrayGet(i, &obj2)->isDict()) { > > + Object obj3; > > + > > + if (obj2.dictLookup("T", &obj3)->isString()) > > + fieldList->append(obj3.getString()->copy()); > > This is not equivalent, in case of being a text string it represents > the fully qualified name of a field, but T entry in the field > dictionary is the partial filed Name, and it's optional, when it's not > present we are loosing the field. The fully qualified name is not > stored directly in the field dictionary, it should be built using > partial names of fields in the hierarchy. I found only examples with partial names in the field list, so I used T. I had no success finding one that uses refs in the field list at all; I had to make one manually. > I think we could just store the objects without parsing them, and let > the frontends handle it. Fine by me, but it's up to you guys. Cheers, GA -- Guillermo Amaral | guillermo.amaral at kdab.com | Software Desperado Klar?lvdalens Datakonsult AB, a KDAB Group company Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322) KDAB - Qt Experts - Platform-independent software solutions From oinos at web.de Sat Jun 26 12:03:22 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Sat, 26 Jun 2010 21:03:22 +0200 Subject: [poppler] cannot compile under Fedora 13 Message-ID: <4C264EFA.5000505@web.de> Hi there, I'm not able to compile poppler-0.14.0 under Fedora 13. ./configure gives the following info: use zlib: no use libcurl: no use libopenjpeg: no And I have all these installed: curl-7.20.1 zlib-static-1.2.3 openjpeg-1.3 openjpeg-libs-1.3 zlib-1.2.3 zlib-debuginfo-1.2.3 openjpeg-devel-1.3 zlib-devel-1.2.3 What am I missing here? Thanks for your help, Pablo From pino at kde.org Sat Jun 26 12:08:06 2010 From: pino at kde.org (Pino Toscano) Date: Sat, 26 Jun 2010 21:08:06 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C264EFA.5000505@web.de> References: <4C264EFA.5000505@web.de> Message-ID: <201006262108.12704.pino@kde.org> Alle sabato 26 giugno 2010, Pablo Rodr?guez ha scritto: > I'm not able to compile poppler-0.14.0 under Fedora 13. > > ./configure gives the following info: > > use zlib: no > use libcurl: no > use libopenjpeg: no > > And I have all these installed: > > curl-7.20.1 > zlib-static-1.2.3 > openjpeg-1.3 > openjpeg-libs-1.3 > zlib-1.2.3 > zlib-debuginfo-1.2.3 > openjpeg-devel-1.3 > zlib-devel-1.2.3 > > What am I missing here? zlib and curl are disabled by default, so you must explicitly enable them (you can ignore the zlib stuff, though). About openjpeg, you really need to attach (possibly compressed) the generated config.log. -- Pino Toscano -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 190 bytes Desc: This is a digitally signed message part. URL: From oinos at web.de Sat Jun 26 12:29:38 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Sat, 26 Jun 2010 21:29:38 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006262108.12704.pino@kde.org> References: <4C264EFA.5000505@web.de> <201006262108.12704.pino@kde.org> Message-ID: <4C265522.1050506@web.de> On 06/26/2010 09:08 PM, Pino Toscano wrote: > Alle sabato 26 giugno 2010, Pablo Rodr?guez ha scritto: >> I'm not able to compile poppler-0.14.0 under Fedora 13. >> >> ./configure gives the following info: >> >> [...] >> >> What am I missing here? > > zlib and curl are disabled by default, so you must explicitly enable > them (you can ignore the zlib stuff, though). > About openjpeg, you really need to attach (possibly compressed) the > generated config.log. Many thanks for your fast reply, Pino. You have the requested file at http://www.ousia.tk/poppler-config.log. Thanks again, Pablo From aacid at kde.org Sat Jun 26 15:47:59 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sat, 26 Jun 2010 23:47:59 +0100 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C265522.1050506@web.de> References: <4C264EFA.5000505@web.de> <201006262108.12704.pino@kde.org> <4C265522.1050506@web.de> Message-ID: <201006262347.59595.aacid@kde.org> A Dissabte, 26 de juny de 2010, Pablo Rodr?guez va escriure: > On 06/26/2010 09:08 PM, Pino Toscano wrote: > > Alle sabato 26 giugno 2010, Pablo Rodr?guez ha scritto: > >> I'm not able to compile poppler-0.14.0 under Fedora 13. > >> > >> ./configure gives the following info: > >> > >> [...] > >> > >> What am I missing here? > > > > zlib and curl are disabled by default, so you must explicitly enable > > them (you can ignore the zlib stuff, though). > > About openjpeg, you really need to attach (possibly compressed) the > > generated config.log. > > Many thanks for your fast reply, Pino. > > You have the requested file at http://www.ousia.tk/poppler-config.log. Install g++ otherwise you can't compile C++ sources. Albert > > Thanks again, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From oinos at web.de Sat Jun 26 23:00:32 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Sun, 27 Jun 2010 08:00:32 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006262347.59595.aacid@kde.org> References: <4C264EFA.5000505@web.de> <201006262108.12704.pino@kde.org> <4C265522.1050506@web.de> <201006262347.59595.aacid@kde.org> Message-ID: <4C26E900.7040006@web.de> On 06/27/2010 12:47 AM, Albert Astals Cid wrote: > A Dissabte, 26 de juny de 2010, Pablo Rodr?guez va escriure: >> [...] >> >> You have the requested file at http://www.ousia.tk/poppler-config.log. > > Install g++ otherwise you can't compile C++ sources. Thanks for your help, Albert. I get another error: make[3]: Entering directory `/home/ousia/poppler-0.14.0/cpp/tests' CXXLD poppler-dump /usr/bin/ld: parseargs.o: undefined reference to symbol 'gatof' /usr/bin/ld: note: 'gatof' is defined in DSO /home/ousia/poppler-0.14.0/poppler/.libs/libpoppler.so.6 so try adding it to the linker command line /home/ousia/poppler-0.14.0/poppler/.libs/libpoppler.so.6: could not read symbols: Invalid operation collect2: ld returned 1 exit status make[3]: *** [poppler-dump] Error 1 make[3]: Leaving directory `/home/ousia/poppler-0.14.0/cpp/tests' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/ousia/poppler-0.14.0/cpp' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/ousia/poppler-0.14.0' make: *** [all] Error 2 Do you know what I'm missing here? BTW, the default reply to messages from this list seems to be reply to the sender and not to the list? Would it be possible to change the default reply to the list? Thanks for your help, Pablo From aacid at kde.org Sun Jun 27 03:34:31 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 11:34:31 +0100 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C26E900.7040006@web.de> References: <4C264EFA.5000505@web.de> <201006262347.59595.aacid@kde.org> <4C26E900.7040006@web.de> Message-ID: <201006271134.31838.aacid@kde.org> A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > On 06/27/2010 12:47 AM, Albert Astals Cid wrote: > > A Dissabte, 26 de juny de 2010, Pablo Rodr?guez va escriure: > >> [...] > >> > >> You have the requested file at http://www.ousia.tk/poppler-config.log. > > > > Install g++ otherwise you can't compile C++ sources. > > Thanks for your help, Albert. > > I get another error: > > make[3]: Entering directory `/home/ousia/poppler-0.14.0/cpp/tests' > CXXLD poppler-dump > /usr/bin/ld: parseargs.o: undefined reference to symbol 'gatof' > /usr/bin/ld: note: 'gatof' is defined in DSO > /home/ousia/poppler-0.14.0/poppler/.libs/libpoppler.so.6 so try adding > it to the linker command line > /home/ousia/poppler-0.14.0/poppler/.libs/libpoppler.so.6: could not read > symbols: Invalid operation > collect2: ld returned 1 exit status > make[3]: *** [poppler-dump] Error 1 > make[3]: Leaving directory `/home/ousia/poppler-0.14.0/cpp/tests' > make[2]: *** [all-recursive] Error 1 > make[2]: Leaving directory `/home/ousia/poppler-0.14.0/cpp' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/home/ousia/poppler-0.14.0' > make: *** [all] Error 2 > > Do you know what I'm missing here? That's a bug in poppler 0.14.0 packages, it will be fixed in 0.14.1, you can find the fix at http://cgit.freedesktop.org/poppler/poppler/commit/?h=poppler-0.14&id=5563ccbb20e4a19ec8415d0108b0089a079b9ab2 > > BTW, the default reply to messages from this list seems to be reply to > the sender and not to the list? Would it be possible to change the > default reply to the list? Does it? Hitting reply on KMail does the right thing (that is reply to the list), maybe KMail is just a better mail program than others? Do you know where and what is the name of the setting in mailman you want me to change? Albert > > Thanks for your help, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From moon at justmoon.net Sun Jun 27 04:18:30 2010 From: moon at justmoon.net (Stefan Thomas) Date: Sun, 27 Jun 2010 13:18:30 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006271134.31838.aacid@kde.org> References: <4C264EFA.5000505@web.de> <201006262347.59595.aacid@kde.org> <4C26E900.7040006@web.de> <201006271134.31838.aacid@kde.org> Message-ID: <4C273386.9060505@justmoon.net> >> BTW, the default reply to messages from this list seems to be reply to >> the sender and not to the list? Would it be possible to change the >> default reply to the list? >> > Does it? Hitting reply on KMail does the right thing (that is reply to the > list), maybe KMail is just a better mail program than others? > In an effort not to leave out an opportunity to chime in on an off-topic discussion: Thunderbird gives me two buttons: "reply" and "reply list". They do what you'd expect them to, so - at least from what I can tell - the mailing list headers are configured just right. :) Cheers! Stefan >> Thanks for your help, >> >> >> Pablo >> _______________________________________________ >> poppler mailing list >> poppler at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/poppler >> > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler > > From aacid at kde.org Sun Jun 27 08:42:41 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 16:42:41 +0100 Subject: [poppler] Form-Reset and Print [patches] Message-ID: <201006271642.41332.aacid@kde.org> A Dissabte, 26 de juny de 2010, v?reu escriure: > Excerpts from Guillermo Amaral's message of s?b jun 26 06:23:59 +0200 2010: > > Ok guys, > > > > Let's see if I cought all the details ;-) > > > > Check it out > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > index b6d7f2d..d2079ea 100644 > > --- a/poppler/Link.cc > > +++ b/poppler/Link.cc > > > > //---------------------------------------------------------------------- > > -- > > > > +// LinkResetForm > > +//---------------------------------------------------------------------- > > -- + > > +LinkResetForm::LinkResetForm(Object *obj) { > > + Object obj1; > > + > > + fieldList = new GooList(); > > + flags = 0; > > + > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > + Object obj2; > > + > > + if (obj1.arrayGetNF(i, &obj2)->isString()) { > > + fieldList->append(obj2.getString()->copy()); > > + } else { > > + obj2.free(); > > + > > + if (obj1.arrayGet(i, &obj2)->isDict()) { > > + Object obj3; > > + > > + if (obj2.dictLookup("T", &obj3)->isString()) > > + fieldList->append(obj3.getString()->copy()); > > This is not equivalent, in case of being a text string it represents > the fully qualified name of a field, but T entry in the field > dictionary is the partial filed Name, and it's optional, when it's not > present we are loosing the field. The fully qualified name is not > stored directly in the field dictionary, it should be built using > partial names of fields in the hierarchy. > > I think we could just store the objects without parsing them, and let > the frontends handle it. I?m not sure i agree here, the more things we have in the core the better, what do we win with each frontend doing the job instead of the core doing it? Albert > > Regards, From carlosgc at gnome.org Sun Jun 27 08:46:52 2010 From: carlosgc at gnome.org (Carlos Garcia Campos) Date: Sun, 27 Jun 2010 17:46:52 +0200 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <201006271642.41332.aacid@kde.org> References: <201006271642.41332.aacid@kde.org> Message-ID: <1277653459-sup-9936@charmaleon> Excerpts from Albert Astals Cid's message of dom jun 27 17:42:41 +0200 2010: > A Dissabte, 26 de juny de 2010, v?reu escriure: > > Excerpts from Guillermo Amaral's message of s?b jun 26 06:23:59 +0200 2010: > > > Ok guys, > > > > > > Let's see if I cought all the details ;-) > > > > > > Check it out > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > index b6d7f2d..d2079ea 100644 > > > --- a/poppler/Link.cc > > > +++ b/poppler/Link.cc > > > > > > //---------------------------------------------------------------------- > > > -- > > > > > > +// LinkResetForm > > > +//---------------------------------------------------------------------- > > > -- + > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > + Object obj1; > > > + > > > + fieldList = new GooList(); > > > + flags = 0; > > > + > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > + Object obj2; > > > + > > > + if (obj1.arrayGetNF(i, &obj2)->isString()) { > > > + fieldList->append(obj2.getString()->copy()); > > > + } else { > > > + obj2.free(); > > > + > > > + if (obj1.arrayGet(i, &obj2)->isDict()) { > > > + Object obj3; > > > + > > > + if (obj2.dictLookup("T", &obj3)->isString()) > > > + fieldList->append(obj3.getString()->copy()); > > > > This is not equivalent, in case of being a text string it represents > > the fully qualified name of a field, but T entry in the field > > dictionary is the partial filed Name, and it's optional, when it's not > > present we are loosing the field. The fully qualified name is not > > stored directly in the field dictionary, it should be built using > > partial names of fields in the hierarchy. > > > > I think we could just store the objects without parsing them, and let > > the frontends handle it. > > I?m not sure i agree here, the more things we have in the core the better, > what do we win with each frontend doing the job instead of the core doing it? In that case we should return a list of form fields rather than a list of strings. > Albert > > > > > Regards, -- Carlos Garcia Campos PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462 -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: not available URL: From aacid at kde.org Sun Jun 27 08:47:46 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 16:47:46 +0100 Subject: [poppler] Form-Reset and Print [patches] In-Reply-To: <1277653459-sup-9936@charmaleon> References: <201006271642.41332.aacid@kde.org> <1277653459-sup-9936@charmaleon> Message-ID: <201006271647.46820.aacid@kde.org> A Diumenge, 27 de juny de 2010, Carlos Garcia Campos va escriure: > Excerpts from Albert Astals Cid's message of dom jun 27 17:42:41 +0200 2010: > > A Dissabte, 26 de juny de 2010, v?reu escriure: > > > Excerpts from Guillermo Amaral's message of s?b jun 26 06:23:59 +0200 2010: > > > > Ok guys, > > > > > > > > Let's see if I cought all the details ;-) > > > > > > > > Check it out > > > > > > > > diff --git a/poppler/Link.cc b/poppler/Link.cc > > > > index b6d7f2d..d2079ea 100644 > > > > --- a/poppler/Link.cc > > > > +++ b/poppler/Link.cc > > > > > > > > //------------------------------------------------------------------ > > > > ---- -- > > > > > > > > +// LinkResetForm > > > > +//------------------------------------------------------------------ > > > > ---- -- + > > > > +LinkResetForm::LinkResetForm(Object *obj) { > > > > + Object obj1; > > > > + > > > > + fieldList = new GooList(); > > > > + flags = 0; > > > > + > > > > + if (obj->dictLookup("Fields", &obj1)->isArray()) { > > > > + for (int i = 0; i < obj1.arrayGetLength(); ++i) { > > > > + Object obj2; > > > > + > > > > + if (obj1.arrayGetNF(i, &obj2)->isString()) { > > > > + fieldList->append(obj2.getString()->copy()); > > > > + } else { > > > > + obj2.free(); > > > > + > > > > + if (obj1.arrayGet(i, &obj2)->isDict()) { > > > > + Object obj3; > > > > + > > > > + if (obj2.dictLookup("T", &obj3)->isString()) > > > > + fieldList->append(obj3.getString()->copy()); > > > > > > This is not equivalent, in case of being a text string it represents > > > the fully qualified name of a field, but T entry in the field > > > dictionary is the partial filed Name, and it's optional, when it's not > > > present we are loosing the field. The fully qualified name is not > > > stored directly in the field dictionary, it should be built using > > > partial names of fields in the hierarchy. > > > > > > I think we could just store the objects without parsing them, and let > > > the frontends handle it. > > > > I?m not sure i agree here, the more things we have in the core the > > better, what do we win with each frontend doing the job instead of the > > core doing it? > > In that case we should return a list of form fields rather than a list > of strings. +1 Albert > > > Albert > > > > > Regards, From oinos at web.de Sun Jun 27 09:05:08 2010 From: oinos at web.de (=?windows-1252?Q?Pablo_Rodr=EDguez?=) Date: Sun, 27 Jun 2010 18:05:08 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006271134.31838.aacid@kde.org> References: <4C264EFA.5000505@web.de> <201006262347.59595.aacid@kde.org> <4C26E900.7040006@web.de> <201006271134.31838.aacid@kde.org> Message-ID: <4C2776B4.8050400@web.de> On 06/27/2010 12:34 PM, Albert Astals Cid wrote: > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: >> [...] >> I get another error: >> [...] >> >> Do you know what I'm missing here? > > That's a bug in poppler 0.14.0 packages, it will be fixed in 0.14.1, you can > find the fix at > http://cgit.freedesktop.org/poppler/poppler/commit/?h=poppler-0.14&id=5563ccbb20e4a19ec8415d0108b0089a079b9ab2 It works fine now. Thanks for that. BTW, when is next stable version planned to be released? >> BTW, the default reply to messages from this list seems to be reply to >> the sender and not to the list? Would it be possible to change the >> default reply to the list? > > Does it? Hitting reply on KMail does the right thing (that is reply to the > list), maybe KMail is just a better mail program than others? Thunderbird doesn't do it. I don't know whether KMail is a better program (I have no plans to switch), but if KMail doesn't honor the mailing list settings, I'd report the issue to its developers (if I were you ;-)). > Do you know where and what is the name of the setting in mailman you want me > to change? ?reply_goes_to_list? seems to be the right setting (http://www.gnu.org/software/mailman/mailman-admin/node11.html). Thanks for your help, Pablo From oinos at web.de Sun Jun 27 09:28:16 2010 From: oinos at web.de (=?windows-1252?Q?Pablo_Rodr=EDguez?=) Date: Sun, 27 Jun 2010 18:28:16 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C273386.9060505@justmoon.net> References: <4C264EFA.5000505@web.de> <201006262347.59595.aacid@kde.org> <4C26E900.7040006@web.de> <201006271134.31838.aacid@kde.org> <4C273386.9060505@justmoon.net> Message-ID: <4C277C20.6070700@web.de> On 06/27/2010 01:18 PM, Stefan Thomas wrote: > >>> BTW, the default reply to messages from this list seems to be reply to >>> the sender and not to the list? Would it be possible to change the >>> default reply to the list? >> Does it? Hitting reply on KMail does the right thing (that is reply to >> the >> list), maybe KMail is just a better mail program than others? > > In an effort not to leave out an opportunity to chime in on an off-topic > discussion: Thunderbird gives me two buttons: "reply" and "reply list". > They do what you'd expect them to, so - at least from what I can tell - > the mailing list headers are configured just right. :) Thanks for your reply, Stefan. Thunderbird gives me two buttons too. But I'm more a keyboard-type guy, so I hit Ctrl+R to reply. And if the Reply-To: field is not set, the mail client should reply to the address in the From: field. I agree that this is not the most important issue on poppler, but if we want to avoid the accidental sending of private messages, configuring the ?reply_goes_to_list? setting might help a lot. Thanks again, Pablo From aacid at kde.org Sun Jun 27 09:47:56 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 17:47:56 +0100 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C2776B4.8050400@web.de> References: <4C264EFA.5000505@web.de> <201006271134.31838.aacid@kde.org> <4C2776B4.8050400@web.de> Message-ID: <201006271747.56547.aacid@kde.org> A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > On 06/27/2010 12:34 PM, Albert Astals Cid wrote: > > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > >> [...] > >> > >> I get another error: > >> [...] > >> > >> Do you know what I'm missing here? > > > > That's a bug in poppler 0.14.0 packages, it will be fixed in 0.14.1, you > > can find the fix at > > http://cgit.freedesktop.org/poppler/poppler/commit/?h=poppler-0.14&id=556 > > 3ccbb20e4a19ec8415d0108b0089a079b9ab2 > > It works fine now. Thanks for that. > > BTW, when is next stable version planned to be released? July 8th > > >> BTW, the default reply to messages from this list seems to be reply to > >> the sender and not to the list? Would it be possible to change the > >> default reply to the list? > > > > Does it? Hitting reply on KMail does the right thing (that is reply to > > the list), maybe KMail is just a better mail program than others? > > Thunderbird doesn't do it. I don't know whether KMail is a better > program (I have no plans to switch), but if KMail doesn't honor the > mailing list settings, I'd report the issue to its developers (if I were > you ;-)). KMail has Reply, that does the-right-thing 99% of the cases; Reply to author, that replies to the author and Reply to list, that replies to the list, it honors totally the mailing list settings. > > > Do you know where and what is the name of the setting in mailman you want > > me to change? > > ?reply_goes_to_list? seems to be the right setting > (http://www.gnu.org/software/mailman/mailman-admin/node11.html). But then when i hit "Reply to author" it will reply to the list, and you'll ask me to file a bug against my mail program when it's doing the right thing. I suggest you to find a shortcut that does what you want to do and use it. Albert > > Thanks for your help, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kde.org Sun Jun 27 09:55:56 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 17:55:56 +0100 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <201006201543.44620.aacid@kde.org> References: <201006182143.54507.aacid@kde.org> <201006201543.44620.aacid@kde.org> Message-ID: <201006271755.57105.aacid@kde.org> A Diumenge, 20 de juny de 2010, Albert Astals Cid va escriure: > A Divendres, 18 de juny de 2010, Albert Astals Cid va escriure: > > A Dimecres, 16 de juny de 2010, Christian Feuersaenger va escriure: > > > Dear Poppler Developers, > > > > > > attached you find my bugfix proposal to improve rendering of Type 4/5 > > > Shadings (Gouraud Interpolated Triangle Shadings). > > > > > > What it does is: > > > 1. implement the Function lookup to fix buggy display of parameterized > > > shadings, > > > > > > 2. Improve the triangle refinement control such that it runs 5 times > > > faster, > > > > > > 3. Share path memory between successive flat triangles which gains > > > another 10% runtime improvement (avoids many new/delete operations). > > > > > > I believe the changes are stable and should work without problems. The > > > attached patch file patches against branch poppler-0.14 . Note that I > > > changed the access policies to GfxSubPath: it has no setter methods > > > which allows to re-use the same path with different coordinates (Point > > > 3 of the list above). > > > > I'm running the regression testing with your patch, if no regressions are > > detected then we can look at the code and see if we like it or not :D > > > > Thanks for the patch :-) > > Passed the regression testing fine, will have a look at the code later > today. It took a bit more than expected, sorry about that. I've removed the debug code and the #ifdef for the speedup, since yes, we obviously want the speedup, i'm attaching my work in progress patch. I like you to do two things though. Please change + // preallocate a path. + // Overwriting the coordinates saves about 10% at runtime for larger + // shadings. + state->moveTo(0., 0.); + state->lineTo(1., 0.); + state->lineTo(0., 1.); + state->closePath(); to a proper call like state->preallocatePath(); or something like this, since that four lines smell "big hack" and even though it is a hack i think it makes sense to have a function for it and not just create a fake triangle. Can you please explain/rephrase + // this always produces output -- even for parameterized ranges. + // But it is wrong for parameterized colors: Thanks for the patch and sorry again for the delay. Albert > > Albert > > > Albert > > > > > Looking forward to your opinions, > > > > > > best regards > > > > > > Christian > > > > > > PS > > > I will send patch files for the implemented draft of *real* gouraud > > > interpolated shadings when they become more or less stable. > > > > > > Am 14.06.2010 23:07, schrieb Albert Astals Cid: > > > > A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: > > > >> Hi Albert, > > > >> > > > >> thank you for the fast reply and your positive answer! > > > >> > > > >> I will use the next days to apply the xpdf patches to libpoppler. > > > >> > > > >> I intent to patch the patched triangle refinement to your stable > > > >> branch, which appears to be the poppler-0.14 (?). I consider it to > > > >> be a bugfix. > > > > > > > > Right poppler 0.14 is our stable branch. > > > > > > > >> The interpolated shader is not yet stable and may need some > > > >> revisions. I will continue working on it, preferrable on a separate > > > >> branch. If you like, I can try to make a www git repository > > > >> somewhere such that you can fetch my changes and merge them to > > > >> whereever you want. > > > > > > > > Personally i'd prefer that you send the patches to the mailing list, > > > > makes easier for more people to see them and comment if they feel > > > > like. > > > > > > > > Albert > > > > > > > >> For the moment, you find my test.pdf attached. it has been generated > > > >> with latex and the unstable version of \usepackage{pgfplots}, > > > >> http://pgfplots.sourceforge.net/; I also attached the .tex sources. > > > >> > > > >> So, thank you for the positive feedback. > > > >> > > > >> Best regards > > > >> > > > >> Christian > > > >> > > > >> >> > I am sure my additions are valueable and propose them for > > > >> >> > usage in libpoppler: the bugfix/speed improvement is > > > >> >> > directly usable and > > > >> > > > >> stable > > > >> > > > >> >> > and the lowlevel shader will need some more time. I could > > > >> >> > also > > > >> > > > >> use some > > > >> > > > >> >> > advice to get the integration with transparency, blending > > > >> >> > and > > > >> > > > >> whatever > > > >> > > > >> >> > correctly. I started with the xpdf sources, so I would > > > >> >> > also > > > >> > > > >> appreciate > > > >> > > > >> >> > any hints how you communicate changes between xpdf and > > > >> >> > libpoppler > > > >> > > > >> if you > > > >> > > > >> >> > are interested in my proposal. > > > >> > > > > >> > Yes, we are interested in your patches, basically what we would > > > >> > need > > > >> > > > >> you is to > > > >> > > > >> > provide a patch over poppler sources, you can choose wheter you > > > >> > want > > > >> > > > >> to make > > > >> > > > >> > it against git master branch, git poppler-0.14 branch or the > > > >> > released > > > >> > > > >> 0.14.0 > > > >> > > > >> > tarball. > > > >> > > > > >> > Also it would be interesting to have the PDF you have used for > > > >> > testing. > > > >> > > > > >> > Thanks, > > > >> > > > > >> > Albert > > > >> > > > >> _______________________________________________ > > > >> poppler mailing list > > > >> poppler at lists.freedesktop.org > > > >> http://lists.freedesktop.org/mailman/listinfo/poppler > > > > > > > > _______________________________________________ > > > > poppler mailing list > > > > poppler at lists.freedesktop.org > > > > http://lists.freedesktop.org/mailman/listinfo/poppler > > > > _______________________________________________ > > poppler mailing list > > poppler at lists.freedesktop.org > > http://lists.freedesktop.org/mailman/listinfo/poppler > > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler -------------- next part -------------- A non-text attachment was scrubbed... Name: type45.patch Type: text/x-patch Size: 10342 bytes Desc: not available URL: From oinos at web.de Sun Jun 27 10:43:57 2010 From: oinos at web.de (=?UTF-8?B?UGFibG8gUm9kcsOtZ3Vleg==?=) Date: Sun, 27 Jun 2010 19:43:57 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006271747.56547.aacid@kde.org> References: <4C264EFA.5000505@web.de> <201006271134.31838.aacid@kde.org> <4C2776B4.8050400@web.de> <201006271747.56547.aacid@kde.org> Message-ID: <4C278DDD.6050401@web.de> On 06/27/2010 06:47 PM, Albert Astals Cid wrote: > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: >> On 06/27/2010 12:34 PM, Albert Astals Cid wrote: >>> [...] >>> Do you know where and what is the name of the setting in mailman you want >>> me to change? >> >> ?reply_goes_to_list? seems to be the right setting >> (http://www.gnu.org/software/mailman/mailman-admin/node11.html). > > But then when i hit "Reply to author" it will reply to the list, and you'll > ask me to file a bug against my mail program when it's doing the right thing. > I suggest you to find a shortcut that does what you want to do and use it. Thanks for your reply, Albert. Sorry, but I have to respectfully disagree here. But I don't want to start a flame. To avoid a flame, I think it would be better, if we could discuss in private (and even in Spanish, if you like). Let me know if you are interested on this or you think that discussing it in public is more convenient. Thanks again, Pablo From oinos at web.de Sun Jun 27 10:51:18 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Sun, 27 Jun 2010 19:51:18 +0200 Subject: [poppler] gtk-cairo-test shows closed annotation Message-ID: <4C278F96.3060205@web.de> Hi there, gtk-cairo-test shows a closed annotation on the first page from http://www.archive.org/download/LaTransformacinDelConceptoDeReflexinDeKantAHegel.ElTrnsitoDel/TesisRosa-B5-Uni.pdf. The annotation contains the following information: /Open true /Rect [66.663 622.572 66.663 622.572]. I wonder whether this is a bug. Thanks, Pablo From aacid at kde.org Sun Jun 27 10:52:39 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 18:52:39 +0100 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <4C278DDD.6050401@web.de> References: <4C264EFA.5000505@web.de> <201006271747.56547.aacid@kde.org> <4C278DDD.6050401@web.de> Message-ID: <201006271852.40150.aacid@kde.org> A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > On 06/27/2010 06:47 PM, Albert Astals Cid wrote: > > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > >> On 06/27/2010 12:34 PM, Albert Astals Cid wrote: > >>> [...] > >>> Do you know where and what is the name of the setting in mailman you > >>> want me to change? > >> > >> ?reply_goes_to_list? seems to be the right setting > >> (http://www.gnu.org/software/mailman/mailman-admin/node11.html). > > > > But then when i hit "Reply to author" it will reply to the list, and > > you'll ask me to file a bug against my mail program when it's doing the > > right thing. I suggest you to find a shortcut that does what you want to > > do and use it. > > Thanks for your reply, Albert. > > Sorry, but I have to respectfully disagree here. But I don't want to > start a flame. We agree to disagree, i'm not sure there's anything to discuss, i understand your points and could agree to them easily, but we've been running the list successfully for more than five years with this setup, i don't think we'd get more patches or better contributors just by changing this setting. On the other hand i don't want to be an evil dictator so if people really really want the change we can do a proper poll about it. Carlos? Pino? Lurkers? Albert > > To avoid a flame, I think it would be better, if we could discuss in > private (and even in Spanish, if you like). > > Let me know if you are interested on this or you think that discussing > it in public is more convenient. > > Thanks again, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From aacid at kde.org Sun Jun 27 11:18:45 2010 From: aacid at kde.org (Albert Astals Cid) Date: Sun, 27 Jun 2010 19:18:45 +0100 Subject: [poppler] gtk-cairo-test shows closed annotation In-Reply-To: <4C278F96.3060205@web.de> References: <4C278F96.3060205@web.de> Message-ID: <201006271918.45268.aacid@kde.org> A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: > Hi there, > > gtk-cairo-test shows a closed annotation on the first page from > http://www.archive.org/download/LaTransformacinDelConceptoDeReflexinDeKantA > Hegel.ElTrnsitoDel/TesisRosa-B5-Uni.pdf. > > The annotation contains the following information: /Open true /Rect > [66.663 622.572 66.663 622.572]. > > I wonder whether this is a bug. I don't think so: * Opening an annotation is something i'd leave for the programs using poppler, not for poppler itself, since it probably means opening a [sub]window somewhere in the program and i don't think we can properly do that from poppler itself * You could consider it to be a bug of gtk-cairo-test itself, but i don't think the aim of gtk-cairo-test is to prove annotations work Albert > > Thanks, > > > Pablo > _______________________________________________ > poppler mailing list > poppler at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/poppler From oinos at web.de Sun Jun 27 11:26:52 2010 From: oinos at web.de (=?ISO-8859-1?Q?Pablo_Rodr=EDguez?=) Date: Sun, 27 Jun 2010 20:26:52 +0200 Subject: [poppler] gtk-cairo-test shows closed annotation In-Reply-To: <201006271918.45268.aacid@kde.org> References: <4C278F96.3060205@web.de> <201006271918.45268.aacid@kde.org> Message-ID: <4C2797EC.8000900@web.de> On 06/27/2010 08:18 PM, Albert Astals Cid wrote: > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: >> Hi there, >> >> gtk-cairo-test shows a closed annotation on the first page from >> http://www.archive.org/download/LaTransformacinDelConceptoDeReflexinDeKantA >> Hegel.ElTrnsitoDel/TesisRosa-B5-Uni.pdf. >> >> The annotation contains the following information: /Open true /Rect >> [66.663 622.572 66.663 622.572]. >> >> I wonder whether this is a bug. > > I don't think so: > * Opening an annotation is something i'd leave for the programs using > poppler, not for poppler itself, since it probably means opening a [sub]window > somewhere in the program and i don't think we can properly do that from > poppler itself > * You could consider it to be a bug of gtk-cairo-test itself, but i don't > think the aim of gtk-cairo-test is to prove annotations work Thanks, Albert, for clarifying this. I simply wondered. Thanks again, Pablo From oinos at web.de Sun Jun 27 11:48:21 2010 From: oinos at web.de (=?UTF-8?B?UGFibG8gUm9kcsOtZ3Vleg==?=) Date: Sun, 27 Jun 2010 20:48:21 +0200 Subject: [poppler] cannot compile under Fedora 13 In-Reply-To: <201006271852.40150.aacid@kde.org> References: <4C264EFA.5000505@web.de> <201006271747.56547.aacid@kde.org> <4C278DDD.6050401@web.de> <201006271852.40150.aacid@kde.org> Message-ID: <4C279CF5.8060204@web.de> On 06/27/2010 07:52 PM, Albert Astals Cid wrote: > A Diumenge, 27 de juny de 2010, Pablo Rodr?guez va escriure: >> Sorry, but I have to respectfully disagree here. But I don't want to >> start a flame. > > We agree to disagree, i'm not sure there's anything to discuss, i understand > your points and could agree to them easily, but we've been running the list > successfully for more than five years with this setup, i don't think we'd get > more patches or better contributors just by changing this setting. > > On the other hand i don't want to be an evil dictator so if people really > really want the change we can do a proper poll about it. Carlos? Pino? > Lurkers? Thanks, Albert, this is probably not needed. Changing that setting would only avoid unintended private replies. Routine makes people focus on the reply contents themselves and not considering before what the reply-to default setting of the mailing list might be. But this is fine. I might be the wrong person, but I had to correct the right recipient to all messages I sent to this list this afternoon. (I have to learn to hit Ctrl+Shift+L when replying to lists ;-).) Sorry for all the fuss, Pablo From chr.feuersaenger at arcor.de Mon Jun 28 09:08:10 2010 From: chr.feuersaenger at arcor.de (Christian Feuersaenger) Date: Mon, 28 Jun 2010 18:08:10 +0200 Subject: [poppler] Implemented Type 4/5 shading for Splash Device In-Reply-To: <201006271755.57105.aacid@kde.org> References: <201006182143.54507.aacid@kde.org> <201006201543.44620.aacid@kde.org> <201006271755.57105.aacid@kde.org> Message-ID: <4C28C8EA.2030506@arcor.de> Hi Albert, thank you for investing your time in my contributions! I will look into your suggestions and commit a new patch proposal once I found a more satisfying solution. I have now test pdfs (and ready applications) for pdf Shading Type 6 and Shading Type 7 (patches). There are several graphics bugs which seem like bogus memory initialisation when displaying them, so I'll look into them as well (unless someone else is currently doing so). Concerning the low level linear interpolation shader, I've come quite far, yet it needs some further attention. Best regards Christian Am 27.06.2010 18:55, schrieb Albert Astals Cid: > A Diumenge, 20 de juny de 2010, Albert Astals Cid va escriure: >> A Divendres, 18 de juny de 2010, Albert Astals Cid va escriure: >>> A Dimecres, 16 de juny de 2010, Christian Feuersaenger va escriure: >>>> Dear Poppler Developers, >>>> >>>> attached you find my bugfix proposal to improve rendering of Type 4/5 >>>> Shadings (Gouraud Interpolated Triangle Shadings). >>>> >>>> What it does is: >>>> 1. implement the Function lookup to fix buggy display of parameterized >>>> shadings, >>>> >>>> 2. Improve the triangle refinement control such that it runs 5 times >>>> faster, >>>> >>>> 3. Share path memory between successive flat triangles which gains >>>> another 10% runtime improvement (avoids many new/delete operations). >>>> >>>> I believe the changes are stable and should work without problems. The >>>> attached patch file patches against branch poppler-0.14 . Note that I >>>> changed the access policies to GfxSubPath: it has no setter methods >>>> which allows to re-use the same path with different coordinates (Point >>>> 3 of the list above). >>> >>> I'm running the regression testing with your patch, if no regressions are >>> detected then we can look at the code and see if we like it or not :D >>> >>> Thanks for the patch :-) >> >> Passed the regression testing fine, will have a look at the code later >> today. > > It took a bit more than expected, sorry about that. > > I've removed the debug code and the #ifdef for the speedup, since yes, we > obviously want the speedup, i'm attaching my work in progress patch. > > I like you to do two things though. > > Please change > > + // preallocate a path. > + // Overwriting the coordinates saves about 10% at runtime for larger > + // shadings. > + state->moveTo(0., 0.); > + state->lineTo(1., 0.); > + state->lineTo(0., 1.); > + state->closePath(); > > to a proper call like state->preallocatePath(); or something like this, since > that four lines smell "big hack" and even though it is a hack i think it makes > sense to have a function for it and not just create a fake triangle. > > Can you please explain/rephrase > > + // this always produces output -- even for parameterized ranges. > + // But it is wrong for parameterized colors: > > Thanks for the patch and sorry again for the delay. > > Albert > >> >> Albert >> >>> Albert >>> >>>> Looking forward to your opinions, >>>> >>>> best regards >>>> >>>> Christian >>>> >>>> PS >>>> I will send patch files for the implemented draft of *real* gouraud >>>> interpolated shadings when they become more or less stable. >>>> >>>> Am 14.06.2010 23:07, schrieb Albert Astals Cid: >>>>> A Dilluns, 14 de juny de 2010, Christian Feuersaenger va escriure: >>>>>> Hi Albert, >>>>>> >>>>>> thank you for the fast reply and your positive answer! >>>>>> >>>>>> I will use the next days to apply the xpdf patches to libpoppler. >>>>>> >>>>>> I intent to patch the patched triangle refinement to your stable >>>>>> branch, which appears to be the poppler-0.14 (?). I consider it to >>>>>> be a bugfix. >>>>> >>>>> Right poppler 0.14 is our stable branch. >>>>> >>>>>> The interpolated shader is not yet stable and may need some >>>>>> revisions. I will continue working on it, preferrable on a separate >>>>>> branch. If you like, I can try to make a www git repository >>>>>> somewhere such that you can fetch my changes and merge them to >>>>>> whereever you want. >>>>> >>>>> Personally i'd prefer that you send the patches to the mailing list, >>>>> makes easier for more people to see them and comment if they feel >>>>> like. >>>>> >>>>> Albert >>>>> >>>>>> For the moment, you find my test.pdf attached. it has been generated >>>>>> with latex and the unstable version of \usepackage{pgfplots}, >>>>>> http://pgfplots.sourceforge.net/; I also attached the .tex sources. >>>>>> >>>>>> So, thank you for the positive feedback. >>>>>> >>>>>> Best regards >>>>>> >>>>>> Christian >>>>>> >>>>>> >> > I am sure my additions are valueable and propose them for >>>>>> >> > usage in libpoppler: the bugfix/speed improvement is >>>>>> >> > directly usable and >>>>>> >>>>>> stable >>>>>> >>>>>> >> > and the lowlevel shader will need some more time. I could >>>>>> >> > also >>>>>> >>>>>> use some >>>>>> >>>>>> >> > advice to get the integration with transparency, blending >>>>>> >> > and >>>>>> >>>>>> whatever >>>>>> >>>>>> >> > correctly. I started with the xpdf sources, so I would >>>>>> >> > also >>>>>> >>>>>> appreciate >>>>>> >>>>>> >> > any hints how you communicate changes between xpdf and >>>>>> >> > libpoppler >>>>>> >>>>>> if you >>>>>> >>>>>> >> > are interested in my proposal. >>>>>> > >>>>>> > Yes, we are interested in your patches, basically what we would >>>>>> > need >>>>>> >>>>>> you is to >>>>>> >>>>>> > provide a patch over poppler sources, you can choose wheter you >>>>>> > want >>>>>> >>>>>> to make >>>>>> >>>>>> > it against git master branch, git poppler-0.14 branch or the >>>>>> > released >>>>>> >>>>>> 0.14.0 >>>>>> >>>>>> > tarball. >>>>>> > >>>>>> > Also it would be interesting to have the PDF you have used for >>>>>> > testing. >>>>>> > >>>>>> > Thanks, >>>>>> > >>>>>> > Albert >>>>>> >>>>>> _______________________________________________ >>>>>> poppler mailing list >>>>>> poppler at lists.freedesktop.org >>>>>> http://lists.freedesktop.org/mailman/listinfo/poppler >>>>> >>>>> _______________________________________________ >>>>> poppler mailing list >>>>> poppler at lists.freedesktop.org >>>>> http://lists.freedesktop.org/mailman/listinfo/poppler >>> >>> _______________________________________________ >>> poppler mailing list >>> poppler at lists.freedesktop.org >>> http://lists.freedesktop.org/mailman/listinfo/poppler >> >> _______________________________________________ >> poppler mailing list >> poppler at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/poppler >> >> >> _______________________________________________ >> poppler mailing list >> poppler at lists.freedesktop.org >> http://lists.freedesktop.org/mailman/listinfo/poppler From eng.mohamed.nour.eldin at gmail.com Tue Jun 29 04:13:35 2010 From: eng.mohamed.nour.eldin at gmail.com (Mohamed Mohamed Nour El-Din) Date: Tue, 29 Jun 2010 14:13:35 +0300 Subject: [poppler] cross-compiling poppler Message-ID: hi, i'm trying to cross-compile poppler for running a pdf-viewer on an arm board, i got all the dependencies ready for the cross-compiling, but i'm still facing errors telling me that the linker can't see where i'm putting these dependencies this's when checking for lcms: arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -llcms this what i write when configuring: LDFLAGES=-L/media/E/mini_fs/mini_qt_new/staging/usr/lib CPPFLAGS=-I/media/E/mini_fs/mini_qt_new/staging/usr/include CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr where /media/E/mini_fs/mini_qt_new/staging is the path of the cross-compiled libraries any help? thanks, -------------- next part -------------- An HTML attachment was scrubbed... URL: From hib at hiberis.nl Tue Jun 29 04:20:04 2010 From: hib at hiberis.nl (Hib Eris) Date: Tue, 29 Jun 2010 13:20:04 +0200 Subject: [poppler] cross-compiling poppler In-Reply-To: References: Message-ID: On Tue, Jun 29, 2010 at 1:13 PM, Mohamed Mohamed Nour El-Din wrote: > this what i write when configuring: > LDFLAGES=-L/media/E/mini_fs/mini_qt_new/staging/usr/lib > CPPFLAGS=-I/media/E/mini_fs/mini_qt_new/staging/usr/include CC=arm-linux-gcc > ./configure --host=arm-linux --prefix=/usr > where?/media/E/mini_fs/mini_qt_new/staging is the path of the cross-compiled > libraries Shouldn't that be LDFLAGS instead of LDFLAGES? Cheers, Hib From eng.mohamed.nour.eldin at gmail.com Tue Jun 29 06:24:53 2010 From: eng.mohamed.nour.eldin at gmail.com (Mohamed Mohamed Nour El-Din) Date: Tue, 29 Jun 2010 16:24:53 +0300 Subject: [poppler] cross-compiling poppler In-Reply-To: References: Message-ID: thnx hib, when edited it to LDFLAGS, the configure gave me an error because it can't find libc.so.0 which is found in /media/E/mini_fs/mini_qt_new/staging/lib not /media/E/mini_fs/mini_qt_new/staging/usr/lib so when i made LDFLAGS=-L/media/E/mini_fs/mini_qt_new/staging/lib the configure worked but the make gave the same old error that the linker can't see the dependencies: arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -llcms when i disabled the cms, i got the same error with libpng12 i made LIBPNG_CFLAGS=-I/media/E/mini_fs/mini_qt_new/staging/usr/include/libpng12 but nothing new happened -------------- next part -------------- An HTML attachment was scrubbed... URL: From buchner.johannes at gmx.at Tue Jun 29 09:41:03 2010 From: buchner.johannes at gmx.at (Johannes Buchner) Date: Tue, 29 Jun 2010 18:41:03 +0200 Subject: [poppler] cross-compiling poppler In-Reply-To: References: Message-ID: <4C2A221F.3020307@gmx.at> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 29.06.2010 13:13, Mohamed Mohamed Nour El-Din wrote: > hi, > i'm trying to cross-compile poppler for running a pdf-viewer on an arm > board, > i got all the dependencies ready for the cross-compiling, but i'm still > facing errors telling me that the linker can't see where i'm putting > these dependencies > this's when checking for lcms: > arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -llcms > > this what i write when configuring: > LDFLAGES=-L/media/E/mini_fs/mini_qt_new/staging/usr/lib > CPPFLAGS=-I/media/E/mini_fs/mini_qt_new/staging/usr/include > CC=arm-linux-gcc ./configure --host=arm-linux --prefix=/usr > > where /media/E/mini_fs/mini_qt_new/staging is the path of the > cross-compiled libraries > > any help? > > thanks, On 29.06.2010 15:24, Mohamed Mohamed Nour El-Din wrote: > thnx hib, > > when edited it to LDFLAGS, the configure gave me an error because it > can't find libc.so.0 which is found > in /media/E/mini_fs/mini_qt_new/staging/lib > not /media/E/mini_fs/mini_qt_new/staging/usr/lib > > so when i made LDFLAGS=-L/media/E/mini_fs/mini_qt_new/staging/lib > the configure worked but the make gave the same old error that the > linker can't see the dependencies: > arm-unknown-linux-uclibcgnueabi/bin/ld: cannot find -llcms > > when i disabled the cms, i got the same error with libpng12 > > i > made LIBPNG_CFLAGS=-I/media/E/mini_fs/mini_qt_new/staging/usr/include/libpng12 > but nothing new happened > Not sure what's so hard about it. Just add all library directories with - -L and all include directories with -I . LDFLAGS="-L /media/E/mini_fs/mini_qt_new/staging/usr/lib -L /media/E/mini_fs/mini_qt_new/staging/usr/lib" Usually the additional cpp compiler (not linker) flags are called CXXFLAGS, and you might want to set CFLAGS too. Cheers, Johannes -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) iEYEARECAAYFAkwqIh4ACgkQ7X1+MfqVcr1SCQCfTfjDkico2ecHoB+oSYYMju4b oPMAn1KLRvc3v7WRg+dY2RazomCgJxVA =jtd5 -----END PGP SIGNATURE----- From aacid at kemper.freedesktop.org Tue Jun 29 13:45:11 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 29 Jun 2010 13:45:11 -0700 (PDT) Subject: [poppler] poppler/JBIG2Stream.cc Message-ID: <20100629204511.B8F6E10057@kemper.freedesktop.org> poppler/JBIG2Stream.cc | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 16e15ac845206217086e2adac9f220e75c0c630d Author: Albert Astals Cid Date: Tue Jun 29 21:44:02 2010 +0100 bitmap can be null at this stage, check it isn't diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc index 95123a6..f13f662 100644 --- a/poppler/JBIG2Stream.cc +++ b/poppler/JBIG2Stream.cc @@ -2461,6 +2461,9 @@ void JBIG2Stream::readPatternDictSeg(Guint segNum, Guint length) { templ, gFalse, gFalse, NULL, atx, aty, length - 7); + if (!bitmap) + return; + // create the pattern dict object patternDict = new JBIG2PatternDict(segNum, grayMax + 1); From aacid at kemper.freedesktop.org Tue Jun 29 13:45:35 2010 From: aacid at kemper.freedesktop.org (Albert Astals Cid) Date: Tue, 29 Jun 2010 13:45:35 -0700 (PDT) Subject: [poppler] Branch 'poppler-0.14' - poppler/JBIG2Stream.cc Message-ID: <20100629204535.4B2AD10057@kemper.freedesktop.org> poppler/JBIG2Stream.cc | 3 +++ 1 file changed, 3 insertions(+) New commits: commit 4c6ecdf1c65bfc9949aa0b9a7fd8cea36e36cc8d Author: Albert Astals Cid Date: Tue Jun 29 21:44:02 2010 +0100 bitmap can be null at this stage, check it isn't diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc index 95123a6..f13f662 100644 --- a/poppler/JBIG2Stream.cc +++ b/poppler/JBIG2Stream.cc @@ -2461,6 +2461,9 @@ void JBIG2Stream::readPatternDictSeg(Guint segNum, Guint length) { templ, gFalse, gFalse, NULL, atx, aty, length - 7); + if (!bitmap) + return; + // create the pattern dict object patternDict = new JBIG2PatternDict(segNum, grayMax + 1); From carlosgc at kemper.freedesktop.org Wed Jun 30 09:21:21 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Wed, 30 Jun 2010 09:21:21 -0700 (PDT) Subject: [poppler] 6 commits - configure.ac glib/poppler-action.cc glib/poppler-annot.cc glib/poppler-attachment.cc glib/poppler-attachment.h glib/poppler-document.cc glib/poppler-features.h.in glib/poppler-form-field.cc glib/poppler-layer.cc glib/poppler-media.cc glib/poppler-movie.cc glib/poppler-page.cc glib/reference gtk-doc.make m4/gtk-doc.m4 Message-ID: <20100630162122.1108EF80FD@kemper.freedesktop.org> configure.ac | 3 glib/poppler-action.cc | 6 glib/poppler-annot.cc | 6 glib/poppler-attachment.cc | 6 glib/poppler-attachment.h | 16 glib/poppler-document.cc | 8 glib/poppler-features.h.in | 59 +++ glib/poppler-form-field.cc | 6 glib/poppler-layer.cc | 6 glib/poppler-media.cc | 6 glib/poppler-movie.cc | 6 glib/poppler-page.cc | 6 glib/reference/Makefile.am | 2 glib/reference/poppler-docs.sgml | 15 glib/reference/poppler-sections.txt | 424 ++++++++++++++++------- glib/reference/poppler.types | 4 glib/reference/tmpl/poppler-action.sgml | 216 ------------ glib/reference/tmpl/poppler-annot.sgml | 377 --------------------- glib/reference/tmpl/poppler-attachment.sgml | 68 --- glib/reference/tmpl/poppler-document.sgml | 410 ---------------------- glib/reference/tmpl/poppler-enums.sgml | 246 ------------- glib/reference/tmpl/poppler-features.sgml | 83 ---- glib/reference/tmpl/poppler-form-field.sgml | 318 ----------------- glib/reference/tmpl/poppler-layer.sgml | 83 ---- glib/reference/tmpl/poppler-page.sgml | 483 --------------------------- glib/reference/tmpl/poppler-private.sgml | 148 -------- glib/reference/tmpl/poppler-unused.sgml | 8 glib/reference/tmpl/poppler.sgml | 285 --------------- glib/reference/tmpl/stamp-poppler-enums.sgml | 22 - glib/reference/version.xml.in | 1 gtk-doc.make | 78 ++-- m4/gtk-doc.m4 | 2 32 files changed, 498 insertions(+), 2909 deletions(-) New commits: commit 19e1944c00ac2da6b18b015721fc3a8d1898a23a Author: Carlos Garcia Campos Date: Wed Jun 30 18:01:52 2010 +0200 [glib] docs: Add media and movie to docs diff --git a/glib/poppler-media.cc b/glib/poppler-media.cc index b871fd9..1380fef 100644 --- a/glib/poppler-media.cc +++ b/glib/poppler-media.cc @@ -25,6 +25,12 @@ #include "poppler-media.h" #include "poppler-private.h" +/** + * SECTION: poppler-media + * @short_description: Media + * @title: PopplerMedia + */ + typedef struct _PopplerMediaClass PopplerMediaClass; struct _PopplerMedia diff --git a/glib/poppler-movie.cc b/glib/poppler-movie.cc index fd3c163..b162653 100644 --- a/glib/poppler-movie.cc +++ b/glib/poppler-movie.cc @@ -21,6 +21,12 @@ #include "poppler-movie.h" #include "poppler-private.h" +/** + * SECTION: poppler-movie + * @short_description: Movies + * @title: PopplerMovie + */ + typedef struct _PopplerMovieClass PopplerMovieClass; struct _PopplerMovie diff --git a/glib/reference/poppler-docs.sgml b/glib/reference/poppler-docs.sgml index 2240c5e..8486da5 100644 --- a/glib/reference/poppler-docs.sgml +++ b/glib/reference/poppler-docs.sgml @@ -19,9 +19,10 @@ - + + commit ca48bee07e6b4a20ea7b40b472a335e75feb4739 Author: Carlos Garcia Campos Date: Wed Jun 30 17:56:50 2010 +0200 [glib] docs: Add missing types to poppler.types diff --git a/glib/reference/poppler.types b/glib/reference/poppler.types index 4e4bc33..eed9849 100644 --- a/glib/reference/poppler.types +++ b/glib/reference/poppler.types @@ -4,3 +4,7 @@ poppler_document_get_type poppler_page_get_type poppler_attachment_get_type poppler_form_field_get_type +poppler_annot_get_type +poppler_layer_get_type +poppler_media_get_type +poppler_movie_get_type commit 613ccf81317a007ed5017ee788466613a6699bb5 Author: Carlos Garcia Campos Date: Wed Jun 30 17:54:22 2010 +0200 [glib] docs: rework poppler-sections.txt - Better organization of sections and contents - Use of Standard and Private subsections - Add missing sections - Remove enums section diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt index 070fdc9..65ec2cb 100644 --- a/glib/reference/poppler-sections.txt +++ b/glib/reference/poppler-sections.txt @@ -1,72 +1,113 @@ +poppler.h +
poppler-page -poppler_page_render -poppler_page_render_to_pixbuf -poppler_page_get_size +PopplerPage +PopplerPage +PopplerRectangle +PopplerPageTransition +PopplerLinkMapping +PopplerImageMapping +PopplerFormFieldMapping +PopplerAnnotMapping +PopplerPageTransitionType +PopplerPageTransitionAlignment +PopplerPageTransitionDirection +PopplerSelectionStyle poppler_page_get_index -poppler_page_get_thumbnail +poppler_page_get_size +poppler_page_get_crop_box +poppler_page_get_duration +poppler_page_get_transition poppler_page_get_thumbnail_size +poppler_page_get_thumbnail +poppler_page_get_thumbnail_pixbuf +poppler_page_render +poppler_page_render_for_printing +poppler_page_render_to_pixbuf +poppler_page_render_to_pixbuf_for_printing poppler_page_render_to_ps +poppler_page_render_selection +poppler_page_render_selection_to_pixbuf +poppler_page_get_selection_region +poppler_page_selection_region_free poppler_page_find_text poppler_page_get_text -poppler_page_get_duration -poppler_page_get_transition +poppler_page_get_text_layout poppler_page_get_link_mapping poppler_page_free_link_mapping poppler_page_get_image_mapping +poppler_page_get_image poppler_page_free_image_mapping poppler_page_get_form_field_mapping poppler_page_free_form_field_mapping -poppler_page_get_selection_region -poppler_page_render_selection -poppler_page_render_selection_to_pixbuf -POPPLER_TYPE_RECTANGLE -PopplerRectangle -poppler_rectangle_get_type +poppler_page_get_annot_mapping +poppler_page_free_annot_mapping poppler_rectangle_new poppler_rectangle_copy poppler_rectangle_free -POPPLER_TYPE_PAGE_TRANSITION -PopplerPageTransition -poppler_page_transition_get_type poppler_page_transition_new poppler_page_transition_copy poppler_page_transition_free -POPPLER_TYPE_LINK_MAPPING -PopplerLinkMapping -poppler_link_mapping_get_type poppler_link_mapping_new poppler_link_mapping_copy poppler_link_mapping_free -POPPLER_TYPE_IMAGE_MAPPING -PopplerImageMapping -poppler_image_mapping_get_type poppler_image_mapping_new poppler_image_mapping_copy poppler_image_mapping_free -POPPLER_TYPE_FORM_FIELD_MAPPING -PopplerFormFieldMapping -poppler_form_field_mapping_get_type poppler_form_field_mapping_new poppler_form_field_mapping_copy poppler_form_field_mapping_free +poppler_annot_mapping_new +poppler_annot_mapping_copy +poppler_annot_mapping_free + POPPLER_PAGE POPPLER_IS_PAGE POPPLER_TYPE_PAGE +POPPLER_TYPE_RECTANGLE +POPPLER_TYPE_PAGE_TRANSITION +POPPLER_TYPE_LINK_MAPPING +POPPLER_TYPE_IMAGE_MAPPING +POPPLER_TYPE_FORM_FIELD_MAPPING +POPPLER_TYPE_ANNOT_MAPPING +POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT +POPPLER_TYPE_PAGE_TRANSITION_DIRECTION +POPPLER_TYPE_PAGE_TRANSITION_TYPE +POPPLER_TYPE_SELECTION_STYLE + poppler_page_get_type +poppler_rectangle_get_type +poppler_page_transition_get_type +poppler_link_mapping_get_type +poppler_image_mapping_get_type +poppler_form_field_mapping_get_type +poppler_annot_mapping_get_type +poppler_page_transition_alignment_get_type +poppler_page_transition_direction_get_type +poppler_page_transition_type_get_type +poppler_selection_style_get_type
poppler-document +PopplerDocument +PopplerDocument +PopplerIndexIter +PopplerFontsIter +PopplerLayersIter PopplerPageLayout PopplerPageMode +PopplerFontInfo PopplerFontType +PopplerPSFile PopplerViewerPreferences PopplerPermissions poppler_document_new_from_file poppler_document_new_from_data poppler_document_save +poppler_document_save_a_copy poppler_document_get_n_pages poppler_document_get_page poppler_document_get_page_by_label @@ -74,7 +115,6 @@ poppler_document_find_dest poppler_document_has_attachments poppler_document_get_attachments poppler_document_get_form_field -poppler_index_iter_get_type poppler_index_iter_new poppler_index_iter_copy poppler_index_iter_free @@ -85,30 +125,66 @@ poppler_index_iter_next poppler_font_info_new poppler_font_info_scan poppler_font_info_free -poppler_fonts_iter_get_type poppler_fonts_iter_copy poppler_fonts_iter_free poppler_fonts_iter_get_name poppler_fonts_iter_get_full_name poppler_fonts_iter_get_font_type +poppler_fonts_iter_get_file_name poppler_fonts_iter_is_embedded poppler_fonts_iter_is_subset poppler_fonts_iter_next +poppler_layers_iter_new +poppler_layers_iter_copy +poppler_layers_iter_free +poppler_layers_iter_get_child +poppler_layers_iter_get_layer +poppler_layers_iter_get_title +poppler_layers_iter_next poppler_ps_file_new +poppler_ps_file_free poppler_ps_file_set_paper_size poppler_ps_file_set_duplex -poppler_ps_file_free + POPPLER_DOCUMENT POPPLER_IS_DOCUMENT POPPLER_TYPE_DOCUMENT +POPPLER_FONT_INFO +POPPLER_IS_FONT_INFO +POPPLER_TYPE_FONT_INFO +POPPLER_TYPE_FONTS_ITER +POPPLER_TYPE_INDEX_ITER +POPPLER_TYPE_LAYER +POPPLER_TYPE_LAYERS_ITER +POPPLER_PS_FILE +POPPLER_IS_PS_FILE +POPPLER_TYPE_PS_FILE +POPPLER_TYPE_FONT_TYPE +POPPLER_TYPE_PAGE_LAYOUT +POPPLER_TYPE_PAGE_MODE +POPPLER_TYPE_PERMISSIONS +POPPLER_TYPE_VIEWER_PREFERENCES + + poppler_document_get_type +poppler_index_iter_get_type +poppler_font_info_get_type +poppler_fonts_iter_get_type +poppler_layers_iter_get_type +poppler_ps_file_get_type +poppler_font_type_get_type +poppler_page_layout_get_type +poppler_page_mode_get_type +poppler_permissions_get_type +poppler_viewer_preferences_get_type
poppler-action -PopplerActionType -PopplerDestType +PopplerAction +PopplerAction +PopplerDest PopplerActionAny PopplerActionGotoDest PopplerActionGotoRemote @@ -116,197 +192,287 @@ PopplerActionLaunch PopplerActionUri PopplerActionNamed PopplerActionMovie -PopplerDest -PopplerAction -POPPLER_TYPE_ACTION -POPPLER_ACTION -poppler_action_get_type +PopplerActionRendition +PopplerActionOCGState +PopplerActionType +PopplerDestType +PopplerActionMovieOperation +PopplerActionLayer +PopplerActionLayerAction poppler_action_copy poppler_action_free -POPPLER_TYPE_DEST -poppler_dest_get_type poppler_dest_copy poppler_dest_free + + +POPPLER_ACTION +POPPLER_TYPE_ACTION +POPPLER_TYPE_ACTION_TYPE +POPPLER_TYPE_DEST +POPPLER_TYPE_DEST_TYPE +POPPLER_TYPE_ACTION_LAYER_ACTION +POPPLER_TYPE_ACTION_MOVIE_OPERATION + + + +poppler_action_get_type +poppler_dest_get_type +poppler_action_type_get_type +poppler_dest_type_get_type +poppler_action_layer_action_get_type +poppler_action_movie_operation_get_type
poppler-attachment +PopplerAttachment PopplerAttachment +PopplerAttachmentSaveFunc poppler_attachment_save poppler_attachment_save_to_callback -PopplerAttachmentSaveFunc + POPPLER_ATTACHMENT POPPLER_IS_ATTACHMENT POPPLER_TYPE_ATTACHMENT + + poppler_attachment_get_type
-
poppler-form-field +PopplerFormField PopplerFormField +PopplerFormFieldType PopplerFormButtonType PopplerFormChoiceType -PopplerFormFieldType PopplerFormTextType -poppler_form_field_get_id poppler_form_field_get_field_type +poppler_form_field_get_id poppler_form_field_is_read_only poppler_form_field_get_font_size poppler_form_field_button_get_button_type poppler_form_field_button_get_state poppler_form_field_button_set_state +poppler_form_field_choice_get_choice_type poppler_form_field_choice_can_select_multiple poppler_form_field_choice_commit_on_change poppler_form_field_choice_do_spell_check -poppler_form_field_choice_get_choice_type poppler_form_field_choice_get_item poppler_form_field_choice_get_n_items poppler_form_field_choice_get_text +poppler_form_field_choice_set_text poppler_form_field_choice_is_editable poppler_form_field_choice_is_item_selected poppler_form_field_choice_select_item -poppler_form_field_choice_set_text poppler_form_field_choice_toggle_item poppler_form_field_choice_unselect_all +poppler_form_field_text_get_text_type +poppler_form_field_text_get_text +poppler_form_field_text_set_text +poppler_form_field_text_get_max_len poppler_form_field_text_do_scroll poppler_form_field_text_do_spell_check -poppler_form_field_text_get_max_len -poppler_form_field_text_get_text -poppler_form_field_text_get_text_type poppler_form_field_text_is_password poppler_form_field_text_is_rich_text -poppler_form_field_text_set_text POPPLER_FORM_FIELD POPPLER_IS_FORM_FIELD POPPLER_TYPE_FORM_FIELD -poppler_form_field_get_type -
+POPPLER_TYPE_FORM_BUTTON_TYPE +POPPLER_TYPE_FORM_CHOICE_TYPE +POPPLER_TYPE_FORM_FIELD_TYPE +POPPLER_TYPE_FORM_TEXT_TYPE -
-poppler-enums -POPPLER_TYPE_ACTION_TYPE -poppler_action_type_get_type -POPPLER_TYPE_DEST_TYPE -poppler_dest_type_get_type -POPPLER_TYPE_PAGE_LAYOUT -poppler_page_layout_get_type -POPPLER_TYPE_PAGE_MODE -poppler_page_mode_get_type -POPPLER_TYPE_FONT_TYPE -poppler_font_type_get_type -POPPLER_TYPE_VIEWER_PREFERENCES -poppler_viewer_preferences_get_type -POPPLER_TYPE_PERMISSIONS -poppler_permissions_get_type -POPPLER_TYPE_SELECTION_STYLE -poppler_selection_style_get_type -POPPLER_TYPE_PAGE_TRANSITION_TYPE -poppler_page_transition_type_get_type -POPPLER_TYPE_PAGE_TRANSITION_ALIGNMENT -poppler_page_transition_alignment_get_type -POPPLER_TYPE_PAGE_TRANSITION_DIRECTION -poppler_page_transition_direction_get_type -POPPLER_TYPE_ERROR -poppler_error_get_type -POPPLER_TYPE_ORIENTATION -poppler_orientation_get_type -POPPLER_TYPE_BACKEND -poppler_backend_get_type + +poppler_form_field_get_type +poppler_form_field_type_get_type +poppler_form_button_type_get_type +poppler_form_choice_type_get_type +poppler_form_text_type_get_type
poppler -poppler_error_quark POPPLER_ERROR PopplerError PopplerOrientation -PopplerDocument -PopplerIndexIter -PopplerFontsIter -PopplerRectangle -PopplerSelectionStyle -PopplerPageTransitionType -PopplerPageTransitionAlignment -PopplerPageTransitionDirection -PopplerLinkMapping -PopplerPage -PopplerFontInfo -PopplerPSFile PopplerBackend +PopplerColor poppler_get_backend poppler_get_version -
+poppler_date_parse +poppler_color_new +poppler_color_copy +poppler_color_free -
-poppler-private -PopplerDocument -PopplerPSFile -PopplerFontInfo -PopplerPage -
+ +POPPLER_TYPE_COLOR +POPPLER_TYPE_BACKEND +POPPLER_TYPE_ERROR +POPPLER_TYPE_ORIENTATION -
-stamp-poppler-enums + +poppler_error_get_type +poppler_error_quark +poppler_backend_get_type +poppler_color_get_type +poppler_orientation_get_type
poppler-annot +PopplerAnnot PopplerAnnot -poppler_annot_callout_line_copy -poppler_annot_callout_line_free -poppler_annot_callout_line_get_type -poppler_annot_callout_line_new -poppler_annot_external_data_type_get_type -poppler_annot_flag_get_type -poppler_annot_free_text_get_callout_line -poppler_annot_free_text_get_quadding -poppler_annot_free_text_get_type -poppler_annot_free_text_quadding_get_type +PopplerAnnotMarkup +PopplerAnnotText +PopplerAnnotFreeText +PopplerAnnotFileAttachment +PopplerAnnotMovie +PopplerAnnotScreen +PopplerAnnotType +PopplerAnnotFlag +PopplerAnnotExternalDataType +PopplerAnnotMarkupReplyType +PopplerAnnotTextState +PopplerAnnotCalloutLine +PopplerAnnotFreeTextQuadding poppler_annot_get_annot_type +poppler_annot_get_id +poppler_annot_get_flags +poppler_annot_get_name +poppler_annot_get_page_index poppler_annot_get_color poppler_annot_get_contents -poppler_annot_get_flags -poppler_annot_get_id +poppler_annot_set_contents poppler_annot_get_modified -poppler_annot_get_name -poppler_annot_get_type -poppler_annot_mapping_copy -poppler_annot_mapping_free -poppler_annot_mapping_get_type -poppler_annot_mapping_new -poppler_annot_markup_get_date -poppler_annot_markup_get_external_data poppler_annot_markup_get_label +poppler_annot_markup_get_subject poppler_annot_markup_get_opacity +poppler_annot_markup_has_popup poppler_annot_markup_get_popup_is_open +poppler_annot_markup_get_popup_rectangle +poppler_annot_markup_get_date +poppler_annot_markup_get_external_data poppler_annot_markup_get_reply_to -poppler_annot_markup_get_subject -poppler_annot_markup_get_type -poppler_annot_markup_reply_type_get_type -poppler_annot_movie_get_movie -poppler_annot_movie_get_title -poppler_annot_movie_get_type poppler_annot_text_get_icon poppler_annot_text_get_is_open poppler_annot_text_get_state +poppler_annot_free_text_get_callout_line +poppler_annot_free_text_get_quadding +poppler_annot_file_attachment_get_attachment +poppler_annot_file_attachment_get_name +poppler_annot_screen_get_action +poppler_annot_movie_get_movie +poppler_annot_movie_get_title +poppler_annot_callout_line_new +poppler_annot_callout_line_copy +poppler_annot_callout_line_free + + +POPPLER_ANNOT +POPPLER_IS_ANNOT +POPPLER_TYPE_ANNOT +POPPLER_ANNOT_FILE_ATTACHMENT +POPPLER_IS_ANNOT_FILE_ATTACHMENT +POPPLER_TYPE_ANNOT_FILE_ATTACHMENT +POPPLER_ANNOT_FREE_TEXT +POPPLER_IS_ANNOT_FREE_TEXT +POPPLER_TYPE_ANNOT_FREE_TEXT +POPPLER_ANNOT_MARKUP +POPPLER_IS_ANNOT_MARKUP +POPPLER_TYPE_ANNOT_MARKUP +POPPLER_ANNOT_MOVIE +POPPLER_IS_ANNOT_MOVIE +POPPLER_TYPE_ANNOT_MOVIE +POPPLER_ANNOT_SCREEN +POPPLER_IS_ANNOT_SCREEN +POPPLER_TYPE_ANNOT_SCREEN +POPPLER_ANNOT_TEXT +POPPLER_IS_ANNOT_TEXT +POPPLER_TYPE_ANNOT_TEXT +POPPLER_TYPE_ANNOT_CALLOUT_LINE +POPPLER_TYPE_ANNOT_EXTERNAL_DATA_TYPE +POPPLER_TYPE_ANNOT_FLAG +POPPLER_TYPE_ANNOT_MARKUP_REPLY_TYPE +POPPLER_TYPE_ANNOT_TEXT_STATE +POPPLER_TYPE_ANNOT_FREE_TEXT_QUADDING +POPPLER_TYPE_ANNOT_TYPE + + +poppler_annot_get_type +poppler_annot_type_get_type +poppler_annot_markup_get_type poppler_annot_text_get_type +poppler_annot_free_text_get_type +poppler_annot_file_attachment_get_type +poppler_annot_screen_get_type +poppler_annot_movie_get_type +poppler_annot_flag_get_type +poppler_annot_external_data_type_get_type +poppler_annot_markup_reply_type_get_type +poppler_annot_callout_line_get_type poppler_annot_text_state_get_type -poppler_annot_type_get_type +poppler_annot_free_text_quadding_get_type
poppler-layer -poppler_layer_get_type +PopplerLayer +PopplerLayer poppler_layer_get_title poppler_layer_is_visible poppler_layer_show poppler_layer_hide poppler_layer_is_parent poppler_layer_get_radio_button_group_id + + +POPPLER_LAYER +POPPLER_IS_LAYER +POPPLER_TYPE_LAYER + + +poppler_layer_get_type +
+ +
+poppler-media +PopplerMedia +PopplerMedia +PopplerMediaSaveFunc +poppler_media_get_filename +poppler_media_get_mime_type +poppler_media_is_embedded +poppler_media_save +poppler_media_save_to_callback + + +POPPLER_MEDIA +POPPLER_IS_MEDIA +POPPLER_TYPE_MEDIA + + +poppler_media_get_type +
+ +
+poppler-movie +PopplerMovie +PopplerMovie +poppler_movie_get_filename +poppler_movie_need_poster +poppler_movie_show_controls + + +POPPLER_MOVIE +POPPLER_IS_MOVIE +POPPLER_TYPE_MOVIE + +poppler_movie_get_type +
commit b37556a32b79f8711ed7eca24abf19511872a70a Author: Carlos Garcia Campos Date: Wed Jun 30 12:01:44 2010 +0200 [glib] docs: Add index of symbols diff --git a/glib/reference/poppler-docs.sgml b/glib/reference/poppler-docs.sgml index 5b1eb2a..2240c5e 100644 --- a/glib/reference/poppler-docs.sgml +++ b/glib/reference/poppler-docs.sgml @@ -24,4 +24,9 @@ + + + Index of all symbols + + commit 7f5fa4e19b4e324a396d64261b9125c1a557ac84 Author: Carlos Garcia Campos Date: Wed Jun 30 12:00:35 2010 +0200 [glib] docs: Add version information diff --git a/configure.ac b/configure.ac index d77805c..8fa2b69 100644 --- a/configure.ac +++ b/configure.ac @@ -632,6 +632,7 @@ utils/Makefile glib/Makefile glib/poppler-features.h glib/reference/Makefile +glib/reference/version.xml glib/demo/Makefile test/Makefile qt/Makefile diff --git a/glib/reference/Makefile.am b/glib/reference/Makefile.am index fc99ed1..273336d 100644 --- a/glib/reference/Makefile.am +++ b/glib/reference/Makefile.am @@ -85,4 +85,4 @@ include $(top_srcdir)/gtk-doc.make # Other files to distribute # e.g. EXTRA_DIST += version.xml.in -EXTRA_DIST += +EXTRA_DIST += version.xml.in diff --git a/glib/reference/poppler-docs.sgml b/glib/reference/poppler-docs.sgml index 33dc2c4..5b1eb2a 100644 --- a/glib/reference/poppler-docs.sgml +++ b/glib/reference/poppler-docs.sgml @@ -1,9 +1,14 @@ + "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [ + +]> Poppler Reference Manual + + for Poppler &version; + diff --git a/glib/reference/version.xml.in b/glib/reference/version.xml.in new file mode 100644 index 0000000..9b6e99e --- /dev/null +++ b/glib/reference/version.xml.in @@ -0,0 +1 @@ + at POPPLER_VERSION@ commit 848d5e158fa9eadd19a658db314ba3fff9d026e8 Author: Carlos Garcia Campos Date: Wed Jun 30 11:30:41 2010 +0200 [glib] docs: do not use gtk-doc templates diff --git a/configure.ac b/configure.ac index 48a3f15..d77805c 100644 --- a/configure.ac +++ b/configure.ac @@ -397,7 +397,7 @@ fi AM_CONDITIONAL(BUILD_POPPLER_GLIB, test x$enable_poppler_glib = xyes) AC_SUBST(GLIB_REQ) -GTK_DOC_CHECK([1.0]) +GTK_DOC_CHECK([1.14],[--flavour no-tmpl]) dnl dnl GDK diff --git a/glib/poppler-action.cc b/glib/poppler-action.cc index 871d3cf..c076551 100644 --- a/glib/poppler-action.cc +++ b/glib/poppler-action.cc @@ -19,6 +19,12 @@ #include "poppler.h" #include "poppler-private.h" +/** + * SECTION:poppler-action + * @short_description: Action links + * @title: PopplerAction + */ + POPPLER_DEFINE_BOXED_TYPE (PopplerDest, poppler_dest, poppler_dest_copy, poppler_dest_free) /** diff --git a/glib/poppler-annot.cc b/glib/poppler-annot.cc index 87964f7..0c40f10 100644 --- a/glib/poppler-annot.cc +++ b/glib/poppler-annot.cc @@ -21,6 +21,12 @@ #include "poppler.h" #include "poppler-private.h" +/** + * SECTION:poppler-annot + * @short_description: Annotations + * @title: PopplerAnnot + */ + typedef struct _PopplerAnnotClass PopplerAnnotClass; typedef struct _PopplerAnnotMarkupClass PopplerAnnotMarkupClass; typedef struct _PopplerAnnotFreeTextClass PopplerAnnotFreeTextClass; diff --git a/glib/poppler-attachment.cc b/glib/poppler-attachment.cc index 6a098e1..6ff20b2 100644 --- a/glib/poppler-attachment.cc +++ b/glib/poppler-attachment.cc @@ -23,6 +23,12 @@ #include "poppler.h" #include "poppler-private.h" +/** + * SECTION:poppler-attachment + * @short_description: Attachments + * @title: PopplerAttachment + */ + /* FIXME: We need to add gettext support sometime */ #define _(x) (x) diff --git a/glib/poppler-attachment.h b/glib/poppler-attachment.h index d506167..7d24c4a 100644 --- a/glib/poppler-attachment.h +++ b/glib/poppler-attachment.h @@ -32,6 +32,22 @@ G_BEGIN_DECLS #define POPPLER_IS_ATTACHMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), POPPLER_TYPE_ATTACHMENT)) +/** + * PopplerAttachmentSaveFunc: + * @buf: buffer containing bytes to be written. + * @count: number of bytes in @buf. + * @data: user data passed to poppler_attachment_save_to_callback() + * @error: GError to set on error, or NULL + * + * Specifies the type of the function passed to + * poppler_attachment_save_to_callback(). It is called once for each block of + * bytes that is "written" by poppler_attachment_save_to_callback(). If + * successful it should return %TRUE. If an error occurs it should set + * @error and return %FALSE, in which case poppler_attachment_save_to_callback() + * will fail with the same error. + * + * @Returns: %TRUE if successful, %FALSE (with @error set) if failed. + */ typedef gboolean (*PopplerAttachmentSaveFunc) (const gchar *buf, gsize count, gpointer data, diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index b265a34..00669c0 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -36,6 +36,14 @@ #include "poppler-private.h" #include "poppler-enums.h" +/** + * SECTION:poppler-document + * @short_description: Information about a document + * @title: PopplerDocument + * + * The #PopplerDocument is an object used to refer to a main document. + */ + enum { PROP_0, PROP_TITLE, diff --git a/glib/poppler-features.h.in b/glib/poppler-features.h.in index 99c7ed8..279c960 100644 --- a/glib/poppler-features.h.in +++ b/glib/poppler-features.h.in @@ -19,13 +19,72 @@ #ifndef __POPPLER_FEATURES_H__ #define __POPPLER_FEATURES_H__ +/** + * SECTION:poppler-features + * @short_description: Variables and functions to check the poppler version and features + * @Title: Version and Features Information + * + * Poppler provides version information, and information about features + * enabled at compile time. This is primarily useful in configure checks + * for builds that have a configure script, or for allowing code to optionally + * depend but not require a specific poppler version. + */ + +/** + * POPPLER_HAS_CAIRO: + * + * Defined if poppler was compiled with cairo support. + */ @CAIRO_FEATURE@ +/** + * POPPLER_WITH_GDK: + * + * Defined if poppler was compiled with GDK support. + */ @GDK_FEATURE@ +/** + * POPPLER_MAJOR_VERSION: + * + * The major version number of the poppler header files (e.g. in poppler version + * 0.1.2 this is 0.) + * + * Since: 0.12 + */ #define POPPLER_MAJOR_VERSION (@POPPLER_MAJOR_VERSION@) + +/** + * POPPLER_MINOR_VERSION: + * + * The major version number of the poppler header files (e.g. in poppler version + * 0.1.2 this is 1.) + * + * Since: 0.12 + */ #define POPPLER_MINOR_VERSION (@POPPLER_MINOR_VERSION@) + +/** + * POPPLER_MICRO_VERSION: + * + * The micro version number of the poppler header files (e.g. in poppler version + * 0.1.2 this is 2.) + * + * Since: 0.12 + */ #define POPPLER_MICRO_VERSION (@POPPLER_MICRO_VERSION@) +/** + * POPPLER_CHECK_VERSION: + * + * @major: major version (e.g. 0 for version 0.1.2) + * @minor: minor version (e.g. 1 for version 0.1.2) + * @micro: micro version (e.g. 2 for version 0.1.2) + * + * Returns %TRUE if the version of the poppler header files is the same + * as or newer than the passed-in version. + * + * Since: 0.12 + */ #define POPPLER_CHECK_VERSION(major,minor,micro) \ (POPPLER_MAJOR_VERSION > (major) || \ (POPPLER_MAJOR_VERSION == (major) && POPPLER_MINOR_VERSION > (minor)) || \ diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc index 4ed5b9e..46d0370 100644 --- a/glib/poppler-form-field.cc +++ b/glib/poppler-form-field.cc @@ -21,6 +21,12 @@ #include "poppler.h" #include "poppler-private.h" +/** + * SECTION:poppler-form-field + * @short_description: Form Field + * @title: PoppplerFormField + */ + typedef struct _PopplerFormFieldClass PopplerFormFieldClass; struct _PopplerFormFieldClass { diff --git a/glib/poppler-layer.cc b/glib/poppler-layer.cc index 43aa85a..021ca0b 100644 --- a/glib/poppler-layer.cc +++ b/glib/poppler-layer.cc @@ -20,6 +20,12 @@ #include "poppler-layer.h" #include "poppler-private.h" +/** + * SECTION:poppler-layer + * @short_description: Layers + * @title: PopplerLayer + */ + typedef struct _PopplerLayerClass PopplerLayerClass; struct _PopplerLayerClass { diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc index a3f378b..3b2f64d 100644 --- a/glib/poppler-page.cc +++ b/glib/poppler-page.cc @@ -32,6 +32,12 @@ #include "poppler.h" #include "poppler-private.h" +/** + * SECTION:poppler-page + * @short_description: Information about a page in a document + * @title: PopplerPage + */ + enum { PROP_0, diff --git a/glib/reference/tmpl/poppler-action.sgml b/glib/reference/tmpl/poppler-action.sgml deleted file mode 100644 index 26dbc17..0000000 --- a/glib/reference/tmpl/poppler-action.sgml +++ /dev/null @@ -1,216 +0,0 @@ - -PopplerAction - - -Action links - - - - - - - - - - - - - - - - - - - - - - - at POPPLER_ACTION_UNKNOWN: - at POPPLER_ACTION_NONE: - at POPPLER_ACTION_GOTO_DEST: - at POPPLER_ACTION_GOTO_REMOTE: - at POPPLER_ACTION_LAUNCH: - at POPPLER_ACTION_URI: - at POPPLER_ACTION_NAMED: - at POPPLER_ACTION_MOVIE: - at POPPLER_ACTION_RENDITION: - at POPPLER_ACTION_OCG_STATE: - - - - - - - at POPPLER_DEST_UNKNOWN: - at POPPLER_DEST_XYZ: - at POPPLER_DEST_FIT: - at POPPLER_DEST_FITH: - at POPPLER_DEST_FITV: - at POPPLER_DEST_FITR: - at POPPLER_DEST_FITB: - at POPPLER_DEST_FITBH: - at POPPLER_DEST_FITBV: - at POPPLER_DEST_NAMED: - - - - - - - at type: - at title: - - - - - - - at type: - at title: - at dest: - - - - - - - at type: - at title: - at file_name: - at dest: - - - - - - - at type: - at title: - at file_name: - at params: - - - - - - - at type: - at title: - at uri: - - - - - - - at type: - at title: - at named_dest: - - - - - - - at type: - at title: - at operation: - at movie: - - - - - - - at type: - at page_num: - at left: - at bottom: - at right: - at top: - at zoom: - at named_dest: - at change_left: - at change_top: - at change_zoom: - - - - - - - - - - - - - - - - - - - - at obj: - - - - - - - - at void: - at Returns: - - - - - - - - at action: - at Returns: - - - - - - - - at action: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - at dest: - at Returns: - - - - - - - - at dest: - - diff --git a/glib/reference/tmpl/poppler-annot.sgml b/glib/reference/tmpl/poppler-annot.sgml deleted file mode 100644 index 6eb09a9..0000000 --- a/glib/reference/tmpl/poppler-annot.sgml +++ /dev/null @@ -1,377 +0,0 @@ - -PopplerAnnot - - -Annotations - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at callout: - at Returns: - - - - - - - - at callout: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at mapping: - at Returns: - - - - - - - - at mapping: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at poppler_annot: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - diff --git a/glib/reference/tmpl/poppler-attachment.sgml b/glib/reference/tmpl/poppler-attachment.sgml deleted file mode 100644 index afecdbc..0000000 --- a/glib/reference/tmpl/poppler-attachment.sgml +++ /dev/null @@ -1,68 +0,0 @@ - -PopplerAttachment - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at attachment: - at filename: - at error: - at Returns: - - - - - - - - at attachment: - at save_func: - at user_data: - at error: - at Returns: - - - - -Specifies the type of the function passed to -poppler_attachment_save_to_callback(). It is called once for each block of -bytes that is "written" by poppler_attachment_save_to_callback(). If -successful it should return %TRUE. If an error occurs it should set - at error and return %FALSE, in which case poppler_attachment_save_to_callback() -will fail with the same error. - - - at buf: buffer containing bytes to be written. - at count: number of bytes in @buf. - at data: A location to return an error. - at error: user data passed to poppler_attachment_save_to_callback() - at Returns: %TRUE if successful, %FALSE (with @error set) if failed. - - diff --git a/glib/reference/tmpl/poppler-document.sgml b/glib/reference/tmpl/poppler-document.sgml deleted file mode 100644 index 33cf2de..0000000 --- a/glib/reference/tmpl/poppler-document.sgml +++ /dev/null @@ -1,410 +0,0 @@ - -PopplerDocument - - -Information about a document - - - -The #PopplerDocument is an object used to refer to a main document. - - - - - - - - - - - - - - - - - - at POPPLER_PAGE_LAYOUT_UNSET: - at POPPLER_PAGE_LAYOUT_SINGLE_PAGE: - at POPPLER_PAGE_LAYOUT_ONE_COLUMN: - at POPPLER_PAGE_LAYOUT_TWO_COLUMN_LEFT: - at POPPLER_PAGE_LAYOUT_TWO_COLUMN_RIGHT: - at POPPLER_PAGE_LAYOUT_TWO_PAGE_LEFT: - at POPPLER_PAGE_LAYOUT_TWO_PAGE_RIGHT: - - - - - - - at POPPLER_PAGE_MODE_UNSET: - at POPPLER_PAGE_MODE_NONE: - at POPPLER_PAGE_MODE_USE_OUTLINES: - at POPPLER_PAGE_MODE_USE_THUMBS: - at POPPLER_PAGE_MODE_FULL_SCREEN: - at POPPLER_PAGE_MODE_USE_OC: - at POPPLER_PAGE_MODE_USE_ATTACHMENTS: - - - - - - - at POPPLER_FONT_TYPE_UNKNOWN: - at POPPLER_FONT_TYPE_TYPE1: - at POPPLER_FONT_TYPE_TYPE1C: - at POPPLER_FONT_TYPE_TYPE1COT: - at POPPLER_FONT_TYPE_TYPE3: - at POPPLER_FONT_TYPE_TRUETYPE: - at POPPLER_FONT_TYPE_TRUETYPEOT: - at POPPLER_FONT_TYPE_CID_TYPE0: - at POPPLER_FONT_TYPE_CID_TYPE0C: - at POPPLER_FONT_TYPE_CID_TYPE0COT: - at POPPLER_FONT_TYPE_CID_TYPE2: - at POPPLER_FONT_TYPE_CID_TYPE2OT: - - - - - - - at POPPLER_VIEWER_PREFERENCES_UNSET: - at POPPLER_VIEWER_PREFERENCES_HIDE_TOOLBAR: - at POPPLER_VIEWER_PREFERENCES_HIDE_MENUBAR: - at POPPLER_VIEWER_PREFERENCES_HIDE_WINDOWUI: - at POPPLER_VIEWER_PREFERENCES_FIT_WINDOW: - at POPPLER_VIEWER_PREFERENCES_CENTER_WINDOW: - at POPPLER_VIEWER_PREFERENCES_DISPLAY_DOC_TITLE: - at POPPLER_VIEWER_PREFERENCES_DIRECTION_RTL: - - - - - - - at POPPLER_PERMISSIONS_OK_TO_PRINT: - at POPPLER_PERMISSIONS_OK_TO_MODIFY: - at POPPLER_PERMISSIONS_OK_TO_COPY: - at POPPLER_PERMISSIONS_OK_TO_ADD_NOTES: - at POPPLER_PERMISSIONS_OK_TO_FILL_FORM: - at POPPLER_PERMISSIONS_FULL: - - - - - - - at uri: - at password: - at error: - at Returns: - - - - - - - - at data: - at length: - at password: - at error: - at Returns: - - - - - - - - at document: - at uri: - at error: - at Returns: - - - - - - - - at document: - at Returns: - - - - - - - - at document: - at index: - at Returns: - - - - - - - - at document: - at label: - at Returns: - - - - - - - - at document: - at link_name: - at Returns: - - - - - - - - at document: - at Returns: - - - - - - - - at document: - at Returns: - - - - - - - - at document: - at id: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at document: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - - - - - - - - at parent: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at document: - at Returns: - - - - - - - - at font_info: - at n_pages: - at iter: - at Returns: - - - - - - - - at font_info: - - - - - - - - at void: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at iter: - at Returns: - - - - - - - - at document: - at filename: - at first_page: - at n_pages: - at Returns: - - - - - - - - at ps_file: - at width: - at height: - - - - - - - - at ps_file: - at duplex: - - - - - - - - at ps_file: - - diff --git a/glib/reference/tmpl/poppler-enums.sgml b/glib/reference/tmpl/poppler-enums.sgml deleted file mode 100644 index 1fd9fa4..0000000 --- a/glib/reference/tmpl/poppler-enums.sgml +++ /dev/null @@ -1,246 +0,0 @@ - -poppler-enums - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at void: - at Returns: - - diff --git a/glib/reference/tmpl/poppler-features.sgml b/glib/reference/tmpl/poppler-features.sgml deleted file mode 100644 index f79d961..0000000 --- a/glib/reference/tmpl/poppler-features.sgml +++ /dev/null @@ -1,83 +0,0 @@ - -Version and Features Information - - -Variables and functions to check the poppler version and features - - - -Poppler provides version information, and information about features -enabled at compile time. This is primarily useful in configure checks -for builds that have a configure script, or for allowing code to optionally -depend but not require a specific poppler version. - - - - - - - - - - - - - - - -Defined if poppler was compiled with cairo support. - - - - - - -Defined if poppler was compiled with GDK support. - - - - - - -The major version number of the poppler header files (e.g. in poppler version -0.1.2 this is 0.) - - -Since: 0.11 - - - - - - - -The major version number of the poppler header files (e.g. in poppler version -0.1.2 this is 1.) - -Since: 0.11 - - - - - -The micro version number of the poppler header files (e.g. in poppler version -0.1.2 this is 2.) - - -Since: 0.11 - - - - - -Returns %TRUE if the version of the poppler header files is the same -as or newer than the passed-in version. - - - at major: major version (e.g. 0 for version 0.1.2) - at minor: minor version (e.g. 1 for version 0.1.2) - at micro: micro version (e.g. 2 for version 0.1.2) - -Since: 0.11 - - diff --git a/glib/reference/tmpl/poppler-form-field.sgml b/glib/reference/tmpl/poppler-form-field.sgml deleted file mode 100644 index cb1b4fc..0000000 --- a/glib/reference/tmpl/poppler-form-field.sgml +++ /dev/null @@ -1,318 +0,0 @@ - -PopplerFormField - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at POPPLER_FORM_BUTTON_PUSH: - at POPPLER_FORM_BUTTON_CHECK: - at POPPLER_FORM_BUTTON_RADIO: - - - - - - - at POPPLER_FORM_CHOICE_COMBO: - at POPPLER_FORM_CHOICE_LIST: - - - - - - - at POPPLER_FORM_FIELD_UNKNOWN: - at POPPLER_FORM_FIELD_BUTTON: - at POPPLER_FORM_FIELD_TEXT: - at POPPLER_FORM_FIELD_CHOICE: - at POPPLER_FORM_FIELD_SIGNATURE: - - - - - - - at POPPLER_FORM_TEXT_NORMAL: - at POPPLER_FORM_TEXT_MULTILINE: - at POPPLER_FORM_TEXT_FILE_SELECT: - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at state: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at index: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at index: - at Returns: - - - - - - - - at field: - at index: - - - - - - - - at field: - at text: - - - - - - - - at field: - at index: - - - - - - - - at field: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at Returns: - - - - - - - - at field: - at text: - - diff --git a/glib/reference/tmpl/poppler-layer.sgml b/glib/reference/tmpl/poppler-layer.sgml deleted file mode 100644 index 553c988..0000000 --- a/glib/reference/tmpl/poppler-layer.sgml +++ /dev/null @@ -1,83 +0,0 @@ - -PopplerLayer - - - - - - - - - - - - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - at layer: - at Returns: - - - - - - - - at layer: - at Returns: - - - - - - - - at layer: - - - - - - - - at layer: - - - - - - - - at layer: - at Returns: - - - - - - - - at layer: - at Returns: - - diff --git a/glib/reference/tmpl/poppler-page.sgml b/glib/reference/tmpl/poppler-page.sgml deleted file mode 100644 index d600078..0000000 --- a/glib/reference/tmpl/poppler-page.sgml +++ /dev/null @@ -1,483 +0,0 @@ - -PopplerPage - - -Information about a page in a document - - - - - - - - - - - - - - - - - - - - - - - at page: - at cairo: - - - - - - - - at page: - at src_x: - at src_y: - at src_width: - at src_height: - at scale: - at rotation: - at pixbuf: - - - - - - - - at page: - at width: - at height: - - - - - - - - at page: - at Returns: - - - - - - - - at page: - at Returns: - - - - - - - - at page: - at width: - at height: - at Returns: - - - - - - - - at page: - at ps_file: - - - - - - - - at page: - at text: - at Returns: - - - - - - - - at page: - at style: - at rect: - at Returns: - - - - - - - - at page: - at Returns: - - - - - - - - at page: - at Returns: - - - - - - - - at page: - at Returns: - - - - - - - - at list: - - - - - - - - at page: - at Returns: - - - - - - - - at list: - - - - - - - - at page: - at Returns: - - - - - - - - at list: - - - - - - - - at page: - at scale: - at style: - at selection: - at Returns: - - - - - - - - at page: - at cairo: - at selection: - at old_selection: - at style: - at glyph_color: - at background_color: - - - - - - - - at page: - at scale: - at rotation: - at pixbuf: - at selection: - at old_selection: - at style: - at glyph_color: - at background_color: - - - - - - - - - - - - - - - at x1: - at y1: - at x2: - at y2: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at rectangle: - at Returns: - - - - - - - - at rectangle: - - - - - - - - - - - - - - - at type: - at alignment: - at direction: - at duration: - at angle: - at scale: - at rectangular: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at transition: - at Returns: - - - - - - - - at transition: - - - - - - - - - - - - - - - at area: - at action: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at mapping: - at Returns: - - - - - - - - at mapping: - - - - - - - - - - - - - - - at area: - at image_id: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at mapping: - at Returns: - - - - - - - - at mapping: - - - - - - - - - - - - - - - at area: - at field: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - - - - - - - at mapping: - at Returns: - - - - - - - - at mapping: - - diff --git a/glib/reference/tmpl/poppler-private.sgml b/glib/reference/tmpl/poppler-private.sgml deleted file mode 100644 index bd34e94..0000000 --- a/glib/reference/tmpl/poppler-private.sgml +++ /dev/null @@ -1,148 +0,0 @@ - -poppler-private - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at parent_instance: - at document: - at out: - at filename: - at first_page: - at last_page: - at paper_width: - at paper_height: - at duplex: - - - - - - - at parent_instance: - at document: - at scanner: - - - - - - - - - - - - diff --git a/glib/reference/tmpl/poppler-unused.sgml b/glib/reference/tmpl/poppler-unused.sgml deleted file mode 100644 index 908a494..0000000 --- a/glib/reference/tmpl/poppler-unused.sgml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - at poppler_annot: - at Returns: - diff --git a/glib/reference/tmpl/poppler.sgml b/glib/reference/tmpl/poppler.sgml deleted file mode 100644 index 6bdb369..0000000 --- a/glib/reference/tmpl/poppler.sgml +++ /dev/null @@ -1,285 +0,0 @@ - -poppler - - - - - - - - - - - - - - - - - - - - - - - - - - at void: - at Returns: - - - - - - - - - - - - - - - at POPPLER_ERROR_INVALID: - at POPPLER_ERROR_ENCRYPTED: - at POPPLER_ERROR_OPEN_FILE: - at POPPLER_ERROR_BAD_CATALOG: - at POPPLER_ERROR_DAMAGED: - - - - - - - at POPPLER_ORIENTATION_PORTRAIT: - at POPPLER_ORIENTATION_LANDSCAPE: - at POPPLER_ORIENTATION_UPSIDEDOWN: - at POPPLER_ORIENTATION_SEASCAPE: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - at x1: - at y1: - at x2: - at y2: - - - - - - - at POPPLER_SELECTION_GLYPH: - at POPPLER_SELECTION_WORD: - at POPPLER_SELECTION_LINE: - - - - - - - at POPPLER_PAGE_TRANSITION_REPLACE: - at POPPLER_PAGE_TRANSITION_SPLIT: - at POPPLER_PAGE_TRANSITION_BLINDS: - at POPPLER_PAGE_TRANSITION_BOX: - at POPPLER_PAGE_TRANSITION_WIPE: - at POPPLER_PAGE_TRANSITION_DISSOLVE: - at POPPLER_PAGE_TRANSITION_GLITTER: - at POPPLER_PAGE_TRANSITION_FLY: - at POPPLER_PAGE_TRANSITION_PUSH: - at POPPLER_PAGE_TRANSITION_COVER: - at POPPLER_PAGE_TRANSITION_UNCOVER: - at POPPLER_PAGE_TRANSITION_FADE: - - - - - - - at POPPLER_PAGE_TRANSITION_HORIZONTAL: - at POPPLER_PAGE_TRANSITION_VERTICAL: - - - - - - - at POPPLER_PAGE_TRANSITION_INWARD: - at POPPLER_PAGE_TRANSITION_OUTWARD: - - - - - - - at area: - at action: - - - - - - - - - - - - - - - - - - at parent_instance: - at document: - at scanner: - - - - - - - at parent_instance: - at document: - at out: - at filename: - at first_page: - at last_page: - at paper_width: - at paper_height: - at duplex: - - - - - - - at POPPLER_BACKEND_UNKNOWN: - at POPPLER_BACKEND_SPLASH: - at POPPLER_BACKEND_CAIRO: - - - - - - - at void: - at Returns: - - - - - - - - at void: - at Returns: - - diff --git a/glib/reference/tmpl/stamp-poppler-enums.sgml b/glib/reference/tmpl/stamp-poppler-enums.sgml deleted file mode 100644 index d1c7eec..0000000 --- a/glib/reference/tmpl/stamp-poppler-enums.sgml +++ /dev/null @@ -1,22 +0,0 @@ - -stamp-poppler-enums - - - - - - - - - - - - - - - - - - - - diff --git a/gtk-doc.make b/gtk-doc.make index 264a7cb..5574645 100644 --- a/gtk-doc.make +++ b/gtk-doc.make @@ -30,8 +30,9 @@ EXTRA_DIST = \ $(DOC_MODULE)-sections.txt \ $(DOC_MODULE)-overrides.txt -DOC_STAMPS=scan-build.stamp tmpl-build.stamp sgml-build.stamp html-build.stamp \ - $(srcdir)/tmpl.stamp $(srcdir)/sgml.stamp $(srcdir)/html.stamp +DOC_STAMPS=scan-build.stamp sgml-build.stamp html-build.stamp pdf-build.stamp \ + $(srcdir)/sgml.stamp $(srcdir)/html.stamp \ + $(srcdir)/pdf.stamp SCANOBJ_FILES = \ $(DOC_MODULE).args \ @@ -48,12 +49,23 @@ REPORT_FILES = \ CLEANFILES = $(SCANOBJ_FILES) $(REPORT_FILES) $(DOC_STAMPS) if ENABLE_GTK_DOC -all-local: html-build.stamp +if GTK_DOC_BUILD_HTML +HTML_BUILD_STAMP=html-build.stamp +else +HTML_BUILD_STAMP= +endif +if GTK_DOC_BUILD_PDF +PDF_BUILD_STAMP=pdf-build.stamp +else +PDF_BUILD_STAMP= +endif + +all-local: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) else all-local: endif -docs: html-build.stamp +docs: $(HTML_BUILD_STAMP) $(PDF_BUILD_STAMP) $(REPORT_FILES): sgml-build.stamp @@ -62,8 +74,11 @@ $(REPORT_FILES): sgml-build.stamp scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) @echo 'gtk-doc: Scanning header files' @-chmod -R u+w $(srcdir) - @cd $(srcdir) && \ - gtkdoc-scan --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --ignore-headers="$(IGNORE_HFILES)" $(SCAN_OPTIONS) $(EXTRA_HFILES) + @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + _source_dir="$${_source_dir} --source-dir=$$i" ; \ + done ; \ + cd $(srcdir) && \ + gtkdoc-scan --module=$(DOC_MODULE) --ignore-headers="$(IGNORE_HFILES)" $${_source_dir} $(SCAN_OPTIONS) $(EXTRA_HFILES) @if grep -l '^..*$$' $(srcdir)/$(DOC_MODULE).types > /dev/null 2>&1 ; then \ CC="$(GTKDOC_CC)" LD="$(GTKDOC_LD)" RUN="$(GTKDOC_RUN)" CFLAGS="$(GTKDOC_CFLAGS) $(CFLAGS)" LDFLAGS="$(GTKDOC_LIBS) $(LDFLAGS)" gtkdoc-scangobj $(SCANGOBJ_OPTIONS) --module=$(DOC_MODULE) --output-dir=$(srcdir) ; \ else \ @@ -77,27 +92,16 @@ scan-build.stamp: $(HFILE_GLOB) $(CFILE_GLOB) $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt: scan-build.stamp @true -#### templates #### - -tmpl-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt - @echo 'gtk-doc: Rebuilding template files' - @-chmod -R u+w $(srcdir) - @cd $(srcdir) && gtkdoc-mktmpl --module=$(DOC_MODULE) $(MKTMPL_OPTIONS) - @touch tmpl-build.stamp - -tmpl.stamp: tmpl-build.stamp - @true - -$(srcdir)/tmpl/*.sgml: - @true - #### xml #### -sgml-build.stamp: tmpl.stamp $(DOC_MODULE)-sections.txt $(srcdir)/tmpl/*.sgml $(expand_content_files) +sgml-build.stamp: $(DOC_MODULE)-decl.txt $(SCANOBJ_FILES) $(DOC_MODULE)-sections.txt $(DOC_MODULE)-overrides.txt $(expand_content_files) @echo 'gtk-doc: Building XML' @-chmod -R u+w $(srcdir) - @cd $(srcdir) && \ - gtkdoc-mkdb --module=$(DOC_MODULE) --source-dir=$(DOC_SOURCE_DIR) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $(MKDB_OPTIONS) + @_source_dir='' ; for i in $(DOC_SOURCE_DIR) ; do \ + _source_dir="$${_source_dir} --source-dir=$$i" ; \ + done ; \ + cd $(srcdir) && \ + gtkdoc-mkdb --module=$(DOC_MODULE) --output-format=xml --expand-content-files="$(expand_content_files)" --main-sgml-file=$(DOC_MAIN_SGML_FILE) $${_source_dir} $(MKDB_OPTIONS) @touch sgml-build.stamp sgml.stamp: sgml-build.stamp @@ -115,12 +119,31 @@ html-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) if test "$(?)" = "0"; then \ mkhtml_options=--path="$(srcdir)"; \ fi; \ - cd $(srcdir)/html && gtkdoc-mkhtml $(mkhtml_options) $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) + cd $(srcdir)/html && gtkdoc-mkhtml $$mkhtml_options $(MKHTML_OPTIONS) $(DOC_MODULE) ../$(DOC_MAIN_SGML_FILE) @test "x$(HTML_IMAGES)" = "x" || ( cd $(srcdir) && cp $(HTML_IMAGES) html ) @echo 'gtk-doc: Fixing cross-references' @cd $(srcdir) && gtkdoc-fixxref --module=$(DOC_MODULE) --module-dir=html --html-dir=$(HTML_DIR) $(FIXXREF_OPTIONS) @touch html-build.stamp +#### pdf #### + +pdf-build.stamp: sgml.stamp $(DOC_MAIN_SGML_FILE) $(content_files) + @echo 'gtk-doc: Building PDF' + @-chmod -R u+w $(srcdir) + @rm -rf $(srcdir)/$(DOC_MODULE).pdf + @mkpdf_imgdirs=""; \ + if test "x$(HTML_IMAGES)" != "x"; then \ + for img in $(HTML_IMAGES); do \ + part=`dirname $$img`; \ + echo $$mkpdf_imgdirs | grep >/dev/null "\-\-imgdir=$$part "; \ + if test $$? != 0; then \ + mkpdf_imgdirs="$$mkpdf_imgdirs --imgdir=$$part"; \ + fi; \ + done; \ + fi; \ + cd $(srcdir) && gtkdoc-mkpdf --path="$(abs_srcdir)" $$mkpdf_imgdirs $(DOC_MODULE) $(DOC_MAIN_SGML_FILE) $(MKPDF_OPTIONS) + @touch pdf-build.stamp + ############## clean-local: @@ -129,11 +152,11 @@ clean-local: distclean-local: cd $(srcdir) && \ - rm -rf xml $(REPORT_FILES) \ + rm -rf xml $(REPORT_FILES) $(DOC_MODULE).pdf \ $(DOC_MODULE)-decl-list.txt $(DOC_MODULE)-decl.txt maintainer-clean-local: clean - cd $(srcdir) && rm -rf xml html + cd $(srcdir) && rm -rf html install-data-local: @installfiles=`echo $(srcdir)/html/*`; \ @@ -179,10 +202,9 @@ dist-check-gtkdoc: endif dist-hook: dist-check-gtkdoc dist-hook-local - mkdir $(distdir)/tmpl mkdir $(distdir)/html - -cp $(srcdir)/tmpl/*.sgml $(distdir)/tmpl cp $(srcdir)/html/* $(distdir)/html + -cp $(srcdir)/$(DOC_MODULE).pdf $(distdir)/ -cp $(srcdir)/$(DOC_MODULE).types $(distdir)/ -cp $(srcdir)/$(DOC_MODULE)-sections.txt $(distdir)/ cd $(distdir) && rm -f $(DISTCLEANFILES) diff --git a/m4/gtk-doc.m4 b/m4/gtk-doc.m4 index ef01a82..2cfa1e7 100644 --- a/m4/gtk-doc.m4 +++ b/m4/gtk-doc.m4 @@ -48,7 +48,7 @@ AC_DEFUN([GTK_DOC_CHECK], [build documentation in pdf format [[default=no]]]),, [enable_gtk_doc_pdf=no]) - if test -n "$GTKDOC_MKPDF"; then + if test -z "$GTKDOC_MKPDF"; then enable_gtk_doc_pdf=no fi From carlosgc at kemper.freedesktop.org Wed Jun 30 10:04:51 2010 From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos) Date: Wed, 30 Jun 2010 10:04:51 -0700 (PDT) Subject: [poppler] 4 commits - glib/poppler-document.cc glib/poppler-form-field.cc glib/poppler-page.h glib/reference Message-ID: <20100630170451.48FF310057@kemper.freedesktop.org> glib/poppler-document.cc | 1 + glib/poppler-form-field.cc | 2 +- glib/poppler-page.h | 2 +- glib/reference/poppler-sections.txt | 1 - 4 files changed, 3 insertions(+), 3 deletions(-) New commits: commit 6910545a487f206ccd059bb295d2312228dbf2ba Author: Carlos Garcia Campos Date: Wed Jun 30 19:03:04 2010 +0200 [glib] docs: Remove invalid symbol from poppler-sections.txt diff --git a/glib/reference/poppler-sections.txt b/glib/reference/poppler-sections.txt index 65ec2cb..012eb28 100644 --- a/glib/reference/poppler-sections.txt +++ b/glib/reference/poppler-sections.txt @@ -340,7 +340,6 @@ PopplerAnnotTextState PopplerAnnotCalloutLine PopplerAnnotFreeTextQuadding poppler_annot_get_annot_type -poppler_annot_get_id poppler_annot_get_flags poppler_annot_get_name poppler_annot_get_page_index commit 65ea3b636cb5a38660e526a483a4d95f5acdf8db Author: Carlos Garcia Campos Date: Wed Jun 30 19:02:32 2010 +0200 [glib] docs: fix typo diff --git a/glib/poppler-form-field.cc b/glib/poppler-form-field.cc index 46d0370..33c4b15 100644 --- a/glib/poppler-form-field.cc +++ b/glib/poppler-form-field.cc @@ -542,7 +542,7 @@ poppler_form_field_choice_toggle_item (PopplerFormField *field, } /** - * poppler_form_field_choice_toggle_item: + * poppler_form_field_choice_set_text: * @field: a #PopplerFormField * @text: the new text * commit 689bfec40b5b3030c2819cb4aac42c3ab6279278 Author: Carlos Garcia Campos Date: Wed Jun 30 19:01:47 2010 +0200 [glib] docs: Add missing doc for parameter diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc index 00669c0..4a6b114 100644 --- a/glib/poppler-document.cc +++ b/glib/poppler-document.cc @@ -1661,6 +1661,7 @@ poppler_layers_iter_free (PopplerLayersIter *iter) /** * poppler_layers_iter_new: + * @document: a #PopplerDocument **/ PopplerLayersIter * poppler_layers_iter_new (PopplerDocument *document) commit 0b3d77627f255a4bf3da6ee875ad8d9eb931c96e Author: Carlos Garcia Campos Date: Wed Jun 30 19:00:59 2010 +0200 [glib] Use the same name for parameter in function prototype diff --git a/glib/poppler-page.h b/glib/poppler-page.h index 3a31acd..f49f876 100644 --- a/glib/poppler-page.h +++ b/glib/poppler-page.h @@ -96,7 +96,7 @@ void poppler_page_render_to_ps (PopplerPage *pa PopplerPSFile *ps_file); char *poppler_page_get_text (PopplerPage *page, PopplerSelectionStyle style, - PopplerRectangle *rect); + PopplerRectangle *selection); GList *poppler_page_get_selection_region (PopplerPage *page, gdouble scale, PopplerSelectionStyle style,