0

I am stuck at one place. I have an HTML page but I wanna only one DIV on print page with print button and save as PDF in with save button as bellow.

<div class="abc">
    Here are some words
    <div class="def">
        Some more words
        <div class="ghi">
            This is I want for print on A4 page and save as PDF but like my letterhead with logo and other detail like microsoft word have header and footer. I want to header and footer add in header.php and footer.php but only on print and save as PDF. And this div class in the middle of letter.
            <button>Click for print</button>
            <button>Click to save as PDF</button>
        </div>
    </div>
</div>

I wanna print version as Letter head
Thanks a lot in advance.

djmhim
  • 49
  • 7

1 Answers1

0

You need a separate tool to create PDF from HTML and it need to be on the server side. Possible solutions for PHP are discussed in Convert HTML + CSS to PDF with PHP?

If you don't really need PDF but only a printable version, I would recommend using CSS media queries for printing. You can hide all unwanted parts very easy with it and use the browser print button:

@media print {
   button { display: none; }
}
Community
  • 1
  • 1
JSchirrmacher
  • 3,243
  • 2
  • 19
  • 27