Skip to main content
New Participant
Jul 26, 2024 6:48 PM UTC
Question

Anchor link in html doesn't work in pdf

I have a html file and I have put anchor link in the Table of Content that will direct me to the selected part in the html webpage. But after I print the page and save as pdf, the anchor link is clickable but it directs me to the wrong part. Anyone have idea of how to solve this?

I also try to use html to pdf smart service instead of printing as pdf, the anchor link in pdf completely doesn't work.

3 replies

davidj137213
Brainy
Jul 28, 2024 10:39 AM UTC

COuld you attach here your html sample please?

New Participant
Aug 1, 2024 6:38 PM UTC

Hi David, thanks for replying. I have solved the problem. The key here is to make sure html and pdf layouts are consistent, otherwise the link will point to a different destination. I had a print button in the middle of my html script and it seems to mess up my layout. I moved the button to the top of script.

davidj137213
Brainy
Aug 2, 2024 7:15 AM UTC

glad to hear that.. Good work!!