Print to PDF preserving hyperlinks


(Konstantin Boyandin) #1

I was always fascinated why Firefox prints Web pages to PDF eliminating active hyperlinks. The obvious purpose of saving document is thus ignored.

The primary rival, Google Chrome, has no problem printing page to PDF file while preserving all the active links. With Firefox, I only can use add-ons such as “Save to PDF”, all of those have drawbacks (watermarks, quirks saving page since they may need first to open it from a remote address etc).

So, will we see either printing to PDF while preserving all hyperlinks in resulted file, or saving to some alternative (again: Google Chrome can save to Google Drive)?

Thanks.


(codegenki) #2

@Konstantin_Boyandin completely agree with you about preserving hyperlinks in printed pdf files being the major objective. Firefox makes an excellent combination of reading mode and pdf printing, but absence of certain features in print dialog reduces customizability options. It’s true that Chromium (Google Chrome included) preserves hyperlinks but lacks a major feature: Reading Mode.

For now I’ll suggest a useful addon, Print Friendly & PDF, that solves this issue. At the same time, +1 on the motion to add this feature in future versions of Firefox.

Regards


(Konstantin Boyandin) #3

@codegenki Thanks, and I agree. “Save as PDF” (from pdfcrowd dot com) looks quite as able, but has limits on page size. Thanks for the reference to another add-on.


(noisepainratio) #4

There is a 10 year old open ticket for this problem: https://bugzilla.mozilla.org/show_bug.cgi?id=454059

Feel free to add your +1 vote. It’s astonishing this has not been fixed for such a long time period.


(jscher2000) #6

To generate PDFs with hyperlinks requires code in Firefox or an add-on to build the document rather than sending it to a printer driver.

  • Adobe’s “Create PDF” extension is a proprietary WebExtensions example (bundled with Acrobat Standard or Pro, but not Reader)
  • The legacy extension Print Pages to PDF did it using the wkhtmltopdf library, which might be how Safari and Chrome do it (Possible Update for Print Pages to PDF Add-on)

Note: The tabs.SaveAsPDF() method available to extensions emulates printing, so that doesn’t help with this problem.


(Konstantin Boyandin) #7

Actually, I use “Save as PDF - by pdfcrowd.com” Firefox plug-in.

However, I still think that browser (Firefox) should be able to print page as PDF with hyperlinks. If Chrome can do that, what prevents Firefox from doing the same, without plug-ins?


(developer11) #8

@Konstantin_Boyandin
What prevents? So called “Mozilla knows better”…


(Konstantin Boyandin) #9

@developer11 Yes, that’s a mighty spell, it has already finished off Xmarks, with their bookmarks sync.

Looks like Mozilla learned nothing and will continue to neglect developers’ and users’ actual needs, no matter what.


(Mittineague) #10

No offense intended, but without a link pointing to an authoritative source of reference that strikes me as opinion or conjecture. It would be much more informative if you will please post a link to where the matter has been discussed. eg. it’s on the road map but not top priority, it would add uneccessary undesirable code bloat because it’s an edge case feature that addons can provide, implementation would be more involved than it’s felt it’s worth because of the way the engine is designed, etc.

Knowing the actual “why not” would at least give anyone that found this topic and wanted to help change this a starting point.


(jscher2000) #11

I haven’t heard of that one. I should update my list of converters post: So many PDF converters

I don’t think anyone’s disagreeing this would be nice to have but it’s obviously on the back burner. As long as there are effective workarounds, I don’t see the priority getting raised. Someone who cares needs to step forward and code it.


(Konstantin Boyandin) #12

@jscher2000 The “nice to have” is, in fact, almost obvious feature. if I print a Web page, it could be quite obvious to keep the active working hyperlinks within it.

To Google Chrome developers that was obvious enough, Chrome prints PDF files with working links. To Firefox developers, strangely, that’s not obvious.

The problem with crutches (workarounds, plugins in this case) is that they a) can die at any moment; b) can require payment to print with links; c) may not work as expected.

For example, mentioned “Save as PDF” actually loads current page from its server, then prints and sends as PDF. If the page requires authentication to access the content, plugin will not print the page I see in browser.

So no, this is a feature that is VERY nice to have in browser, in native implementation.

At this step the development management, if they condescend to this mundane thread, will say something like “We may consider that somewhere in future”, correct?

Bells and whistles are of much more importance than the really useful features.


(Mittineague) #14

I am not associated with Mozilla the entity. What I may have in common is that I have been writing code for many years. I have seen many instances where an author of a what started as a relatively “simple” script received many “feature requests” (including edge cases) that when added resulted maintenance problems and at times even complaints that the script was too large and confusing. The sad fact is that it’s impossible to please all of the people all of the time.

Whether or not a developer wants to do one or a few things well, or wants to do “everything” is up to the developer. Pull Requests can be a big help in lessening the work load, but it’s still up to the developer to decide on accepting or rejecting the PRs.

What I meant by “authoritative” is a post made by someone that is “Mozilla” where they gave the reason for the feature not existing.


(Konstantin Boyandin) #15

Live links in printed PDF documents is a feature, really requested by majority of users. Google Chrome does that. Opera does that. Brave does that.

But Mozilla Firefox doesn’t. What’s worse, all the ado is about a minor improvement (to add a real link while generating PDF output is de facto including several lines of code).

Once again. What worries me is that Mozilla stopped doing changes actually requested by many users (carry out a survey about active links in PDF files, to see whether those are requested). The canned response to most criticism is “do it yourself, or use a plug-in”.

Since we have seen how Mozilla can abandon developers of plug-ins (see the thread mentioning Bookmarks API that was still unfinished when Firefox ceased to support XUL - and read of some consequences, such as Xmarks shutdown), the official Mozilla policy can be named hypocrisy.

What I would like to ask Mozilla to do is to run survey about adding live hyperlinks into PDF (without any plug-ins) and add, officially, that task to its public planned features lists.

Otherwise, it will be just another promise or canned response “do it yourself if you need it”.


(Mittineague) #16

But doesn’t it? No addons or extensions:


(Konstantin Boyandin) #17

If the hyperlink was in the form of

<a href=“URL”>Text</a>

you will only see “Text” in PDF, without any URL.

So no, Firefox doesn’t.