How to export website to pdf

Started by
3 comments, last by Sik_the_hedgehog 9 years, 6 months ago

Hello, I have a website, that is just really displaying the input of a form, you know like a typical confirmation page. I want to have a button there to export the website to pdf, how can I do this ? I tried using the scripts offered in printfriendly.com but the pdf prints the url at the top and it can't be removed, it even shows when you print the page physically, I can't have that. Then I tried all these different libraries. I tried jspdf, but it only works on firefox and the text comes all messed up in the pdf, kind of like all justified and without line spacing, it shows all the text together in one block. Then I tried other libraries like dompdf, html2pdf, fpdf and all of them give me errors.

Advertisement
Can you just open a print dialog normally? You can print to PDF from Chrome, Firefox, and IE (with plugins).

Sean Middleditch – Game Systems Engineer – Join my team!

As a side note, (some versions of?) The GIMP allow to rasterize whole webpages to an image. I think it's likely this is not enough but you can always try.

Previously "Krohm"

We use PhantomJS for something like this. It isn't perfect, but we had complex requirements and it handles most things well enough.

Does it need to be done on the client side? Maybe it'd be easier to do it on the server side instead. As a bonus you can also generate a PDF file that's more suitable for print than the weird thing you'll get from a design made for a screen.

Don't pay much attention to "the hedgehog" in my nick, it's just because "Sik" was already taken =/ By the way, Sik is pronounced like seek, not like sick.

This topic is closed to new replies.

Advertisement