Excerpts from Pino Toscano's message of mar mar 29 10:04:05 +0200 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.
Ok. It might be very annoying, though.
> > > +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.
>
Thanks!
--
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
signature.asc
Description: PGP signature
_______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
