Search
 
SCRIPT & CODE EXAMPLE
 

PHP

How to create an Invoice with watermark FPDF

<?php
/*call the FPDF library*/
require('rotation.php');
class PDF extends PDF_Rotate
{
	function Header()
	{
		/* Put the watermark */
		$this->SetFont('Arial','B',50);
		$this->SetTextColor(255,192,203);
		$this->RotatedText(35,190,'Students Tutorial Invoice',45);
	}

	function RotatedText($x, $y, $txt, $angle)
	{
		/* Text rotated around its origin */
		$this->Rotate($angle,$x,$y);
		$this->Text($x,$y,$txt);
		$this->Rotate(0);
	}
}
	
$pdf=new PDF('P','mm','A4');
$pdf->AddPage();
/*output the result*/
$pdf->SetFont('Arial','B',20);
$pdf->Cell(71 ,10,'',0,0);
$pdf->Cell(59 ,5,'Invoice',0,0);
$pdf->Cell(59 ,10,'',0,1);

$pdf->SetFont('Arial','B',15);
$pdf->Cell(71 ,5,'WET',0,0);
$pdf->Cell(59 ,5,'',0,0);
$pdf->Cell(59 ,5,'Details',0,1);
/*set font to arial, regular, 12pt*/
$pdf->SetFont('Arial','',10);
$pdf->Cell(130 ,5,'Near DAV',0,0);
$pdf->Cell(25 ,5,'Customer ID:',0,0);
$pdf->Cell(34 ,5,'0012',0,1);/*end of line*/
$pdf->Cell(130 ,5,'Delhi, 751001',0,0);
$pdf->Cell(25 ,5,'Invoice Date:',0,0);
$pdf->Cell(34 ,5,'12th Jan 2019',0,1);
$pdf->Cell(130 ,5,'',0,0);
$pdf->Cell(25 ,5,'Invoice No:',0,0);
$pdf->Cell(34 ,5,'ORD001',0,1);
$pdf->SetFont('Arial','B',15);
$pdf->Cell(130 ,5,'Bill To',0,0);
$pdf->Cell(59 ,5,'',0,0);
$pdf->SetFont('Arial','B',10);
/*make a dummy empty cell as a vertical spacer*/
$pdf->Cell(189 ,10,'',0,1);
/*make a dummy empty cell as a vertical spacer*/
$pdf->Cell(50 ,10,'',0,1);

$pdf->SetFont('Arial','B',10);

$pdf->Cell(10 ,6,'Sl',1,0,'C');
$pdf->Cell(80 ,6,'Description',1,0,'C');
$pdf->Cell(23 ,6,'Qty',1,0,'C');
$pdf->Cell(30 ,6,'Unit Price',1,0,'C');
$pdf->Cell(20 ,6,'Sales Tax',1,0,'C');
$pdf->Cell(25 ,6,'Total',1,1,'C');
/*Heading Of the table end*/
$pdf->SetFont('Arial','',10);
    for ($i = 0; $i <= 10; $i++) {
		$pdf->Cell(10 ,6,$i,1,0);
		$pdf->Cell(80 ,6,'HP Laptop',1,0);
		$pdf->Cell(23 ,6,'1',1,0,'R');
		$pdf->Cell(30 ,6,'15000.00',1,0,'R');
		$pdf->Cell(20 ,6,'100.00',1,0,'R');
		$pdf->Cell(25 ,6,'15100.00',1,1,'R');
	}
		

$pdf->Cell(118 ,6,'',0,0);
$pdf->Cell(25 ,6,'Subtotal',0,0);
$pdf->Cell(45 ,6,'151000.00',1,1,'R');


$pdf->Output();

?>
Comment

PREVIOUS NEXT
Code Example
Php :: add column in exesting table 
Php :: php expire session for 1 month 
Php :: phpmailer valid cert 
Php :: jump to line phpstorm 
Php :: laravel model query time 
Php :: laravel title dynamic 
Php :: php iterate through objects 
Php :: dompdf setoptions breaks images 
Php :: can we generate alphanumeric 6 digit primary key in phpmyadmin 
Php :: wp_query not have term 
Php :: install php 5.5 ubuntu 20.05 
Php :: Maximum precision of float in PHP 
Php :: laravel gigapay delete invoice 
Php :: start day picker and end date picker in php 
Php :: TypeError IlluminateAuthSessionGuard::login(): Argument #1 ($user) must be of type IlluminateContractsAuthAuthenticatable 
Php :: how to import csv into database in laravel 
Php :: Namespace declaration statement has to be the very first statement or after any declare call in the script in file D:Xampphtdocsprojectsmulti_vender_siteappModelsUser.php on line 5 
Php :: function id codeigniter 3 
Php :: php exponential equation 
Php :: how to pass variable to an event listener laravel 
Php :: pivot null in livewire refresh 
Php :: auto complete order paid1 
Php :: laravel collection median 
Php :: push to aws instance ssh without using laravel 
Php :: laravel project preparation,laravel project create 
Php :: codeigniter sanitize array in php 
Php :: How to add page heading in FPDF PHP 
Php :: default time zone for europe php 
Php :: Set post views count using post meta 
Php :: itop cron.php 
ADD CONTENT
Topic
Content
Source link
Name
6+3 =