Where did you install Firefox from? Help Mozilla uncover 3rd party websites that offer problematic Firefox installation by taking part in our campaign. There will be swag, and you'll be featured in our blog if you manage to report at least 10 valid reports!

搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

Howto include embedded links when printing to PDF?

  • 2 个回答
  • 3 人有此问题
  • 14 次查看
  • 最后回复者为 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.

所有回复 (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.