If you can get the HTML from the URL, you can check out this answer I wrote and explains how to do this.
Example:
https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=show
HTML, PDF HTML-.
PDF, https://www.github.com:
<a href="https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=show" target="_blank">Show PDF</a>
:
<a href="https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=download&file_name=my_pdf">Download PDF</a>
JavaScript, HTML PDF. :
HTML:
<button type="button" id="download-pdf-button">Download the PDF</button>
JavaScript:
document.getElementById("download-pdf-button").addEventListener("click", function() {
var link = document.createElement('a');
link.href = 'https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=download';
link.download = 'file.pdf';
link.dispatchEvent(new MouseEvent('click'));
});
Github.
, .