crabbly / Print.js

A tiny javascript library to help printing from the web.
MIT License
4.28k stars 672 forks source link

PDF Hyperlinks not Clickable #667

Open arrigonyc opened 1 year ago

arrigonyc commented 1 year ago

Hello! I'm trying to print a PDF being generated from our backend that includes some hyperlink elements that should be clickable and navigate to a new url. However, when printed using print-js, the links are not clickable at all and just act like plain text.

Any ideas what might be wrong? I'm on version "print-js": "^1.6.0" in "react": "^18.2.0" and doing:

import printPDF from "print-js";
...
function handlePrint() {
    if (pdfUrl && pdfUrl.data) {
        printPDF(pdfUrl.data)
    }
}

Opening the PDF natively with window.open shows a pdf with clickable links so I'm confident the PDF is built correctly

laercioacj commented 1 year ago

Opening the PDF natively with window.open shows a pdf with clickable links so I'm confident the PDF is built correctly

When opening the pdf for printing (CTRL + P) it doesn't really offer an option to open links, but this is not a particularity of PrintJS