convert html page to pdf from jquery plugin - javascript

i have designed a page in html. i need to find a way to save the html body section as pdf. can some one suggest me a jquery plugin where i can get this work done?
am using C# as my back end coding.

Related

Generate PDF of a section of a php page once rendered into HTML and CSS and account for pdf page-breaks

The system I am working on has a questionnaire in it and then shows the responses to the admin in a nice report on screen. I need to create functionality that turns the on screen report into a pdf, similar to how the browser generates a pdf of the page when you select print. Although I need to only turn a section of the page into pdf. And it would be ideal to be able to alter the HTML so that the pdf page breaks don't interfere with the presentation of the report.
You can download a pdf of how the report looks, generated by the browser functionality. This is just an example, I need the pdf to be generated by a link or button and not include the whole page (the top part in this case).
I have tried some php HTML to pdf generators, but it's difficult because the HTML is dynamically generated so I'm not sure how to send all the HTML, once rendered, to the page that creates the pdf.
To overcome the page breaks, I've considered using javascript or jquery to read the height of the div of each question within the report and then write a simple script to calculate if the next div will fit on the page and if not add a margin on top of that div so that it starts on a new page.
What software can I use to generate the pdf, given these requirements? Either php or javascript. Appreciate the help.
Have you considered Snappy for PHP? It makes use of wkhtmltopdf behind the curtains to convert any HTML document into PDF.
We are using it and it works great.
https://github.com/KnpLabs/snappy
You could try mpdf and use the page-break-inside: avoid property which is actually a CSS property. I have not used this, but it might be what you're looking for.
Looks like you can add this property to the <div> and <table> tags (mPDF Supported CSS).

Using Javascript with MPDF

I want to use the charts created in charts.js with MPDF but it doesn't seem to be recognising the Javascript elements, do you know if there is anything additional you need to add.
If MPDF cannot render Javascript do you know any other HTML to PDF converter in PHP that will work?
Better make charts in PHP using https://phpchart.com/. if you want to show it in a pdf. javascript looks and style does not work in PDF anyway.

Showing an entire ASP website as an image

I have an ASP website that gets data from SQL queries and puts them into divs and then, superimposes the divs over an image. The only problem is that when people try to save the image, they do not get the data or the divs with the image.
Is there anyway I can combine the divs and the image into one single picture using ASP or even ASP.NET? This way when people try to save the images, they get the original image and also the data that is put on top of the image as well.
I have been trying to use the
Response.ContentType = "image/gif"
tag in a separate page and tried to call that page as an image but that's not working when you have HTML combined with the ASP. Can anyone please help.
Youc can use html2canvas library to take "screenshots" of entire pages.
Update:
Apparently it is possibe server-side as well (using ASP.NET tho) by using WebBrowswer control (yes it can be used in ASP.NET as well). Take a look

How to generate a PDF out of a rendered HTML element?

Is there a way to generate a PDF file in JavaScript out of a given rendered and styled element of a webpage and its content? Is there already a library for this?
I've never put it to use, but could https://github.com/thebluber/htmlToPdf be what you're looking for?
There is a library called jsPDF. It provides basic functionality to create PDF documents. It even comes with a plugin to add elements from basic HTML.

Paginate UIWebView content

UIWebView is loaded with a long html. How to paginate the UIWebView, without the content or image in it getting cut? I have tried using ePubjs but not sure how it works! Can anyone help?
There is JavaScript file contain function for pagination google it, and also you need to inject your HTML file to insert the HTML tags needed to make the pagination function work.

Categories