This
Bootstrap Contact Form With Html To PDF Converter is
developed in
Html,
PHP and
PDF extensions. This application is compose of Html forms to input a data of every persons or users. Every data that the user submitted it will directly sent to the pdf library and
generate a
print form. Each session of the submitted button creates from the Html it will convert automatically to a pdf format. This application will generally help to all the programmers for the converting and printing a file from the Html forms. See the example code below.
Sample Code
Index.html - This file we created is a simple contact form of data and shows that the submitted data is on a PDF format.
<title>Bootstrap Contact Form With Html To PDF Converter
</title>
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
<link href="css/bootstrap-responsive.min.css" rel="stylesheet" media="screen">
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script type="text/javascript" src="js/bootstrap.min.js"></script>
<div class="container" align="center">
<h2>Bootstrap Contact Form With Html To PDF Converter
</h2>
<form class="contact-us form-horizontal" action="actionpdf.php" method="post">
<div class="control-group">
<div class="input-prepend" style="margin-left: -200px;">
<span class="add-on"><i class="icon-user"></i></span>
<input type="text" class="input-xlarge" name="name" placeholder="Name">
<div class="input-prepend" style="margin-left: -200px;">
<span class="add-on"><i class="icon-envelope"></i></span>
<input type="text" class="input-xlarge" name="email" placeholder="Email">
<div class="input-prepend" style="margin-left: -200px;">
<span class="add-on"><i class="icon-globe"></i></span>
<input type="text" id="url" class="input-xlarge" name="url" placeholder="http://www.example.com">
<div class="input-prepend" style="margin-left: -200px;">
<span class="add-on"><i class="icon-pencil"></i></span>
<textarea name="comment" class="span4" rows="4" cols="80" placeholder="Comment (Max 200 characters)"></textarea>
<div class="control-group">
<button type="submit" class="btn btn-primary">Submit
</button>
<footer><a href="https://www.sourcecodester.com">Sourcecodester
© 2016</a></footer>
</div>
</div>
</body>
</html>
Actionpdf.php - This file contains PHP code to generate pdf file and show your submitted data on that file, and we also add page and auto page break true if your content increase single page area then it will automatically add a 2nd layer of page and process.
<?php
require('WriteHTML.php');
$pdf=new PDF_HTML();
$pdf->AliasNbPages();
$pdf->SetAutoPageBreak(true, 15);
$pdf->AddPage();
$pdf->Image('img/logo.jpg',20,15,25);
$pdf->SetFont('Arial','B',14);
$pdf->WriteHTML('<para><h1> Bootstrap Contact Form With Html To PDF Converter</h1><br>
Website Address: <u>www.sourcecodester.com</u></para><br><br><br><br>Form Output<br/><br/>');
$pdf->SetFont('Arial','B',7);
$htmlTable='<TABLE>
<TR>
<TD>Name:</TD>
<TD>'.$_POST['name'].'</TD>
</TR>
<TR>
<TD>Email:</TD>
<TD>'.$_POST['email'].'</TD>
</TR>
<TR>
<TD>URl:</TD>
<TD>'.$_POST['url'].'</TD>
</TR>
<TR>
<TD>Comment:</TD>
<TD>'.$_POST['comment'].'</TD>
</TR>
</TABLE>';
$pdf->WriteHTML2("$htmlTable");
$pdf->SetFont('Arial','B',6);
$pdf->Output();
?>
Hope that you learn in my tutorial. Don't forget to
LIKE &
SHARE this website.
Enjoy Coding!