[Solved]Save As Pdf do not save links
-
burnout426 Volunteer last edited by
I can confirm that with the PDF produced by the "right-click on page -> Save as pdf" feature, not all links are clickable.
I don't know if it's due to an actual bug or if the code that generates the PDF is just limited in how it detects HTML links.
On https://forums.opera.com/category/11/opera-for-windows, if you right-click on a link to a thread and inspect it, you can see that it is indeed an HTML anchor element and not some other element that's just made clickable by Javascript. Given that, I'm assuming the the "Save as PDF" code just isn't picking up those anchor elements because they're added to the page dynamically with Javascript or something in a way that causes them not to be detected.
Given that, I would assume Opera could be improved to catch more links.
-
burnout426 Volunteer last edited by burnout426
It could be as simple as this:
test.html:
<script> window.addEventListener("DOMContentLoaded", function() { var a = document.createElement("a"); a.href = "https://example.com/"; a.textContent = "Am I clickable in a PDF?"; document.body.appendChild(a); }); </script>
Load test.html in Opera, right-click the page and choose "save as pdf". Then, open the PDF and see if it's clickable. If it's not, it means Opera doesn't detect dynamically-added links. If so, it's something Opera should fix if possible.
-
operapdf last edited by operapdf
You are right.
Opera do not find dynamic links in save as pdf (but do it in print to pdf).
Probably opera take semantic information from initialization page step for save as pdf. However opera take actual view of page for save as pdf (for example you can open some sub item on the page which do not showing on the page by default, and opera do save page in actual state).It is a pity that we have such asymmetry. I think it is not a true bug. Just developers have had some trouble with it. And they implemented this asymmetric approach.
Do you know where do i can see programme code of this functional or it is not a public code?
-
burnout426 Volunteer last edited by
@operapdf said in Save As Pdf do not save links:
Do you know where do i can see programme code of this functional or it is not a public code?
Opera's source code is not public. But, Since it uses Chromium, you can look at Chromium source code.
I think Chromium and Opera's PDF functions are done with https://opensource.google/projects/pdfium. Also, see https://cs.chromium.org/chromium/src/pdf/pdfium/pdfium_print.cc?g=0. I'm assuming Opera wrote some custom code for the "Save as PDF" function that makes use of PDFium. But, theat custom code probably isn't available to the public. But, don't really know for sure.
On a side, there might be a "Save as PDF" extension that does things better than Opera's feature. You can look at https://chrome.google.com/webstore/search/save as pdf?_category=extensions and https://addons.opera.com/en/search/?query=pdf.
-
A Former User last edited by leocg
PDFs created via
Page
>Save as PDF
do not seem to save any URLs anymore since version 65.0.3467.38Opera 65.0.3467.42 Stable x64, Win10 Prof.
-
A Former User last edited by
Addendum: The same goes for Opera Developer 66.0.3502.0 x64.
Didn't test Opera beta.
-
A Former User last edited by A Former User
@burnout426
I tested this example. test.html
If a PDF file is created in Opera 63 and later, in the created PDF, the link is not clickable.
If a PDF file is created in Opera 62 and below, the link is clickable.In the PDF file created in Opera 65 and 66, it seems that any links are not clickable.
-
burnout426 Volunteer last edited by
@johnd78 Thanks. If you get a chance, and can narrow it down to the first build with the problem, that'd help.
In the 63 changelog, the only PDF change I see is "DNA-78740 Save as pdf does not work on sidebar’s pane". The change is listed for 2 different builds.
-
A Former User last edited by
@burnout426 said in Save As Pdf do not save links:
If you get a chance, and can narrow it down to the first build with the problem, that'd help.
The first build in which all links are not clickable when saved to PDF - Opera Developer 65.0.3454.0
-
burnout426 Volunteer last edited by burnout426
@johnd78 Thanks.
I don't see much in the changelog that would cause it beside a Chromium update. The Chromium update has quite a few PDF changes though.
https://chromium.googlesource.com/chromium/src/+log/78.0.3895.5..78.0.3904.9?pretty=fuller&n=10000
-
burnout426 Volunteer last edited by
The bug was more to do with links that didn't have class attributes or something than just dynamic links. Anyway, all seems to be good now in Opera Developer.
-
A Former User last edited by
I now have Opera 67.0.3575.79. And “Save As PDF” doesn't even save simple links from wikipedia.
-
burnout426 Volunteer last edited by
@operfree The fix isn't included in Opera 67. It's in Opera 68 (Opera Beta) and Opera 69 (Opera Developer). However, it looks like there's more work to do as the table of contents links on https://en.wikipedia.org/wiki/Opera_(web_browser) don't get saved as links.
-
burnout426 Volunteer last edited by
@burnout426 said in [Solved]Save As Pdf do not save links:
However, it looks like there's more work to do as the table of contents links on https://en.wikipedia.org/wiki/Opera_(web_browser) don't get saved as links.
I guess those never worked, so never mind on that part.
-
milolav last edited by
When using this option, original url is not stored within the generated PDF. Is that also a bug or something that never worked?
It would be great if the url is stored in the Title or Subject field of PDF's metadata.