25

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.

2 Answers 2

24

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

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

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.

9
  • 1
    (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
    Commented Sep 23, 2014 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. Commented Sep 23, 2014 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
    Commented Sep 23, 2014 at 22:26
  • 1
    This only works since emacs 23.
    – rlazo
    Commented Sep 24, 2014 at 11:51
  • 1
    I don't think this works out of the box. What mode provides C-c C-c ?
    – Jim Balter
    Commented Oct 3 at 4:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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