Currently I am trying to convert an angular and bootstrap heavy url using wkhtmltopdf. However, the result of the conversion is simply just a blank pdf with a small rectangle that matches the color of the webpages background. I have a sample output from jsbin I'm using to test angular and bootstrap, and the pdf comes out as intended (http://output.jsbin.com/qucaravupi), only real difference is my sites html requires login and authentication (which I'm using --cookie option to pass in).
Trying to pdf the bootstrap homepage results in sslHandshakeError, so I'm unable to determine if the issue is server side or a result of the page failing to render via wkhtmltopdf. I can use curl to grab the page info from https://getbootstrap.com/css/, but can't use wkhtmltopdf to convert it so I know it's not a redirect problem. Any ideas as to what can be the issue?
Related
I am trying to export an html page that contains html form and canvas to a pdf file (after onclick event (button)). I already been aware of wkhtmltopdf and PhantomJS but I think that it cannot be implemented as it should.
(the main problem is that I want to export the output offline, by covnerting the web app to android apk using the http://www.appsgeyser.com/)
To get your requirement, I hope you require to take pdf of web page.
if my understanding is correct, Please refer below link
http://www.hiqpdf.com/demo/ConvertHtmlToPdf.aspx
also see the existing post ITextSharp HTML to PDF?
Follow the Link of Zend_Pdf : http://framework.zend.com/manual/1.12/en/zend.pdf.html
You can also try jspdf : http://jspdf.com/
Or try to use javascript
I have created an application in asp.net MVC 3, I used highchart.js for rendering chart(stacked column) in view and its output is coming as svg.
I need to convert this chart page into PDF file. I tried iTextSharp but its not showing the chart page content.
Is there anyway to convert html 5 to PDF?
ExpertPDF is a nuget package you can install. For it to work without putting text over your pdf, you'll have to purchase a license. It can handle svg.
http://www.html-to-pdf.net/ExpertPDF-HtmlToPdf-Converter.aspx
You can also use a webkit component such as HTM2PDF to render HTML to PDF - see an explanation here:
Highcharts to PDF with Webkit
If you just want to convert svg to image then you can use PhantomJS (headless webkit browser). With help of PhantomJS you can render svg and make screenshot. Then you can create a PDF and insert that image into it.
Also you can Aspose.Pdf for converting svg into PDF directly. See: http://www.aspose.com/.net/pdf-component.aspx (it's a paid component!)
I am running a node.js server, and it is rendering a web page wonderfully. When I look at this in a browser, it runs exactly as I expect.
However, what I actually want to do is make the call to fully generate the html page - exactly as it is in the browser - within the node.js code, as a call. Currently, I have tried this:
http.request("http://localhost:8000/").end();
(with a few variants). This does exactly what it says, which is to make the single call to the server for the page - what it doesn't do is actually render the page, pulling in all of the other script files, and running the code on the page.
I have tried exploring express and ejs, and I think I need to use one of these, but I cannot find out how to do this fairly straightforward task. All it needs is to render an html page, but it seems to be a whole lot more complex than it should be.
What output do you want? A string of HTML? Maybe you want PhantomJS the headless browser. You could use it to render the page, then get the rendered DOM as a string of HTML.
Use the Mikeal's Request module to make http requests once you captured the response you then can inspect the html however you like.
To make that easier though you should use cheerio, this will give you a jQuery style api to manipulate the html.
Perhaps you are looking for wkhtmltopdf?
In a nutshell, it will render an entire web page (including images and JavaScript) to a PDF document.
I am trying to generate a printable version of the HTML page, the printable version should have left pane and top pane stripped off. I tried to generate the printable version using JQuery, it has some layout issues while getting the stripped of content into the print preview screen(which is another stripped off HTML in pop up window).
Is there any ready made open source tool which converts HTML to PDF without much effort, because I have already lost quite a bit of time trying to explore in JQuery
I am using Grid 960 template layout
When you have processed the html, wkhtmltopdf (Windows/Mac/Linux) can convert it to pdf. wkhtmltopdf is a cross-platform, open source (LGPLv3) command line tool to render HTML into PDF and various image formats using the Qt WebKit rendering engine. These run entirely "headless" and do not require a display or display service.
wkhtmltopdf can be downloaded from the official wkhtmltopdf website. It is also in the default repositories of most common Linux distributions.
Examples
Convert a remote HTML file to PDF:
wkhtmltopdf http://www.google.com example.pdf
Convert a local HTML file to PDF:
wkhtmltopdf example.html example.pdf
wkhtmltopdf usage You can also display the wkhtmltopdf help locally by running wkhtmltopdf -H.
why not just use a print stylesheet, and let your users print to PDF if they want to?
http://www.alistapart.com/articles/goingtoprint/
I currently have a "PrintingWebService" that I call from an AJAX page with all the information that is needed to construct a highly customized PDF printout using PDF Sharp and the PDFSharp's GDI+ mode, which takes DrawString and other commands that work basically just like GDI+ only they are drawn to the PDF.
I then save the PDF file to a location on the webserver and return the file name from the web service, and the AJAX page opens a new window with the pdf file.
So far, it works well, however, there is one part of my AJAX page that I want to printout and I haven't come up with a solution for yet. I've got a string of the HTML content of a TinyMCE editor that I want to dispay in the bottom part of the PDF page.
I'm looking for some sort of tool I could use for this purpose. Even something opensource that prints to GDI+ I could use by taking the source code and translating it to use PdfSharp's GDI+ (the class names are like XGraphics, with each class having X before the GDI+ name).
If I have to I will limit what HTML can be generated by TinyMCE and write my own renderer, but that will be a big challenge, so I'm looking for other solutions first.
I've stayed away from a printer-friendly page approach because I wanted to construct a page that was a near identical of an existing WinForms printout, using my existing code. With PdfSharp I was able to convert all the code except the text area stuff (which used the RichTextBox and RTF in the WinForms version).
Tony,
I personally have used WebSupergoo's ABCPdf library with much success. You can actually render HTML directly to the PDF and it does fairly well in regards to accuracy.
Another free software that will allow you the flexibility of writing HTML to PDF that I have used in the past with much success is iTextSharp.
Otherwise, I think you'll have to write something to render HTML to GDI.
Either way, you may want to consider using an HttpHandler that you map to using your web.config to generate the PDF file. This will allow for you to render the PDF to a bytestream and then dump it directly to the user (as opposed to having to save each PDF receipt to the web server). It will also allow for you to use the .pdf extension in the page that returns the receipt (PurchaseReceipt.pdf could be mapped to a HttpHandler)... making it more cross-browser friendly. Older versions of Adobe / Browsers will not display correctly if you start throwing a PDF byte stream from an ASPX page.
Hope this helps.