# Relative links in a PDF

#### Steven Fisher

23 Apr, 2014 04:23 PM

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.

1. Support Staff 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.

3. Support Staff 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

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. :)

5. Support Staff 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?

    ### Overview [MultiMarkdownOverview] ##

[MultiMarkdownOverview]


    ## Section 1 [sect1] ##

... text content

[Jump to Section 1][sect1]

7. Support Staff 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.

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 21 May, 2018 07:33 PM Suggestion: rubberbanding for scrolling 21 May, 2018 04:40 PM Huge PDF sizes after 2.5.14 (947) update 18 May, 2018 03:09 PM Mathjax fails mid-document. 18 May, 2018 02:27 AM Custom Processor not running 2.5.13 and 2.5.14 18 May, 2018 02:08 AM GitHub style doesn't show blank lines when blank lines between bullet items

## Recent Articles

 Highlight sentences longer than a certain number of words In-app purchase issues (Error Domain=Paddle Code=0 "(null)") License code has already been utilized How do I retrieve a lost license (direct version) Custom CSS: Writing custom CSS for Marked