0

I have a Webpage designed in HTML and done its CSS also,Now i have to add a functionality as button which oncliking converts the same page to pdf and Download.I don't need any online converter and also it should not be converting the webpage to image and then to PDF as it harms to quality and it's text will become unselectable.

Junaid
  • 1
  • I don't know of any browser based solution that fits all your requirements - especially the fact that you can't go via image, as ALL current browser based solutions do - as much as you "don't need any online converter", the only solution I can think of is having a converter on **your** server - but ... that's "online" isn't it – Jaromanda X Jul 22 '22 at 04:31
  • Select document.getElementById("") and try window print. – tirth1620 Jul 22 '22 at 04:32
  • If you don't mind having everything to print in a `div`, [this](https://stackoverflow.com/q/18191893/16886597) might work for you. Or search for "HTML to PDF library JavaScript" and you might find something that works for you – cocomac Jul 22 '22 at 04:33
  • I guess nobody understands the difference between a text-based and an image-based PDF :p – Jaromanda X Jul 22 '22 at 04:55
  • see https://stackoverflow.com/questions/21950599/convert-html-into-pdf-using-wkhtmltopdf-in-nodejs - you will need to do the conversion on **your** server - so you'd need to send the current HTML to the server, have it do the conversion and respond with a PDF file - that link shows how to do it with node.js - there are other resources for other backends - you just need to search – Jaromanda X Jul 22 '22 at 05:10
  • Please provide enough code so others can better understand or reproduce the problem. – Community Jul 22 '22 at 05:31

0 Answers0