how can i extract text and image in PDF file using php or javascript [closed]

Check this out

Basically you need to use html2canvas and jspdf to make it work. First you will convert your dom to image and then you will use jspdf to create pdf with the images.

A short note on how it work.
We will use two libraries to make this job done. and
First we will create a dom image by using html2canvas them we will use jspdf addImage method to add that image to pdf.
It seems simple but there are few bugs in jsPdf and html2cavas so you may need to change dom style temporarily.
Hope this helps.

If you want to print a page as pdf through button action then try this. Using the browser’s Print... menu item, you can utilize a PDF Printer Driver through code. This way any JavaScript included in the page is processed by the browser when the page is rendered.

function swapCss() {
<input class="printbutton" type="button" onclick="swapCss();" value="Print Customer Copy"/>

Browse More Popular Posts

Leave a Comment