[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Viewing PDF/PS files

From: James Cloos
Subject: Re: Viewing PDF/PS files
Date: Thu, 17 May 2007 05:38:21 -0400
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.0 (gnu/linux)

>>>>> "mowgli" == mowgli  <address@hidden> writes:

mowgli> Is it possible to view PDF or PS files in the emacs on console?
mowgli> If yes, how?

That depends on which console, which version of emacs and compile time
options at the very least.

If you on at the linux console, and it is a frame buffer rather than a
vga text console, it may be possible.  I can't speak for other kernels'
consoles.  And I haven't tried it even on a frame buffer console, so
this is unconfirmed advice.

And none of this is written, as far as I know.  You'll have to write
some code to make it work.

What you would need to do is to arrange for emacs to pass the postscript
in question to ghostscript with appropriate options to render the ps to
graphic files at some reasonable dpi, and then open those image files in
an emacs buffer in image mode to display them.

The dpi should be approximently framebuffer_width_in_pixels divided by
paper_width_in_inches.  So, if you have a 1600x1200 pixel display and
the postscript document is intended for US-Letter sized paper, that is
1600/8.5 or about 188 dpi.

That is, if you want the rendered images to be maximum width.  The math
for fitting the whole page on a single screen should be obvious.  If the
PS's papersize is not Letter (such as an EPS image) you'd need to parse
the PS to find the size and use that to determine the dpi value to pass
to GhostScript to get an image at the correct scale.

I'd probably use gs's png256 output device, if your emacs is compiled
with libpng support.

Incidently, there may be a PS viewer out there (probably written on top
of directfb or svgalib) which you could use instead of writing one in
elisp.  If you don't want to exit emacs to call such a viewer, run
M-x shell to start a shell session w/in emacs and call the viewer from
that shell prompt.

James Cloos <address@hidden>         OpenPGP: 1024D/ED7DAEA6

reply via email to

[Prev in Thread] Current Thread [Next in Thread]