18

I heard that we can view pdf files in emacs. Is it done by converting pdf files to plain texts first?

Can we view pdf files at its fullness in emacs?

can we edit pdf files in emacs?

Thanks.

16

Since Emacs 23, you can view PDF files as images just by opening them like normal files as long as you have Emacs running in X rather than a terminal. You can also see and edit the PDF directly, which will display the contents of the binary file as text (with lots of unprintable characters!). You can edit this text directly, but unless you can encode and decode PDFs in your head, it won't be very useful.

You can switch between the two views with C-c C-c.

enter image description here

The same file both as an image preview and as text. I should learn to label my axes ;).

Text mode isn't very useful for PDFs, but it also works on some human-readable formats like .ps and .svg, which is useful for editing those files in place.

  • (1) Can Emacs show the bookmarks of a pdf file, as in evince? I don't find it can. (2) Do you have two buffers for the two windows? I can always show either the code or the pdf in both windows. – Tim Sep 23 '14 at 22:24
  • @Tim: I don't know about bookmarks. I have the same file in both buffers, but that seems hard to reproduce; it just came up when I split the screen (ie C-x 3). If I use C-c C-c, the two windows become the same and I can't go back to seeing both at the same time. – Tikhon Jelvis Sep 23 '14 at 22:25
  • we can edit pdf files only by editing their code directly? Can we edit pdf files in WYSIWYG way in emacs? – Tim Sep 23 '14 at 22:26
  • @Tim: Not as far as I know. Given how terrible the PDF format is, don't expect it any time soon. But it's very useful if you're generating a PDF from LaTeX or something, as well as for working with the other formats I mentioned. – Tikhon Jelvis Sep 23 '14 at 22:44
  • 1
    This only works since emacs 23. – rlazo Sep 24 '14 at 11:51
16

You can give a try to pdf-tools, which provides most of the requested functionality

  • 3
    Wow, pdf-tools is awesome! – Qudit May 7 '15 at 1:17
  • 1
    But how do you use it to edit raw pdf files? – xuhdev Sep 6 '17 at 17:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.