Embed documents into nodes

Does org-roam have an equivalent to Obsidian’s “embed” function? Like with PDFs or PNGs. Because I found this useful and used it a lot. If not, is it possible to link to external files, and when the link is clicked on it opens in the correct external program?

When I tried finding information on this, all was about exporting org files to PDF, but I want to display a PDF (or at least link to it) in my org file.

If none of those is possible, what sort of thing do people use instead?

What does it do exactly? Can you describe more?

I will assume it lets you do the following:

  • Drag-and-drop of a file.
  • By doing so, you can move the file into a specific folder within Obsidian’s vault.
  • It will also create a link to the file in the current markdown file at the point where the file is dropped.
  • When you click on the link, Obsidian opens the PDF or image files into another tab/window like a browser (Obsidian itself is a customized browser, if I understand it correctly).
  • For images, Obsidian can show them in the display where you edit the current markdown file.

Drag-and-drop

If you have Emacs 29 (latest stable release; 30 is on its way), you can drag-and-drop a file onto an Org buffer. See this example with a PDF file.

For drag-and-drop, see this page of the documentation.

Opening links

Org buffers can open a link to image files and PDF. See this page of documentation.

Especially this: docview ‘docview:papers/last.pdf::NNN’

Org does not open the content of PDF files directly inside the current Org buffer, but opens a new window to use docview by default.

Opening in an external application

You can configure Org and Emacs to open files in an external application.
For PDF and image files, the default should be set to open within Emacs.

See this page, especially ‘C-c C-o’ (‘org-open-at-point’). If you follow to the documentation of variable ‘org-file-apps’, you will see an example to open a PDF file in Evince.

Showing an image file within an Org buffer

Try command org-toggle-inline-images. Here is the manual page.

In-system documentation of Emacs and Org

All these pages of documentation are also accessible within Emacs (C-h i). In the first page of Info, pressing h opens a tutorial on how to read Info manuals. I suggest you have a quick read.

Where did you look, and did you look for only about Org-roam?

If you haven’t done so, I suggest you search more widely for Org mode in general, and Emacs. To respond to you in this exchange, I have got many more cool configuration options for opening PDF from Org, etc. (many from Reddit).

Just as additional information, you can find a list of tutorials on the web page of Org: https://orgmode.org/worg/org-tutorials/index.html. I would not want to overwhelm you with loads of information, and I have to say I have never learned Org from watching tutorial videos, etc. (YouTube was not a thing back when I was learning Org). But just so that you are aware that there are a plenty of resources.

Thank you, this is very helpful! I think I needed resources to lead me in the right direction. I will try out all of those.

1 Like

Yes, Obsidian does all that. It also allows you to navigate a PDF directly from within a note tab, without having to open it in a new tab, which it does by creating a PDF frame, and displaying arrows allowing you to switch page, you can scroll through it, change zoom, etc. This would be nice to have in org, but not a deal-breaker for me.

I tried using shg’s org-inline-pdf, but this seems to be superceded by org-toggle-inline-images. But anyway, if I can’t navigate the PDF within the org buffer, I’d just open it in DocView or an external application anyway.

I tried dragging-and-dropping, but that just opens the PDF in a new DocView buffer, rather than giving me the option to choose what to do with it. It also doesn’t insert a link to the PDF in my org file.

I am on Emacs 30.

You may need to be on Org version 9.7 or later. I don’t think I configured anything (I don’t use Org this way so I just tried and worked like this, if I remember correctly).

Or your other configuration may be interfering. You might like to with emacs -Q (no config loaded).

Documentation for org dnd has this:

Org mode supports drag and drop (DnD) of files. By default, Org asks the user what must be done with the dropped file: attach it, insert ‘file:’ link, or open the file. Customize org-yank-dnd-method to set the default DnD action.

Perhaps check the user option?

Yes, the issue was that my Org was out-of-date. Now it is working, although behaviour when I run org-toggle-inline-images makes it unusable: scrolling with mouse/touchpad is incredibly buggy, there’s no way of switching between pages in a PDF (as far as I can tell, it only displays the first), and the backgrounds are all the same colour as my Emacs background which makes them hard to read (I’d prefer white). I have a feeling this may be due to it being a new feature in Org, so perhaps it will get better.

I would not display a PDF file inline within an Org buffer (I didn’t know you could do it). I’d simply leave it as a link. You can get your Emacs to open it in your favorite viewer outside Emacs, or use another Emacs package called PDF-Tool.

Check out org-noter for reading PDFs and note taking in emacs.

@orgroamer this may be overkill by take a look at emacs-citar which is a bibliography management tool. Might be overkill for your purposes.

For completeness there’s also org-attach (built-in) that I haven’t used much.

I’ve seen that, I’ll try it out.