Cara menggunakan print invoice using php

<?php

/**

* HTML2PDF Librairy - example

*

* HTML => PDF convertor

* distributed under the LGPL License

*

* @author Laurent MINGUET <>

*

* isset($_GET['vuehtml']) is not mandatory

* it allow to display the result in the HTML format

*/

// get the HTML

ob_start();

session_start();

//include(dirname(__FILE__).'/res/exemple01.php');

?>

<page>

<style>

table

{

border-collapse:collapse; width:100%;font-size:14px;margin-top:10px;

}

.left{

float:left;

}

td.w-10{

width: 10%;

}

td.w-40{

width:40%;

}

td.w-100{

width:100%;

}

td.w-33{

width:33%;

}

table, td, th

{

border:2pxsolid#000;

}

th{font-weight:normal;text-align:center;

padding:5px5px 0px5px;background-repeat:repeat-x;height:25px;font-size:16px;font-weight:bold;

border:1px solid#000;}

td

{padding:16px3px3px3px;border:1pxsolid#000;}

@frame footer {

-pdf-frame-content: footerContent;

bottom:2cm;

margin-left:1cm;

margin-right:1cm;

border:none!important;

}

</style>

<div class="row">

<div class="col-12 ">

<img src="http://freeonlineprojects.com/wp-content/themes/freeonlineprojects/images/logo1.png"align="left"height="100"width="300"/>

<h3 class="text-center po"align='center'style='text-transform: uppercase;

font-weight: bolder;

color:#887d7d; margin-top: 130px;clear: both;'>Tax Invoice</h3>

<br>

<div class="col-lg-8 col-md-8 "></div>

<div class="col-lg-4 col-md-4">

<table style="width:100%;"align='right'>

<tr>

<td>Invoice No:&nbsp;</td>

<td><span class="editcontent">123344</span></td>

</tr>

<tr>

<td>Booking Date:&nbsp;</td>

<td><span class="editcontent">12/12/20XX</span></td>

</tr>

</table>

</div>

</div>

</div>

<table class="table">

<thead>

<tr>

<th align="left"style=" border: 1px solid;">Customer Info&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

</tr>

</thead>

<tbody>

<tr>

<td>My Customer<br><br>NewBus stand,plot-23/2/2<br>Mobile:9090XXXXX,8978XXXXX</td>

</tr>

</tbody>

</table>

<table class="table table-bordered"style=" border: 1px solid;">

<thead>

<tr style="text-align: center; border: 1px solid;">

<th style="text-align: center;">#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th style="width: 25%"style="text-align: center;">Item#&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th style="text-align: center;">Qty&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th style="text-align: center;">No.Days&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th style="text-align: center;">Unit Price&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th style="text-align: center;">Total Price&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

</tr>

</thead>

<tbody>

<tr style="text-align: center;">

<td>1</td>

<td>2222222</td>

<td>3</td>

<td>1</td>

<td>1000</td>

<td>3000</td>

</tr>

<tr>

<td></td>

<td>***No item(s)exists after thisline***</td>

<td></td>

<td></td>

<td></td>

<td></td>

</tr>

<tr>

<td colspan="4"></td>

<td >Sub Total</td>

<td>3000</td>

</tr>

<tr>

<td colspan="4"></td>

<td>GST(18%)</td>

<td>360</td>

</tr>

<tr>

<td colspan="4"></td>

<td>Total With GST</td>

<td>3600</td>

</tr>

<tr>

<td colspan="4"></td>

<td>Advance Amount</td>

<td>2000</td>

</tr>

<tr>

<td colspan="4"></td>

<td>Due Amount</td>

<td>1360</td>

</tr>

</tbody>

</table>

<table class="table">

<thead>

<tr>

<th align="left"style="width: 50%">Company Details&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

<th align="left"style="width: 50%">Authorised Signatory&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>

</tr>

</thead>

<tbody>

<tr>

<td>Free Online Projects<br/>

HSDFC, XXXXXXXX<br/>

CurrentA/cno:5555XXXXXX<br/>

IFSC CODE:HDFCXXXXXXX<br/>

GST: SSSSXXXXXXX<br/>

PAN:SSSCCCXXXXX:<br/>

</td>

<td>My Customer<br></td>

</tr>

</tbody>

</table>

<!--<div class="row">

<div class="col-lg-12">

<h4>Terms & Conditions</h4>

<ol>

<li>Payment Terms: 30 days from delivery</li>

<li>Enter this order in accordance with the prices, terms, delivery method, and specifications listed above.</li>

<li>Please notify us immediately if you are unable to ship as specified.</li>

</ol>

</div>

</div> -->

<br>

<br>

<br>

<!-- <table width="30%" style="float:left;text-align:center;border:none;" align="left">

<tbody width='30%' style="border: none;">

<tr>

<td style="width:33%;border:none;">Sales coordinator<br>

Abdul mohsin</td>

<td style="width:33%;border: none;">country Manager<br>Khalid Akhter</td>

<td style="width:33%;border:none;">Finance Manager<br>Hafiz ahmed</td>

</tr>

</tbody>

</table> -->

<page_footer>

<div class="page_footer" style="border:none">

<div>

<div style="width:100%;text-align:center;color:#758DA6">

freeonlineprojects,some address,pin-76XXXX,phone:9000000XXX

</div>

</div>

</div>

</page_footer>

</page>

<?php

$content=ob_get_clean();

// convert in PDF

require_once(dirname(__FILE__).'/pdf/html2pdf.class.php');

try

{

$html2pdf =newHTML2PDF('P','A4','fr');

$html2pdf->writeHTML($content);

$html2pdf->Output('Invoice'.'.pdf');

}

catch(HTML2PDF_exception$e){

echo$e;

exit;

}

How can I export data from PHP to PDF?

We will use FPDF libs function to generate pdf file with header and footer..

Step 1: We will create employee table into MySQL database..

Step 2: Let's connect MySQL database with PHP. We will create connection. ... .

Step 3: We will create generate_pdf. php file and add below code..

Step 4: We will create index..

How do I make an invoice a PDF?

Create a PDF and share your invoice..

Click Tools and select Prepare Form..

Select your file. Acrobat will analyze your document to create a fillable PDF..

Add new form fields with the top toolbar..

Save your fillable PDF..

Share with your client for secure completion and signing..

How can generate invoice no in PHP?

Show activity on this post..

1 - 0000001 | 0000002 | 0000003 | 0000004 | 0000005. $dbValue = 1; echo $dbValue = str_pad($dbValue, 7, "0", STR_PAD_LEFT); // it will give 0000001;.

2 - F-0000001 | F-0000002 | F-0000003 | F-0000004 | F-0000005..

How do I create a PDF invoice in HTML?

Handlebars is an extension of Mustache that lets you build semantic templates easily..

Select PDF.co API v. ... .

Click JSON Under HTML Template..

cURL Request..

Use JSON Code to Create Invoice..

Generate the Invoice and Click Send..

Check Status..

Copy & Paste URL to Browser..

Video Tutorial: Generate PDF from HTML Templates..