Subject: bug#8364: 24.0.9999; PATCH: Fit to width/height/page for doc-view.el

From: Tassilo Horn <[email-masked]>
Date: Mon, 28 Mar 2011 17:28:33 +0200

sho nakatani <[email-masked]> writes:

Hi!

>> Good, thanks.  I'll still have to do it by hand, sadly, since I like
>> to "fit the text" rather than "fit the page", i.e. I like to keep the
>> margins outside of the viewable area.  A command to do that
>> automatically would be really nifty.
>
> Sad to say, I have no idea to realize such function, although I completely
> agree with you.
> Currently, the scale factor for enlarge/shrink is determined by the ratio of
> the size of PNG image to the size of window. It is pretty difficult to specify
> where 'margins' are from PNG image.

Users can cut the margins using the slice feature (`s m').  The
information about the current slice (X Y WIDTH HEIGHT) can be accessed
using the `doc-view-current-slice' macro.  So it seems doable to
calculate the right zoom factor and adjust the slice accordingly after
zooming if a slice was set.  How that can be done is left as an exercise
to the reader. ;-)

Nakatani, feel free to implement that, and send updated patches to this
"bug" report.

> It might be possible if the scale factor is determined not from PNG
> image but from PDF/PS.  However, it is far difficult than current
> implementation.

I'd advice not to add special-case code for certain kinds of documents.

Bye,
Tassilo