how to create a document page through html that can downloaded/ print in pdf format

57 Views Asked by At

I am currently working on a library website. The client requires that student details should be shown in pdf format and should be printable.

Suppose, a user clicks on the view more button on the table, then the new page should appear using anchor tag. When it gets open the students detail should get details in proper format and in the above part there should be one button to download/ print

I am using HTML, CSS, PHP and MySQL.

1

There are 1 best solutions below

0
On

use javascript to print the document example :

<script>
    let print = () => {
        let objFra = document.getElementById('myFrame');
        objFra.contentWindow.focus();
        objFra.contentWindow.print();
    }

</script>

call the function using an onclick event