[poppler] 3 commits - CMakeLists.txt poppler/Catalog.cc poppler/Catalog.h poppler/Makefile.am poppler/ViewerPreferences.cc poppler/ViewerPreferences.h
Pino Toscano
pino at kde.org
Tue Mar 29 01:04:05 PDT 2011
Alle martedì 29 marzo 2011, Carlos Garcia Campos ha scritto:
> Excerpts from pino's message of lun mar 28 23:21:07 +0200 2011:
> > CMakeLists.txt | 2
> > poppler/Catalog.cc | 23 ++++++++++
> > poppler/Catalog.h | 4 +
> > poppler/Makefile.am | 2
> > poppler/ViewerPreferences.cc | 97
> > +++++++++++++++++++++++++++++++++++++++++++
> > poppler/ViewerPreferences.h | 62 +++++++++++++++++++++++++++ 6
> > files changed, 190 insertions(+)
>
> I think there should be a way to know whether the key is present in
> the ViewerPreferences preferences dictionary, so that viewers could
> follow the prefs only when they are present, and use their own,
> instead of the default values, when not present.
> [...]
> I think we could do someting similar to what we do for annots in
> Page. In Catalog constructor get the ViewerPreferences object and
> check it's valid (it's a dict object at
> least). This way Catalog::getViewerPreferences() already has the
> viewer prefs dict to create ViewerPreferences object. I think we
> shouldn't accept a NULL dict in ViewerPreferences() and return NULL
> in Catalog::getViewerPreferences() when there are no preferences at
> all, so that viewers know the document doesn't contain any prefs.
PDF specs say that "If no such dictionary is specified, conforming
readers should behave in accordance with their own current user
preference settings.".
IMHO that should be read as "if there is no dictionary, follow the user
preferences; if there is, read the keys from there, defaulting to the
values specified here", which is what I just did now.
> > +ViewerPreferences *Catalog::getViewerPreferences()
> > +{
> > + if (!viewerPreferences) {
> > + Object catDict;
> > + Dict *d = NULL;
> > +
> > + xref->getCatalog(&catDict);
> > + if (catDict.isDict()) {
> > + d = catDict.getDict();
> > + } else {
> > + error(-1, "Catalog object is wrong type (%s)",
> > catDict.getTypeName()); + }
> > + viewerPreferences = new ViewerPreferences(d);
>
> It seems you are passing the catalog dict, instead of the
> ViewerPreferences dict.
Fixed.
--
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/20110329/9b031eea/attachment-0001.pgp>
More information about the poppler
mailing list