Example #1
0
 /**
  * @param array $info_warranty
  * @param array $info_car
  * @param array $info_bill
  * @param array $info_ss
  * @param $denpyoNo
  * @param null $savetype
  * @param null $watermark
  * @return bool|string
  * @throws \Exception
  */
 public function exportBill($info_warranty = [], $info_car = [], $info_bill = [], $info_ss = [], $denpyoNo = null, $savetype = null, $watermark = null)
 {
     $data = ['info_warranty' => $info_warranty, 'info_car' => $info_car, 'info_bill' => $info_bill, 'info_ss' => $info_ss];
     $stringTarget = Pdfbill::widget($data);
     $pdf = new \mPDF('ja', 'A4', 0, 'DejaVuSansCondensed', '4', '4', '5', '5', '4', '4');
     $pdf->WriteHTML($stringTarget);
     if ($watermark) {
         $pdf->SetWatermarkImage('../web/img/confidentiality.png', 0.6);
         $pdf->showWatermarkImage = true;
     }
     utilities::createFolder('data/pdf');
     //Create folder data/pdf
     if ($savetype == 'save') {
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return false;
         }
         $pdf->Output('data/pdf/' . $denpyoNo . '.pdf', 'F');
         if (file_exists('data/pdf/' . $denpyoNo . '.pdf')) {
             return true;
         }
     } else {
         utilities::createFolder('data/tmp');
         $name = 'draft-' . md5(uniqid(mt_rand(), true)) . '.pdf';
         $filename = "data/tmp/{$name}";
         $pdf->Output($filename, 'F');
         return $filename;
     }
 }
Example #2
0
<div>DIV: Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. </div>

<blockquote>Blockquote: Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus. Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus.</blockquote>

<address>Address: Vestibulum feugiat, orci at imperdiet tincidunt, mauris erat facilisis urna, sagittis ultricies dui nisl et lectus. Sed lacinia, lectus vitae dictum sodales, elit ipsum ultrices orci, non euismod arcu diam non metus.</address>

';
//==============================================================
//==============================================================
//==============================================================
include "../mpdf.php";
$mpdf = new mPDF('c');
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetWatermarkText('DRAFT');
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->showWatermarkText = true;
$mpdf->WriteHTML($html);
$mpdf->AddPage();
$mpdf->SetWatermarkImage('tiger.wmf', 1, '', array(160, 10));
$mpdf->showWatermarkImage = true;
$mpdf->WriteHTML('<h2>Using a Watermark as a Header</h2>');
$mpdf->WriteHTML($html);
$mpdf->AddPage();
$mpdf->SetWatermarkImage('tiger.wmf', 0.15, 'F');
$mpdf->WriteHTML('<h2>Using a Watermark Image as Background</h2>');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
//==============================================================
//==============================================================
//==============================================================
Example #3
0
        &nbsp;&nbsp;' . $plantilla['encabezadoRn6'] . '
    </p>
</div>
';
        $footer = '
<div align="center">
    <p style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: 10px;">
        ' . $plantilla['piePagRn1'] . '
        <br>
        ' . $plantilla['piePagRn2'] . '
    </p>
