PDF export: Make links within same document functional

For workarounds there’s:

  • Enhancing Export plugin. For me it doesn’t work well actually :confused:
  • Incomplete: I wrote this script to convert Obsidian to Latex. It still needs a few improvements, but for simple cases it works. And yeah, it does maintain the internal links :blush:
3 Likes

+1 for a this feature request, I have a plethora of reasons to export .md docs to pdf and it’s a bit disappointing that none of my tables of content function when I do so. Any one have a work-around for now?

thx, for any help, or the feature implementation, if it’s possible…

Great big +1 from me! I’ve just wasted a day trying to write a Python script to fix internal links in Obsidian exported PDF files. PDF is such a cursed format :imp:

1 Like

It’s a strange problem. Footnotes in the exported PDF work - along with the link by a footnote to take you back to the main text where the footnote marker is - but # links made by hand don’t. I wonder what’s happening during the export process that means footnote links work, but # links don’t?

+1. Agreed to have internal links “active” in pdf export. That would really be a great improvement to the “export to pdf” function.

It looks like this might be implemented in v1.3.6 according to @WhiteNoise

No, that is different feature request about the PDF reader in obsidian.

1 Like

Oh fiddlesticks! You are correct. Bummer.

I’d assume that it is fairly popular.

I have shown Obsidian to my PhD friends, in order to be used for more than note-taking (like writing reports and guide-files).

One of the first things that people ask me is “does it export those notes in .pdf properly?”

For me, properly requires internal links and outline on pdf.

3 Likes

For workarounds there’s:

  • Enhancing Export plugin. For me it doesn’t work well actually :confused:
  • Close to complete: I wrote this script to convert Obsidian to Latex. It still needs a few improvements, but for simple cases it works. And yeah, it does maintain the internal links, as well as the outline :blush:
1 Like

would love to see this implemented in Obsidian, very useful feature, I’m surprised it’s been years since this was requested and not yet implemented. I totally understand the complexities of a roadmap and the prioritization of other requests by the developers.

1 Like

I would love to see this as well but I fear it’s is not easy to implement, since obsidian seems to use the print function of the chromium browser it is built on and redirects the output into a pdf.

Currently pandoc with crossref seems the only option to generate a pdf with working links. Unfortunately pandoc doesn’t support obsidian wikilinks. But there is a plugin (I think it is called link converter) to convert obsidian links into standard markdown links that can be handled by pandoc.

There are two plugins as far as I know that integrate pandoc into obsidian. One of these is obsidian-enhancing-export. But its not easy to setup a working pandoc environment. In particular you need also e latex environment since pandoc cannot translate markdown directly to pdf but first convert it to latex which is then converted to pdf using pdflatex or xelatex.

For those who dare there is a tutorial how to setup obsidian for academic writing which also covers pandoc and additional plugins
https://betterhumans.pub/obsidian-tutorial-for-academic-writing-87b038060522

+1. Fiddling with pdf export as well (wanting to export a whole folder of notes as a single ebook in epub / pdf / html).

2 Likes

I’ve been thinking about this, and I think I’ve worked out a possible solution, based on the fact that external (http://) links work.

  1. Just before a PDF is exported, rewrite all in-document links to dummy external links, e.g a link to [[#Some heading]] gets rewritten to [Some heading](http://dummy.url/#Some%20heading)
  2. Export PDF using Obsidian’s built-in PDF export
  3. Use PDF-LIB to rewrite the dummy links in the exported PDF back to in-document links

I think it’d be possible to write an Obsidian plugin to do this, either by hooking up a notification to when PDFs get exported, or triggering PDF export from the plugin itself.

Based on my limited understanding of the PDF format, it might be quite hard to do 3), since I believe PDF internal links are based on actual locations in the document (e.g ‘a rectangle halfway down the page on page 23’) rather than named headers (eg ‘#Some heading’). Should be doable though, even if it’s just by searching through the document looking for the location of ‘Some heading’ in the correct style or something.

Anyway. My time for actual coding is very limited right now (I’m trying to finish a big writing project), but I might have a crack at it when that project is done.

3 Likes

if the thread is about there being an interactive pdf someday in the making – that would be awesome!!!

Woohoo, got a proof of concept plugin working! It’s nowhere near ready to release yet, but all the parts that implement the solution I proposed are in place, and it kinda works mostly! :tada:

Posting here in case anyone else who can code Obsidian plugins would like to pick it up and refine it a bit further. I’m not going to have any time to work on it for a couple of weeks.

For clarity: this is not a plugin ready for everyday use. It’s code for developers only which proves that it’s possible :smiley:

8 Likes

The Footnote when exported to pdf work amazingly just like what we need, sadly i cant choose the location for the foot note otherwise this would be solved

I would be very happy to even see the more simple solution that none of the internal links show up in the pdf as links. I share a lot of material from Obsidian and always copy paste it into another word processor before exporting a pdf from there. That way I don’t get the clunky links, that don’t work anyway. Sometimes I also just want to print it out and don’t want a lot of underlines in the page.

1 Like

mlte,

I agree. I wish Obsidian had to option to generate the following (from Wikipedia):

" PDF/A is an ISO-standardized version of the Portable Document Format (PDF) specialized for use in the archiving and long-term preservation of electronic documents. PDF/A differs from PDF by prohibiting features unsuitable for long-term archiving, such as font linking (as opposed to font embedding) and encryption.[1] The ISO requirements for PDF/A file viewers include color management guidelines, support for embedded fonts, and a user interface for reading embedded annotations."

It would be nice to be able to switch between PDF (currently generated by Obsidian) or a PDF/A.

3 Likes

I think this feature should be available by default. Currently, it is not possible to seamlessly share your notes to none obsidian users. This issue being one of the main reasons why.
It is also disappointing to see, in my opinion, simple and necessary features not being implemented years after they are first discussed.

1 Like