Export PDF with Bookmarks

Joplin 2.6.2 (prod, win32)
Client ID: f80e603383f74e2fa4609ed532da85aa
Sync Version: 3
Profile Version: 41
Keychain Supported: Yes
Revision: 5a82f5d


Does anybody know if there is a way to export to PDF where the headings in the Markdown turn into PDF bookmarks?

Currently, I edit externally to Typora and then export to PDF from there and that creates nice bookmarks in the PDF from the headings, but I can't use Typora anymore.

Would be great if this was an option in Joplin for PDF exports.

This is what I mean by Bookmarks.

image

1 Like

Maybe you could try pandoc?

Here's a tutorial for Ubuntu:

https://learnbyexample.github.io/customizing-pandoc/

There's also a simpler tutorial on Windows, but it doesn't mention about headers:

Maybe you can combine the two to get what you're after?

I wonder also if you can just import markdown into Word or LibreOffice Writer and then export to PDF from there?

The problem with external options is that plugin-rendered content may not be handled correctly. I am using Joplin to keep class notes and find it useful to export them as PDF. Having the headings become bookmarks in the PDF makes it easier to navigate larger notes.
It also makes the notes more professional should I decide to sell them.

1 Like

We are using Electron's printToPDF method and unfortunately there's no option for this.

I would have thought that this would be done automatically, but as you have noticed, it is not.

I find this really annoying myself, but I am not quite sure how we could solve that. Maybe we have to use a separate node module.

1 Like

I opened a bug on github for the electron project. https://github.com/electron/electron/issues/32288#issuecomment-1008896712

They want a "test case". I am going to try to make one although I am flying blind. I don't know how a test case of missing functionality is going to help them, but ok.

EDIT: Never mind I figured it out. The fiddle is finished and posted to the github issue. I hope electron will consider adding this functionality.

1 Like

The [toc] function already makes a table of contents that links to the headers which are displayed perfectly including subheads and subsubheads. This is actually better than bookmarks. This exports perfectly to pdf.

I too would like the Addition of bookmarks, but not using headings/subheads etc. So it would have to be something else.

I suppose a switch could work, but again, the toc at the top is really very nice and works for Joplin and pdf and I suspect though I haven't tried it HTML.

Yeah, the TOC is indeed very nice, but imho not always what you need/want being at the beginning (top) of the document. In my use case, I like having it on the side and setting PDF "Initial View" options to "Bookmarks Panel and Page". This makes for a nice viewing experience when I share the document with others - makes for jumping around the document very easy and getting an overview very quick.

I agree with you that bookmarks view is better. I'd even go for both. However, it doesn't work well for others. Setting it as the initial view has problems I am afraid of if sharing with others.

  1. Some of their viewers probably simply are too dumb to honor it. (the program not the user)
  2. If they have internal settings like "restore last used view", which was the default in my pdf viewer, it will override your initial settings.
  3. I doubt I know about all the potential problems. There must be more.

So, you just can't count on it working for other people. And, it doesn't work inside Joplin. I just don't export to pdf very often for myself and don't have faith in initial view for others.

Imagine someone complaining that there is no table of contents. You say there is. Now, given their pdf viewer, chrome, vivaldi?, Firefox, edge, acrobat, foxit, pdfxchange, etc. you need to explain where their restore last view preference is set so they can see the bookmarks.

Also, they might not even know about bookmarks or how to get a bookmarks pane.

Perhaps the people you deal with are better educated in PDF than those I deal with.

They replied that it can only be done by Chrome and not electron.

Just as a side note: A while ago I wrote a script to create a PDF of multiple notes/notebooks: joppy/pdf_export.py at master · marph91/joppy · GitHub. Bookmarks aren't created by default, but it might be possible to add them in weasyprint (doc) if you are interested in python scripting.