Keeps internal links when printing webpage to PDF

I am working with Chrome (up to date)

I would like to export a webpage to PDF (via print) and keep internal links like :

<a href="#Section1">Section 1</a>

For now it seems to keep the "a" tag because the element is clickable, but clicking on it doesn't do anything.

It is even possible ?

Answers


You can use the pdf-converter built into LibreOffice Writer. I have had good results with that, including working internal links.

  1. Save the page as html
  2. Open the saved html file in LibreOffice Writer
  3. Tweak the layout, remove unwanted sidebars, etc.
  4. Export to pdf.

This has the added advantage that you get the chance to tweak your results in step 3 to avoid things, like lines only filling about half the page width, that often occur when directly printing from the browser.

A possible drawback may be that this could fail for websites that are dynamically generated so they don't save well as html. I have not had the desire to print/convert one of those pages yet though.


In my own testing of a fresh Chrome download, viewing an HTML page that uses internal links (this one from the United States Access Board on some technical standards), I found that it offers a "Save as PDF" option on its Print menu (select the Change... button, and find the first option under the Local Destinations subhead), and that does emit a PDF file with working internal links.

I should add that I'm not 100% certain that it came with Chrome, because all my test machines have Acrobat installed as well, but I don't see the same entry in the Print menu of my IE browsers, so I believe "Save as PDF" is an actual Chrome feature, and not just an Acrobat plug-in.

There are also various other products out there offering HTML-to-PDF conversions, including those that specifically promise to preserve internal links, so if you chose one that installed as a Print driver, you could then have that same full-featured HTML-to-PDF capability in any browser, not just Chrome, by simply picking that conversion tool from your printer menu.


Need Your Help

How to sort the date column according to month in a table using javascript?

javascript

How to convert date dd mon yyyy to mon dd format in javascript?

today() function returns date with time when project converted to .net

c# datetime powerbuilder powerbuilder-conversion

My application behaves differently when I work on Windows Server 2008 R2.