unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Re: Viewing PDFs as text?
       [not found]       ` <m34pbd4d8q.fsf@tfkp07.physik.uni-erlangen.de>
@ 2008-03-11 17:57         ` Bastien
  2008-03-11 20:51           ` Stefan Monnier
  2008-03-12  8:32           ` Tassilo Horn
  0 siblings, 2 replies; 6+ messages in thread
From: Bastien @ 2008-03-11 17:57 UTC (permalink / raw)
  To: emacs developers; +Cc: Roland Winkler

When trying to view a PDF with in a tty, `doc-view-initiate-display'
throws an error about missing support for image, png or other utilities.

Maybe it would be better to display the output of pdftotext directly in
a tty.  In X Window, the default behavior would be to display the image
when images are supported, and to fall back on pdftotext when not.

What do you think?

PS: See the request below by Roland.

Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

> Tassilo Horn <tassilo@member.fsf.org> writes:
>> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
>>
>>> It would be nice if doc-view used a plain text format if emacs is
>>> running in a tty. Or am I missing something?
>>
>> No, I'll have a look if that's easy to do.  Til then you can use
>>
>>   ! pdftotext ? - RET
>>
>> from within dired.
>
> Of course, not all pdf files are such that pdftotext can give
> meaningful results. Figures and, say, formulas in a file generated
> with pdflatex will be screwed up. However, fairly often I need to
> use a tty. Anything that helps me along that way is greatly
> appreciated. For me, one of the big advantages of emacs is that it
> allows me to get the most out of a plain old tty.

-- 
Bastien




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Viewing PDFs as text?
  2008-03-11 17:57         ` Viewing PDFs as text? Bastien
@ 2008-03-11 20:51           ` Stefan Monnier
  2008-03-12  8:32           ` Tassilo Horn
  1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier @ 2008-03-11 20:51 UTC (permalink / raw)
  To: Bastien; +Cc: Roland Winkler, emacs developers

> When trying to view a PDF with in a tty, `doc-view-initiate-display'
> throws an error about missing support for image, png or other utilities.

> Maybe it would be better to display the output of pdftotext directly in
> a tty.  In X Window, the default behavior would be to display the image
> when images are supported, and to fall back on pdftotext when not.

> What do you think?

Sounds like a good idea, but the implementation doesn't seem
as obvious.  So... patches welcome,


        Stefan


> PS: See the request below by Roland.

> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:

>> Tassilo Horn <tassilo@member.fsf.org> writes:
>>> Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> writes:
>>> 
>>>> It would be nice if doc-view used a plain text format if emacs is
>>>> running in a tty. Or am I missing something?
>>> 
>>> No, I'll have a look if that's easy to do.  Til then you can use
>>> 
>>> ! pdftotext ? - RET
>>> 
>>> from within dired.
>> 
>> Of course, not all pdf files are such that pdftotext can give
>> meaningful results. Figures and, say, formulas in a file generated
>> with pdflatex will be screwed up. However, fairly often I need to
>> use a tty. Anything that helps me along that way is greatly
>> appreciated. For me, one of the big advantages of emacs is that it
>> allows me to get the most out of a plain old tty.

> -- 
> Bastien





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Viewing PDFs as text?
  2008-03-11 17:57         ` Viewing PDFs as text? Bastien
  2008-03-11 20:51           ` Stefan Monnier
@ 2008-03-12  8:32           ` Tassilo Horn
  2008-03-12  9:54             ` Phil Jackson
  2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 2 replies; 6+ messages in thread
From: Tassilo Horn @ 2008-03-12  8:32 UTC (permalink / raw)
  To: emacs-devel

Bastien <bzg@altern.org> writes:

Hi Bastien,

> When trying to view a PDF with in a tty, `doc-view-initiate-display'
> throws an error about missing support for image, png or other
> utilities.
>
> Maybe it would be better to display the output of pdftotext directly
> in a tty.  In X Window, the default behavior would be to display the
> image when images are supported, and to fall back on pdftotext when
> not.

That would be the ideal behavior.  But looking at the code it seems
quite hard to do, especially if you want to keep most/all of doc-view's
features.

