[reportlab-users] Bookmarking & Zoom (+BugFix)

Andy Robinson reportlab-users@reportlab.com
Thu, 6 Feb 2003 21:50:31 -0000


Congratulations!  The number of people in the world able
to expose new PDF features just grew by 20-25% (?) which
is good news for us - and I hope encourages others!

> Adding some support to canvas.bookmarkPage and 
> canvas.bookmarkHorizontalAbsolute to allow zoom,x position or the 
> type of Fit setting (perhaps by passing in an optional 
> PDFDestinationFit object?) should just be a matter of typing.
> 
> Andy, would you consider adding this support?

I just checked in the pdfdoc fix.

I'd rather try to tackle it with a small number of simple 
arguments than passing in extra objects, as we are thinking
a lot about exposing the canvas to Java, COM et al
and I want to avoid multiplying the number of
objects to be passed around.  Here's a candidate new API:


    def bookmarkPage(self, key,
                     fitType="XYZ",
                     left=None,
                     top=None,
                     bottom=None,
                     right=None,
                     zoom=None
                     ):
        """
        This creates a bookmark to the current page which can
        be referred to with the given key elsewhere.

        PDF offers very fine grained control over how Acrobat
        reader is zoomed when people link to this. The default
        is to keep the user's current zoom settings. the last
        arguments may or may not be needed depending on the
        choice of 'fitType'.
        
        Fit types and the other arguments they use are:
        /XYZ left top zoom - fine grained control.  Null
          or zero for any of the parameters means 'leave
          as is', so "0,0,0" will keep the reader's settings.
          
        /Fit - entire page fits in window

        /FitH top - top coord at top of window, width scaled
                    to fit.

        /FitV left - left coord at left of window, height
                     scaled to fit
                     
        /FitR left bottom right top - scale window to fit
                                  the specified rectangle

        (question: do we support /FitB, FitBH and /FitBV
        which are hangovers from version 1.1 / Acrobat 3.0?)"""

Does that work for you?

Have you got any more stamina to help make a test script if
I add it in? <grin>

Thanks very much,

Andy