Relative links in a PDF
I would like an option when I print a PDF to specify that the relative links in my document should be resolved to absolute links relative to something on the web.
The reason for this is that I usually write developer documentation in markdown for publishing on github. However, if I'm sending a PDF instead the "see also" links should resolve relative to the hosted location, rather than the location on the hard drive of the user I'm emailing the PDF to.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 23 Apr, 2014 04:27 PM
I don't think this is really possible with the way that webkit generates
PDFs. I would have to rewrite all of the links in the document prior to
exporting the PDF, anyway...
2 Posted by Steven Fisher on 23 Apr, 2014 04:33 PM
True.
There's also the base tag. Inserting that into the head of the document would set the links. You'd have to use an absolute URL for the CSS and anything else in the document, though.
Support Staff 3 Posted by Brett on 23 Apr, 2014 04:46 PM
Not for PDF output, I don't think. I already set a base tag via JS when
the document loads.
4 Posted by Steven Fisher on 23 Apr, 2014 04:47 PM
Yeah, I assume you'd have to actually mutate the HTML for it to take for the PDF export. Javascript's probably never going to run on the PDF path.
Anyway, have a great day. :)
Support Staff 5 Posted by Brett on 23 Apr, 2014 04:49 PM
The PDF prints from the current contents of the web view, so JS run
prior to the print action does stick. The base url just doesn't seem to
affect PDF output.
6 Posted by Paul Solt on 27 Sep, 2017 02:07 PM
Is this still a known issue of PDF exporting to create cross-reference links in multi-markdown?
Any way to get this working with the PDF export, without losing my custom header/footer?
Create Links to Generic Headers Using a Cross-Reference
Create Links to Headers
Support Staff 7 Posted by Brett on 27 Sep, 2017 04:10 PM
Hi Paul,
I'm afraid it's still an issue, yes. There's no workaround within Marked, but it can be set up with Pandoc or wkhtml2pdf. Pandoc for sure can handle headers and footers, I'm not sure about wkhtml2pdf. Neither are super convenient, though, apologies.
I'm still hoping Apple will just hand me a solution in an Xcode update, but it hasn't happened yet. I'm currently working on the RTF export, but once that's fully production-ready, I'll be focusing on building my own PDF output rather than using the PDF print system in WebKit.