What could be done was to open a separate buffer (in fundamental-mode)
that displays the output of pdftotext.  I'll give that a try.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Viewing PDFs as text?
  2008-03-12  8:32           ` Tassilo Horn
@ 2008-03-12  9:54             ` Phil Jackson
  2008-03-12 12:12               ` Tassilo Horn
  2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 1 reply; 6+ messages in thread
From: Phil Jackson @ 2008-03-12  9:54 UTC (permalink / raw)
  To: emacs-devel

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

>> When trying to view a PDF with in a tty, `doc-view-initiate-display'
>> throws an error about missing support for image, png or other
>> utilities.
>>
>> Maybe it would be better to display the output of pdftotext directly
>> in a tty.  In X Window, the default behavior would be to display the
>> image when images are supported, and to fall back on pdftotext when
>> not.
>
> That would be the ideal behavior.  But looking at the code it seems
> quite hard to do, especially if you want to keep most/all of doc-view's
> features.
>
> What could be done was to open a separate buffer (in fundamental-mode)
> that displays the output of pdftotext.  I'll give that a try.

How about a generic 2txt mode that could use any of the 2txt (odt, ods,
xls, doc, pdf, ps, ...) tools and do the right thing? Something like:

("\\.\\(pdf\\|xls\\|..." . 2txt-mode) in the auto-mode-alist and then
the mode uses the correct tool depending on the extension.

Cheers,
Phil
-- 
 Phil Jackson




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Viewing PDFs as text?
  2008-03-12  8:32           ` Tassilo Horn
  2008-03-12  9:54             ` Phil Jackson
@ 2008-03-12 12:11             ` Tassilo Horn
  1 sibling, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2008-03-12 12:11 UTC (permalink / raw)
  To: emacs-devel

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

>> When trying to view a PDF with in a tty, `doc-view-initiate-display'
>> throws an error about missing support for image, png or other
>> utilities.
>>
>> Maybe it would be better to display the output of pdftotext directly
>> in a tty.  In X Window, the default behavior would be to display the
>> image when images are supported, and to fall back on pdftotext when
>> not.
>
> That would be the ideal behavior.  But looking at the code it seems
> quite hard to do, especially if you want to keep most/all of
> doc-view's features.
>
> What could be done was to open a separate buffer (in fundamental-mode)
> that displays the output of pdftotext.  I'll give that a try.

That's now in CVS.  With C-c C-t you can open a new buffer that shows
the text of the current document.  When d-v-m doesn't work this binding
will be mentioned.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Viewing PDFs as text?
  2008-03-12  9:54             ` Phil Jackson
@ 2008-03-12 12:12               ` Tassilo Horn
  0 siblings, 0 replies; 6+ messages in thread
From: Tassilo Horn @ 2008-03-12 12:12 UTC (permalink / raw)
  To: emacs-devel

Phil Jackson <phil@shellarchive.co.uk> writes:

Hi Phil,

> How about a generic 2txt mode that could use any of the 2txt (odt,
> ods, xls, doc, pdf, ps, ...) tools and do the right thing?

Sounds like a good idea.  Patches welcome.

Bye,
Tassilo




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-03-12 12:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <7599507d-11a4-4e93-974f-5d7aa924b152@e6g2000prf.googlegroups.com>
     [not found] ` <mailman.8684.1205189951.18990.help-gnu-emacs@gnu.org>
     [not found]   ` <m34pbeapui.fsf@tfkp07.physik.uni-erlangen.de>
     [not found]     ` <mailman.8699.1205221811.18990.help-gnu-emacs@gnu.org>
     [not found]       ` <m34pbd4d8q.fsf@tfkp07.physik.uni-erlangen.de>
2008-03-11 17:57         ` Viewing PDFs as text? Bastien
2008-03-11 20:51           ` Stefan Monnier
2008-03-12  8:32           ` Tassilo Horn
2008-03-12  9:54             ` Phil Jackson
2008-03-12 12:12               ` Tassilo Horn
2008-03-12 12:11             ` Tassilo Horn

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).