I want to view
How can I view a
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.Sign up to join this community
When I want to "view a pdf file in terminal", that for me means that I want to actually see an uncompressed PDF, I do:
pdftk in.pdf output out.pdf uncompress
I always wondered why both
less in.pdf and
less out.pdf give me just text strings in the PDF (and excluding the text-only PDF commands I'd expect in
Well, that happens because of the lesspipe assuming I want
pdftotext being run first - and since here I don't, I have to specifically disable the lesspipe by setting
LESSOPEN environment variable to nothing; that is:
$ LESSOPEN="" less out.pdf
And finally, I can view the uncompressed PDF code using
Yet another solution... May I recommend to you the ancient utility
MC(1) GNU Midnight Commander mc - Visual shell for Unix-like systems.
mc is designed around text-based file-management, and it has a “view”
option (F3 key) which will automatically convert .pdfs to text for viewing
without a GUI. The code which does this conversion is part of
mc itself, so it does not require conversion by other utilities. (Also has a native .html viewer for WIW.)
If you run
emacs on your machine (
emacs comes preinstalled on Ubuntu 18.04), you can virtually open and see a pdf on a remote server by hitting
Ctrl-x Ctrl-f (to
find-file) and then type in
/user@hostname:/path/to/my.pdf and hit Enter (note the very first
/). You will then be prompted to enter the server's password and there it is! You can see the pdf inside emacs.
Navigate through PDF inside
space to go one page down and
backspace to go one page up. You can also use arrow keys to scroll through a single page if it doesn't fit in the screen.
Zoom in by hitting
Ctrl-x Ctrl-+. Zoom in more by hitting
+ only. Or zoom out more by hitting
Yes, you can connect to a remote server from within
emacs using the build-in package
tramp that works as simple as I explained above. This method works, not only for pdf, but for any other type of file, such as images.
This might be helpful, please note that:
qlmanage -p <file_name>
Maybe similar command in Linux called (gnome-sushi) I haven't tested this, but might be helpful as well. I will update this post after testing it.