unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: David Kastrup <dak@gnu.org>
To: Tassilo Horn <tassilo@member.fsf.org>
Cc: emacs-devel@gnu.org
Subject: Re: doc-view.el --- View PDF/PostScript/DVI files in Emacs
Date: Mon, 27 Aug 2007 12:23:48 +0200	[thread overview]
Message-ID: <86r6lptgwb.fsf@lola.quinscape.zz> (raw)
In-Reply-To: <87d4x98imj.fsf@baldur.tsdh.de> (Tassilo Horn's message of "Mon\, 27 Aug 2007 10\:52\:04 +0200")

Tassilo Horn <tassilo@member.fsf.org> writes:

> David Kastrup <dak@gnu.org> writes:
>
> Hi David,
>
>>>>> I changed doc-view.el so that it uses plain ghostscript (plus
>>>>> dvipdfm for DVI files) which gives good results and is about ten
>>>>> times faster than with ImageMagick's convert.
>>>>>
>>>>> The only downside is that I don't know how to cut off the margins.
>>>>> Those waste a lot of buffer space when displaying the image.
>>>>> converts -trim option was very nice for that cause.  Do you know
>>>>> how one can do that with ghostview?
>>>>
>>>> Well, that is one of the things done in preview-latex.  Do you have
>>>> the bounding box information for your images (preview-latex takes
>>>> them from TeX usually)?
>>>
>>> No, how should I get it?  I only have PDF/PS or DVI files with no
>>> sources at all.
>>
>> I am afraid I can't figure out what you are trying to achieve.
>
> Well, when doc-view.el used `convert' I supplied the -trim option to
> it.  This option cuts off the margins by calculating a mimimum
> bounding rectangle around the contents whose outside has background
> color and cuts the outside away.

Sure.  I just think that this is the wrong thing to do for page previews.

>> PDF/PS and DVI files are primarily page-oriented formats.  It does not
>> make sense to display every page with a different size.
>
> I don't agree here.  IMO it wastes too much screen estate to display
> the margins.  When those were cut off I could split my emacs frame
> horizontally and view a PDF doc in one window and have another
> 80-columns window for work.
>
> Now that's not possible anymore because the images contain those
> huge margins.  The only solution is to make the images smaller but
> that makes them hard to read.  And I cannot scroll-left to center
> the image.  Even `C-u 1 C-x <' scrolls too much.

That is an argument for giving better scrolling/margining behavior to
Emacs (you _do_ realize that Emacs can display partial images?).  So
you can add an option for selecting a page area you want to see,
possibly by dragging a rectangle across the image, and then get a
_consistent_ display of margins across your whole document.

>> PDF and PS files can actually change the page format in midstream
>> _if_ that is desired.  Autocropping will complicate the user's
>> handling of page material.  This is different if we are talking
>> about embedded material, graphics and stuff.  In that case, we will
>> be using PDF (which sets its own page size) or EPS.  EPS files
>> carry a bounding box comment: extracting that and using it for
>> setting the rendering bounding box for Ghostscript should do the
>> trick.
>>
>> preview-extract-bb in AUCTeX's preview.el can be used for that
>> purpose.
>
> Yes, but for other files like PDF or DVI that seems not possible.

DVI needs to get converted to PostScript, anyway, doesn't it?

> Currently I don't really see how preview.el could be useful for
> doc-view.  Ok, maybe I could display the first pages before the
> conversion of the rest has finished, but with ghostview conversion
> is so fast that I don't see any benefit that would justify to make
> the code more complex.
>
> For example doc-view on my practicalcommonlisp.pdf which has 528
> pages takes about one minute.  And even this has to be done only one
> time...

preview-latex renders the page you are looking at in a fraction of a
second, even when we are talking about documents with a thousand
pages.  Out of order rendering vastly increases the interactive
response.

> So please give some concrete examples how I could enhance
> doc-view.el with preview.el.

Shrug.  If you don't consider sub-second response times as opposed to
minute delays an enhancement, I am out of my depth guessing what would
qualify as one.

So I am afraid I can't offer anything useful to you.

-- 
David Kastrup

  reply	other threads:[~2007-08-27 10:23 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 11:03 doc-view.el --- View PDF/PostScript/DVI files in Emacs Tassilo Horn
2007-08-24 11:47 ` Michaël Cadilhac
2007-08-24 15:24   ` Tassilo Horn
2007-08-24 21:42     ` David Kastrup
2007-08-25 17:26       ` Tassilo Horn
2007-08-25 18:34         ` David Kastrup
2007-08-26 10:20           ` Tassilo Horn
2007-08-26 20:38             ` David Kastrup
2007-08-27  8:52               ` Tassilo Horn
2007-08-27 10:23                 ` David Kastrup [this message]
2007-08-27 14:37                   ` Tassilo Horn
2007-08-27 15:16                     ` David Kastrup
2007-08-27 20:14                       ` Tassilo Horn
2007-08-27 20:31                         ` David Kastrup
2007-08-27 20:17                     ` Stefan Monnier
2007-08-27 20:30                       ` David Kastrup
2007-08-25 20:52     ` Richard Stallman
2007-08-26 10:11       ` Tassilo Horn
2007-08-26 22:46         ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86r6lptgwb.fsf@lola.quinscape.zz \
    --to=dak@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=tassilo@member.fsf.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).