[reportlab-users] DisplayDocTitle

Mark Erbaugh mark at microenh.com
Thu Sep 30 09:11:06 EDT 2010


According to "PDF Reference for Version 1.4", a flag, DisplayDocTitle, was added to the viewer preferences dictionary, starting with version 1.4. If this flag is set, when a document that has a Title is opened in Adobe Reader, the title bar will show the document Title rather than the file name.

The DisplayDocTitle seems to work with Adobe Reader 6.0 under Windows XP and Evince in Ubuntu 10.4. It doesn't seem to work with Apple's Preview on the Mac (OSX 10.6).

Reportlab 2.4 is not configured to accept DisplayDocTitle as a parameter to canvas.setViewerPreferences, but it appears easy to add:

In pdfbase.pdfdoc.py modify ViewerPreferencesPDFDictionary by adding the line indicated below.

class ViewerPreferencesPDFDictionary(CheckedPDFDictionary):
validate=dict(
HideToolbar=checkPDFBoolean,
HideMenubar=checkPDFBoolean,
HideWindowUI=checkPDFBoolean,
FitWindow=checkPDFBoolean,
CenterWindow=checkPDFBoolean,

DisplayDocTitle=checkPDFBoolean, # [mee] 9/29/10 - added

NonFullScreenPageMode=checkPDFNames(*'UseNone UseOutlines UseThumbs UseOC'.split()),
Direction=checkPDFNames(*'L2R R2L'.split()),
ViewArea=checkPDFNames(*'MediaBox CropBox BleedBox TrimBox ArtBox'.split()),
ViewClip=checkPDFNames(*'MediaBox CropBox BleedBox TrimBox ArtBox'.split()),
PrintArea=checkPDFNames(*'MediaBox CropBox BleedBox TrimBox ArtBox'.split()),
PrintClip=checkPDFNames(*'MediaBox CropBox BleedBox TrimBox ArtBox'.split()),
PrintScaling=checkPDFNames(*'None AppDefault'.split()),
)


Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://two.pairlist.net/pipermail/reportlab-users/attachments/20100930/279e8bac/attachment.html>


More information about the reportlab-users mailing list