Forum How do I...?

Internal Link Works in HTML but not in PDF

barrett777
Hi Everyone,

I'm trying to get table of contents links working for within my document.

I think I had this working at some point in the past, but I've been away from this project for awhile and can't remember with certainty.

If you view the .html file in your browser, you can click on the items in the table of contents and they each link to where they are supposed to.

Yes the html looks wonky in your browser, because of different elements I move to headers and footers. When converted to pdf, it should look somewhat normal.

Once converted to pdf, though, these links no longer work.

The .pdf bookmarks do work fine.

I've searched these forums, and the only problem I can find related to links seems to be linking to inline elements or linking to empty elements. Many of my links point to <h2> elements, though, and I've tried a few different combinations of CSS changing elements to block type or otherwise trying to get these links to work.

I don't get any errors in verbose logging either.

Thanks for your time,
Ben

Edited by barrett777

mikeday
The links are wrong or some IDs are missing. If you load the file in the browser, the link for "1e. RIGHTS DISTRIBUTIONS" does not go anywhere, as ID SubTopicID5Begin does not occur in the document.
barrett777
Hi Mike,

Thanks for your quick reply. Does that mean that one broken link will break the rest of the document?

Also, either way - is there a way to log these broken internal links to help me debug?

I will work on completing it and cleaning up the broken links and see if it works after that.

Thanks,
Ben

Edited by barrett777

barrett777
Hi Mike,

I believe I've fixed my links, and I still have the problem - no internal links are working in the pdf output. All links should work if you open the HTML in your browser.

I've attached the new HTML, as well as a jQuery function to check and alert broken internal links if anyone else is interested. Feel free to share if it's helpful - just stick it in the <head> section of any html document and open in your browser.

Let me know if you need any more information - this is an important feature for us.

Thanks,
Ben
  1. jQuery Check Internal Links.txt0.8 kB

Edited by barrett777

mikeday
All the links seem to go somewhere if I click on them, check the attached PDF below.

However, in the table of contents section 2 and section 3 headings both link to TopicID1001Begin, which is actually section 1.
  1. PrinceTest.pdf164.9 kB
barrett777
Terribly sorry! It is my pdf viewer software......... *embarrased*

Edit: In case you get goobers posting similarly in the future, I'm using Foxit reader (Back in the day was more popular while Adobe Reader took ages to open - haven't changed since). At least I'm not the only one: http://forums.foxitsoftware.com/forum/portable-document-format-pdf-tools/foxit-reader/614-latest-version-of-foxit-reader-~-can-t-click-on-url-links-in-pdf-~-safe-mode-unchecke

Apparently you have to pick the 'Hand' tool in order to click links. I've always had the 'Highlight Text' tool selected.

Edited by barrett777