Friday, May 17, 2024
 Popular · Latest · Hot · Upcoming
180
rated 0 times [  184] [ 4]  / answers: 1 / hits: 47680  / 11 Years ago, tue, december 17, 2013, 12:00:00

I would like to have a link that when is clicked, automatically starts the download of the printable version of the web page.



I'm using Moodle. The content I want it's exactly the same If I download the page using ctrl + p and saving as pdf or using



<a href=whatever.htm onClick=window.print();return false>Download web page</a>


I want exactly that content because using this way, the header, sidebar and footer is removed. I don't want css.



I'm not using this because this doesn't work in some browsers.



I'd rather not using pdf libraries like tcpdf because Moodle loads the content in a dynamic way and send this to a libraries like that is a mess.



I tried using sites like pdfcrowd.com but this kind of sites don't work when the site you want to convert to pdf uses a server-side session to identify the user.


More From » php

 Answers
5

I don't believe that there is a way to do this with window.print(). However, there are HTML to PDF converters available for free, and you could automatically start a download with that. An example of this would be jsPDF, a free library for converting HTML to a PDF with Javascript


[#73688] Monday, December 16, 2013, 11 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
devinjadong

Total Points: 711
Total Questions: 117
Total Answers: 100

Location: Andorra
Member since Sat, May 27, 2023
1 Year ago
devinjadong questions
Thu, Feb 17, 22, 00:00, 2 Years ago
Wed, Dec 8, 21, 00:00, 2 Years ago
Tue, Oct 27, 20, 00:00, 4 Years ago
Fri, Oct 18, 19, 00:00, 5 Years ago
;