</div>
';
        $mpdf->SetHTMLHeader($header);
        $mpdf->SetHTMLFooter($footer);
        $mpdf->SetWatermarkImage('images/escudo.jpg', 0.15, 'P', 'F');
        $mpdf->showWatermarkImage = true;
        if ($conFirma == 'si') {
            $mpdf->WriteHTML($html);
        } elseif ($conFirma == 'no') {
            $mpdf->WriteHTML($htmlSinFirma);
        }
        $mpdf->Output('Oficios/Oficio_' . $noOficio . '.pdf', F);
        $Aux = "correcto";
        pagAux($Aux);
        exit;
    } else {
        $Aux = "error";
        pagAux($Aux);
    }
} else {
 /**
  * function is used for Purchase Receipts
  * @author Rohan Julka
  */
 public function renderPDF($transactionID = NULL)
 {
     $logoUrl = $this->webroot . 'img/logo_black.png';
     $paidLogo = $this->webroot . 'img/canstock12610992.jpg';
     if ($transactionID) {
         $txData = $this->Transaction->find('first', array('conditions' => array('Transaction.id' => $this->Encryption->decode($transactionID))));
         $amountPaid = $txData['Transaction']['amount_paid'];
         $discounts = 49.99 - $amountPaid;
         $discounts = number_format((double) $discounts, 2, '.', '');
         if (!empty($txData)) {
             $html = '
             <!DOCTYPE html>
             <html lang="en">
             <head>
             <meta charset="utf-8">
             <meta http-equiv="X-UA-Compatible" content="IE=edge">
             <meta name="viewport" content="width=device-width, initial-scale=1">
             <meta name="description" content="">
             <meta name="author" content="">
             <title>FoxHopr</title>
             <!--[if lt IE 9]>
             <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
             <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
             <![endif]-->
             </head>
             <body id="page-top" class="index">
         
             <style>
             .table-responsive {
             min-height: 0.01%;
             overflow-x: auto;
             }
             
             table.table > tbody > tr > td, .table > tbody > tr > th, table.table > tfoot > tr > td, table.table > tfoot > tr > th, table.table > thead > tr > td, table.table > thead > tr > th {
             
             border: 0.1mm solid #ddd;
             line-height: 1.42857;
             padding: 8px;
             vertical-align: top; text-align:left;font-family: "Times New Roman", Times, serif; fo
             }
             .items tbody,.items thead { border-top: 0.1mm solid #000000;}
             td { vertical-align: top; }
             .items td {
             border-top: 0.1mm solid #ddd;
             
             }
             table thead td {
             text-align: center;
             font-variant: small-caps;
             }
             
             .items td.totals {
             text-align: right;
             border: 0.1mm solid #000000;
             }
             .items td.cost {
             text-align: "." center;
             }                
             </style>
         
             <htmlpageheader name="myheader"> </htmlpageheader>
             
             <htmlpagefooter name="myfooter">
             
             <div style="border-top: 1px solid #000000; font-size: 9pt; text-align: center; padding-top: 3mm; ">
             Page {PAGENO} of {nb}
             </div>
             </htmlpagefooter>
             
             <sethtmlpageheader name="myheader" value="on" show-this-page="1" />
             <sethtmlpagefooter name="myfooter" value="on" />
             
             mpdf-->
             <table class="table items">
             <tr>
             <th scope="row" style="border-top:0"><a href="' . Router::url('/') . '"><img src="' . $logoUrl . '" style="float:left;display:inline-block;text-align:left;width:30%;"></a></th>
              
             </tr>
             </table>
             <table class="table table-bordered items" width="100%" style="width:700px; margin:0 auto;font-size: 13pt; border-collapse: collapse; ">
             <thead>
             <tr>
             <th style=" border-top:0"></th>
             <td  style=" border-top:0"></td>
             
             <th  style=" text-align:right; border-top:0;padding-bottom:10px;padding-right:5px;">Receipt</th>
             </tr>
             
             
             </thead>
             <tbody>
             <tr >
          
             <td style="padding-top:30px;padding-left:5px;"><strong>Billed to:</strong></td>
             <td style="padding-top:30px;"></td>
             <td style="text-align:right;padding-top:30px;line-height:25px;padding-right:5px;"><strong>Receipt Date:</strong> ' . date('M d, Y', strtotime($txData['Transaction']['created'])) . '<br>
             </td>
             </tr>
             <tr style="border:none;">
              
             <td style="padding-top:2px;"></td>
             <td style="padding-top:2px;"></td>
             <td style="padding-top:2px;"></td>
             </tr>
             
             <tr style="border:none;">
             <td class="bt" style="padding-left:5px;">' . $txData['BusinessOwner']['email'] . '<br>
             ' . $txData['BusinessOwner']['fname'] . ' ' . $txData['BusinessOwner']['lname'] . '<br>';
             if (!empty($txData['BusinessOwner']['address'])) {
                 $html .= ucfirst($txData['BusinessOwner']['address']);
             }
             if ($txData['BusinessOwner']['address'] != '' && $txData['BusinessOwner']['city'] != '') {
                 $html .= ', ';
             }
             if (!empty($txData['BusinessOwner']['city'])) {
                 $html .= ucfirst($txData['BusinessOwner']['city']);
             }
             $html .= '
             </td>
             <td class="bt"></td>
             <td class="bt"></td>
             
             </tr>
         
             <tr style="border:none;border-bottom:1px solid #ddd;">
             <td class="bt" style="padding-bottom:10px;padding-left:5px;">' . $txData['State']['state_subdivision_name'] . ' ' . $txData['BusinessOwner']['zipcode'] . '<br>
             ' . $txData['Country']['country_name'] . '
             </td>
             <td class="bt"></td>
             <td class="bt"></td>
             
             </tr>
             <tr>
             <th style="text-align:left;padding-bottom:20px;padding-left:5px;width:40%;">Membership Plan</th>
             <th style="text-align:left;padding-bottom:20px;width:20%;">Discount</th>
             <th style="text-align:right;padding-bottom:20px;width:40%;padding-right:5px;">Price</th>
             </tr>
             
             
             <tr>
             <td style="padding-bottom:40px;padding-left:5px;padding-left:5px;padding-right:5px;">' . ucfirst($txData['Transaction']['group_type']) . '</td>
             <td style="padding-bottom:40px;padding-right:5px;">$' . $discounts . '</td>
             <td style="text-align:right;padding-bottom:40px;padding-right:5px;">$49.99</td>
             
             </tr>
             
             <tr>
         
             <td></td>
             <td></td>
             <td style="text-align:right;line-height:25px;"><b>Total: $' . $amountPaid . '</b> </td>                
             </tr>
             
             </tbody>
             </table>
             </body>
             </html>';
             $mpdf = new mPDF('c', 'A4', '', '', 15, 15, 30, 25, 10, 10);
             $mpdf->SetProtection(array('print'));
             $mpdf->SetTitle("FOXHOPR - Invoice");
             $mpdf->SetAuthor("FOXHOPR");
             $mpdf->SetDisplayMode('fullpage');
             /*$mpdf->SetWatermarkText('PAID');
               $mpdf->watermark_font = 'DejaVuSansCondensed';*/
             $mpdf->showWatermarkImage = true;
             $mpdf->SetWatermarkImage('http://10.10.12.69/foxhopr_testing/img/watermark.jpg', 0.15, 'F');
             //$mpdf->showWatermarkText = true;
             $mpdf->WriteHTML($html);
             $mpdf->Output();
             exit;
         } else {
             $this->Session->setFlash('Invalid Transaction ID', 'Front/flash_bad');
             $this->redirect(array('action' => 'purchaseReceipts'));
         }
     } else {
         $this->Session->setFlash('Invalid Transaction ID', 'Front/flash_bad');
         $this->redirect(array('action' => 'purchaseReceipts'));
     }
 }
Example #5
0
                <p>e para clareza firmo(amos) o presente.</p>
                <p class='direita'>Ribeirão Preto,".date("d/m/Y")."</p>
                <p>Assinatura ......................................................................................................................................</p>
                <p>Nome <strong>Hugo Lopes</strong> CPF/CNPJ: <strong>437.706.058-962</strong></p>
                <p>Endereço <strong>Rua da Penha, 200 - Jd. Alguma Coisa - São Paulo</strong></p>
         </fieldset>";
        //instanciamos nossa classe mPDF
        $mpdf=new mPDF();
        //definimos o tipo de exibicao
        $mpdf->SetDisplayMode('fullpage');
        //definimos estilos de fonts
        $mpdf->useOnlyCoreFonts = true;
        $mpdf->watermark_font = 'DejaVuSansCondensed';
        //definimos se vamos exibir a marca d'agua
        $mpdf->showWatermarkText = false;
        $mpdf->SetWatermarkText('Marca d\'agua');
        //colocamos um icone de logo tipo no pdf 
        $mpdf->SetWatermarkImage('icones/logoif.png', 1, '', array(140,10));
        //definimos se sera exibido ou nao o logo no pdf
        $mpdf->showWatermarkImage = true;
        //escrve o titulo de nosso pdf
        $mpdf->WriteHTML('<br/><h1>Titulo do PDF</h1><hr/>');
        //definimos oque vai conter no rodape do pdf
        $mpdf->SetFooter('{DATE j/m/Y  H:i}||Pagina {PAGENO}/{nb}');
        //e finalmente escrevemos todo nosso conteudo no pdf para exibir
        $mpdf->WriteHTML($html);
        //fechamos nossa instancia ao pdf
        $mpdf->Output();
        //pausamos a tela para exibir o que foi feito
        exit();
?>
	protected function exporttopdf($title,$filename,$html)
	{

		$org_data=Organization::model()->findAll();

		foreach($org_data as $as=>$row)
		{
			$org=$row['organization_id'];
		}
				
		$mpdf=Yii::app()->ePdf->mpdf();
        	$mpdf=Yii::app()->ePdf->mpdf('', 'A4',0,'',15,15,25,16,4,9,'P');
		$mpdf = new mPDF('', 'A4',0,'',15,15,30,20,4,9,'P');
		ob_clean();
		ob_clean();
		$org = Organization::model()->findAll();
		$org_image=CHtml::link(CHtml::image(Yii::app()->controller->createUrl('/site/loadImage', array('id'=>$org[0]['organization_id'])),'No Image',array('width'=>130,'height'=>70))); 
		$org_name=$org[0]['organization_name'];
		$org_add=$org[0]['address_line1']."<br/>".$org[0]['address_line2']."<br/>";
		$mpdf->SetHTMLHeader('<table style="border-bottom:1.6px solid #74b9fo;border-top:hidden;border-left:hidden;border-right:hidden;width:100%;"><tr style="border:hidden"><td vertical-align="center" style="width:35px;border:hidden" align="left">'.$org_image.'</td><td style="border:hidden"><b style="font-size:22px;">'.$org_name.'</b><br/><span style="font-size:10.2px">'.$org_add.'</td></tr></table>');
		$mpdf->SetWatermarkImage('images/rudraSoftech.png',0.3, '');
		$mpdf->showWatermarkImage = true;
$arr = array (
  'odd' => array (
    'L' => array (
      'content' => $title,
      'font-size' => 10,
      'font-style' => 'B',
      'font-family' => 'serif',
      'color'=>'#27292b'
    ),
    'C' => array (
      'content' => 'Page - {PAGENO}/{nbpg}',
      'font-size' => 10,
      'font-style' => 'B',
      'font-family' => 'serif',
      'color'=>'#27292b'
    ),
    'R' => array (
      'content' => 'Printed @ {DATE j-m-Y H:m}',
      'font-size' => 10,
      'font-style' => 'B',
      'font-family' => 'serif',
      'color'=>'#27292b'
    ),
    'line' => 1,
  ),
  'even' => array ()
);

		$mpdf->SetFooter($arr);

		$mpdf->WriteHTML('<sethtmlpageheader name="main" page="ALL" value="on" show-this-page="1">');
		$mpdf->WriteHTML($html);
		$mpdf->Output($filename,"I");
 	

		

/*		Yii::import('application.extensions.tcpdf.*');
		require_once('tcpdf/tcpdf.php');
		require_once('tcpdf/config/lang/eng.php');

		 ob_clean();
		$pdf = new TCPDF();
		$pdf->SetCreator(PDF_CREATOR);
		$pdf->SetAuthor(Yii::app()->name);
		$pdf->SetTitle($title);
		$pdf->SetSubject($title);
		$pdf->SetKeywords('example, text, report');
		$pdf->SetHeaderData('', 0, $title, '');
		//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, "");
		$pdf->setHeaderFont(Array('helvetica', '', 8));
		$pdf->setFooterFont(Array('helvetica', '', 6));
		$pdf->SetMargins(15, 18, 15);
		$pdf->SetHeaderMargin(5);
		$pdf->SetFooterMargin(10);
		$pdf->SetAutoPageBreak(TRUE, 15);
		$pdf->SetFont('dejavusans', '', 7);
		$resolution= array(150, 150);
		$pdf->AddPage('P', $resolution);
		$pdf->writeHTML($html, true, false, true, false, '');
		$pdf->LastPage();
		$pdf->Output($filename, "I");*/
	}
Example #7
0
<blockquote>Blockquote: Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus. Maecenas arcu justo, malesuada eu, dapibus ac, adipiscing vitae, turpis. Fusce mollis. Aliquam egestas. In purus dolor, facilisis at, fermentum nec, molestie et, metus.</blockquote>

<address>Address: Vestibulum feugiat, orci at imperdiet tincidunt, mauris erat facilisis urna, sagittis ultricies dui nisl et lectus. Sed lacinia, lectus vitae dictum sodales, elit ipsum ultrices orci, non euismod arcu diam non metus.</address>

';
//==============================================================
//==============================================================
//==============================================================
include "../mpdf.php";
$mpdf = new mPDF('c');
$mpdf->SetDisplayMode('fullpage');
/*$mpdf->SetWatermarkText('DRAFT');
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->showWatermarkText = true;*/
$mpdf->WriteHTML($html);
$mpdf->AddPage();
//$mpdf->SetWatermarkImage('tiger.wmf', 1, '', array(160,10));
$mpdf->SetWatermarkImage('escudo.jpg', 0.15, '', array(1, 80));
$mpdf->showWatermarkImage = true;
$mpdf->WriteHTML('<h2>Using a Watermark as a Header</h2>');
$mpdf->WriteHTML($html);
$mpdf->AddPage();
$mpdf->SetWatermarkImage('escudo.jpg', 0.15, 'P', 'F');
//ESTE ES EL CGIDOOOOOOOOOO
$mpdf->WriteHTML('<h2>Using a Watermark Image as Background</h2>');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
//==============================================================
//==============================================================
//==============================================================
Example #8
-1
function pdf_echo($filename = "")
{
    global $__pdf_html, $__pdf_orientation, $__pdf_wm_text, $__pdf_wm_img, $__pdg_pgn_pos, $__pdf_title, $__pdf_subject, $__pdf_author, $__pdf_creator, $__pdf_keywords, $__pdf_wm_talpha, $__pdf_wm_font, $__pdf_wm_ialpha, $__pdf_pgn_text, $__pdf_pgn_pos, $__pdf_pgn_oalign, $__pdf_pgn_ealign, $__pdf_pgn_show, $__pdf_pgn_fcolor, $__pdf_pgn_ftype, $__pdf_pgn_fsize, $__pdf_pgn_fstyle, $__pdf_pgn_lstyle, $__pdf_pgn_lwidth, $__pdf_pgn_lcolor, $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f;
    require_once dirname(__FILE__) . "/__RES__/mpdf.php";
    $pdf = new mPDF("th");
    $pdf->useOddEven = 1;
    if ($__pdf_pgn_show) {
        $dv1 = "<div style=\"{$__pdf_pgn_fcolor};width:auto;text-align:";
        $dv2 = ";{$__pdf_pgn_ftype}{$__pdf_pgn_fsize}{$__pdf_pgn_fstyle}";
        $dv3 = "style:{$__pdf_pgn_lstyle};";
        $dv4 = "width:{$__pdf_pgn_lwidth};";
        $dv5 = "color:{$__pdf_pgn_lcolor};";
        $dv6 = "\">{$__pdf_pgn_text}</div>";
        if ($__pdf_pgn_pos == "TOP") {
            $align = $__pdf_pgn_oalign;
            $border = "border-bottom-";
            $pgh_o = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
            $pdf->DefHTMLHeaderByName("ho", $pgh_o);
            $align = $__pdf_pgn_ealign;
            $pgh_e = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
            $pdf->DefHTMLHeaderByName("he", $pgh_e);
            $pdf->AddPage($__pdf_orientation, '', '', '', '', $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f, 'html_ho', 'html_he', '', '', 1, 1, 0, 0);
        } else {
            if ($__pdf_pgn_pos == "BOTTOM") {
                $align = $__pdf_pgn_oalign;
                $border = "border-top-";
                $pgf_o = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
                $pdf->DefHTMLFooterByName("fo", $pgf_o);
                $align = $__pdf_pgn_ealign;
                $pgf_e = "{$dv1}{$align}{$dv2}{$border}{$dv3}{$border}{$dv4}{$border}{$dv5}{$dv6}";
                $pdf->DefHTMLFooterByName("fe", $pgf_e);
                $pdf->AddPage($__pdf_orientation, '', '', '', '', $__pdf_pgmargin_l, $__pdf_pgmargin_r, $__pdf_pgmargin_t, $__pdf_pgmargin_b, $__pdf_pgmargin_h, $__pdf_pgmargin_f, '', '', 'html_fo', 'html_fe', 0, 0, 1, 1);
            }
        }
    } else {
        $pdf->AddPage($__pdf_orientation);
    }
    $pdf->SetTitle($__pdf_title);
    $pdf->SetAuthor($__pdf_author);
    $pdf->SetCreator($__pdf_creator);
    $pdf->SetSubject($__pdf_subject);
    $pdf->SetKeywords($__pdf_keywords);
    if ($__pdf_wm_text != "") {
        $pdf->SetWatermarkText($__pdf_wm_text, $__pdf_wm_talpha);
        $pdf->showWatermarkText = true;
        if ($__pdf_wm_font) {
            $pdf->watermark_font = $__pdf_wm_font;
        }
    }
    if (file_exists($__pdf_wm_img)) {
        $pdf->SetWatermarkImage($__pdf_wm_img, $__pdf_wm_ialpha);
        $pdf->showWatermarkImage = true;
    }
    $pdf->WriteHTML($__pdf_html);
    $pdf->Output($filename, $dest);
}