Org-inline-pdf enables inline PDF preview in Org buffers.
This program works only with Org 9.4 or later. You need to have pdf2svg installed in exec-path
. You can install it using a package management system like Homebrew or APT.
# On macOS
brew install pdf2svg
# On Debian Linux
sudo apt install pdf2svg
You can install org-inline-pdf from MELPA. For manual installation, download org-inline-pdf.el
into somewhere in your local directory and install it with M-x package-install-file
.
Enable this feature in an Org buffer with M-x org-inline-pdf-mode
. Add the following line to your init file to automatically enable the feature in newly opened Org buffers.
(add-hook 'org-mode-hook #'org-inline-pdf-mode)
You can place links to PDF files in the same way as ordinary inline images using double brackets like [[./figs/plot.pdf]]
in Org buffers. Linked PDF files will be displayed inline by org-display-inline-images
command.
For a multiple-page PDF, the first page is shown by default. You can specify the page to show using :page
attribute for the link. The following is an example of specifying the page along with the display size.
#+ATTR_ORG: :width 40% :page 3
[[./docs/report.pdf]]
org-inline-pdf.el
saves preview images in a temporary directory by default, which is removed on Emacs shutdown. To make images persist between Emacs sessions, you can change the variable org-inline-pdf-cache-directory
.
Previous versions of org-inline-pdf display all images in the buffer when the minor mode is turned on. Versions 0.6 and later do not automatically do this by default. To get the similar behavior as before, set org-startup-with-inline-images
to non-nil in your init file. You can also set `inlineimages` or `noinlineimages` in the `STARTUP` option of the file, which overrides the global setting.
This package also makes Org’s HTML exporter ox-html to embed linked PDF files as images using img
tag. Note that inline PDF using img
tag is not standard and will be rendered only in particular browsers. Safari.app is only the one I know.
Users of Scimax need to turn off a feature of scimax-org-images with scimax-toggle-image-advice
for org-inine-pdf to work. See #5.