Search Support

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

Learn More

Hierdie gesprek is in die argief. Vra asseblief 'n nuwe vraag as jy hulp nodig het.

Howto include embedded links when printing to PDF?

  • 2 antwoorde
  • 3 hierdie probleem
  • 14 views
  • Laaste antwoord deur mikemtnbikes

more options

I often print files out to share with students electronically and I want them to have access to the external links of a page. When trying to 'print' a file to PDF from the 'File->Print' context or 'Print Edit WE' addon, the URL links embedded in the original page are not retained. Is there a simple way to change this behavior.

I am running FF 56.0 on Ubuntu 16.04.

I often print files out to share with students electronically and I want them to have access to the external links of a page. When trying to 'print' a file to PDF from the 'File->Print' context or 'Print Edit WE' addon, the URL links embedded in the original page are not retained. Is there a simple way to change this behavior. I am running FF 56.0 on Ubuntu 16.04.

All Replies (2)

more options

Unfortunately, embedded links are not retained when printed. Firefox is sending the output in a format intended for a printer, not for an electronic document.

You may have noticed that some websites use a print style sheet to show all the links in parentheses after the link text in printouts. It often looks hideous. The trick is using a generated content style rule. As an example, you can open the Web Console on a page you want to print, execute a script, then use Print Preview to look at where the URLs are noted in parentheses.

To show the Web Console on the current tab, you can use either:

  • "3-bar" menu button > Developer > Web Console
  • (menu bar) Tools > Web Developer > Web Console
  • (Windows) Ctrl+Shift+k

An example script is as follows:

var s = document.createElement("style"); var t = '@media print{a:not([href^="javascript:"])::after { content: " (" attr(href) ")"; color: #000; }}'; s.appendChild(document.createTextNode(t)); document.body.appendChild(s);

This is a bit all or nothing, so it would be nicer to use a tool that adds just the URLs you care about...


Another possibility would be to use an add-on to generate the PDF. I don't recall whether I tested link preservation when I posted the following last month:

https://discourse.mozilla.org/t/so-many-pdf-converters/20193

more options

Darn. I was hoping for a simpler solution. Thanks for the information.