Skip to content

Latest commit

 

History

History
49 lines (30 loc) · 2.32 KB

README.org

File metadata and controls

49 lines (30 loc) · 2.32 KB

https://melpa.org/packages/org-inline-pdf-badge.svg https://stable.melpa.org/packages/org-inline-pdf-badge.svg

org-inline-pdf

Org-inline-pdf enables inline PDF preview in Org buffers.

Installation

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)

Usage

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.

Inline PDF in exported HTML file

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.

Known issues

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.