Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to Convert HTML file into PDF in PHP

    • 0
    • 0
    • 0
    • 0
    • 1
    • 0
    • 0
    • 0
    • 1.54k
    Comment on it

    Helo Readers,

    If you want to convert the HTML to PDF read the below code: When we do this first of all we require the fpdf library file which can be downloaded from the official site of FPDF.

    After download it, Just copy the folder into your directory and customize it according to your need.

    After that make te HTML page as per as your need, here we make a simple HTML form to get some user input data for PDF. When user input the data and submit it generate the pdf with this input data.

    <title>Convert HTML file into PDF in PHP</title>
    <div class="">
          <form class="" action="pdf.php" method="post">
          <input type="text" class="" name="name" placeholder="Name">
          <input type="text" class="" name="email" placeholder="Email">
          <textarea name="comment" class="" rows="4" cols="8" placeholder="Comment"></textarea>
            <button type="submit" class="">Submit</button>
             <button type="button" class="">Cancel</button>
      <p>Then we make the pdf.php file where the above HTML form post</p>
     $pdf=new PDF_HTML();
     $pdf->SetAutoPageBreak(true, 11);

 1 Comment(s)

Sign In

Sign up using

Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: