I am using PDFkit with node.js to convert an html page to pdf. HTML page has several image tags in body tag.
However When I convert html to pdf I get the black page generated. Can someone help me with the issue? thanks in advance!
#simran I hope this answer solves your issue. Try this logic it works for me:
I just posted it on another thread for pdf related issue: https://stackoverflow.com/a/64114358/3202440
Related
I have tried JSPDF and HTML2Canvas for this. While the HTML is rendered successfully, its CSS is entirely messed up. I also read somewhere that html2canvas doesn't work with long pages.
Can anyone provide me a simple Javascript code that takes DOM element and generates its PDF and also maintains its CSS? I would really appreciate it. Thanks.
I'm generating a HTML / Javascript page using PHP.
I'd like to offer to my users, after the preview of the page, the chance to save / download, programmatically (not interactively using browser functionalities ....), the code of this HTML / Javascript page.
I've tried to search on the web for any examples but nothing appears.
Any suggestion / example? Thank you very much in advance!
Cesare
I've solved using the solution shown in this post ...
https://thiscouldbebetter.wordpress.com/2012/12/18/loading-editing-and-saving-a-text-file-in-html5-using-javascrip/
I've put my code in a variable and then show it in the text area.
It's working !!
So I am using a cool tool called cropit to crop images. Now I am trying to get the cropped image exported in a PDF file, using jsPDF.
You can check the editor here: http://code.reloado.com/ecagos3/edit#html,live
(The PDF downloading part wont work, but by downloading the code an trying it out in localhost should be fine I guess)
The PDF file gets generated, but the quality of the image is just awful. You can check it out here: https://www.docdroid.net/KgJbYjk/test.pdf.html
Here is the original image: http://imgur.com/a/ZtmE1
Does someone know a solution for getting the normal output, or why this issue happened? Thanks in advance!
I've found the solution via a PHP library. It's called - mPDF
Is there a node.js module or a javascript library that can convert HTML/Page into PDF with selectable texts and working links? I've tried Phantomjs. But since its the only screenshot the page and convert it to pdf, texts are not selectable and links are not working. Also tried jsPDF but links are not working either. Hope you guys can share some of your experience in dealing the same problem.
Your response is greatly appreciated.
You can parse the HTML body with htmlparser. The complete html will be properly converted to JSON.
Depending upon the keys, you can then write it to a PDF using pdfkit.
This is very general solution. If you give us an insight as to what type of HTML you want to get into a PDF, maybe then we would be able to help with some specific code or logic.
Try http://www.cloudformatter.com/css2pdf.
Their links demo at http://www.cloudformatter.com/CSS2Pdf.Demos.Hyperlinks shows external links and internal links within the generated PDF.
I need to add a plugin for CKEditor that can insert an html file from my hard drive into the textarea. I looked for CKFinder, but it appears that it cannot upload html files. Any suggestions would be greatly appreciated. Please help me out.
You can customize the allowedExtensions in CKFinder's config.php file, or its equivalent file in ASP. A little lower than halfway the file, just below the warning comment about Flash files, you will find them. See the screenshot how I customized them.