Forum How do I...?

Linking Between HTML Files in a Single PDF

scott_w
So I have done some poking around in the forum about this topic and I see where others have had similar issues but I haven seen a definitive answer.

I'm creating a single PDF using multiple (x)HTML5 files. So for example lets say I have three files sitting in a folder on my desktop.

file-1.html
file-2.html
file-3.html

And if "file-1.html" as links pointing to file-2, and file-3 and it is written like so:

href="file-2.html"
href="file-3.html"

And I create a single PDF using these three files the links between "file-1" and "file-2" work fine. However of the links look like this:

href="../../documents/doc-name/file-2.html"
href="../../documents/doc-name/file-2.html"

Then the links are not created properly and cannot be resolved in the PDF even though they are resolvable in a browser.

The link in the PDF indicates a value in the link that contains a full path and looks something like this:

/Users/scott-w-home/documents/doc-name/file-2.html
/Users/scott-w-home/documents/doc-name/file-3.html

I know that the cleaner/simpler relative paths are better but we do not always control this. Is there a way to deal with this problem without changing all the @href values?

I haven't tested this yet, but sometimes we have a subfolder with files inside and out that point to each other. I am assuming they would break also.
mikeday
Currently Prince does not automatically resolve all the paths to a single canonical form, so you need to ensure that they are syntactically identical for the links to be resolved as you expect.