本文整理匯總了PHP中mPDF::SetWatermarkImage方法的典型用法代碼示例。如果您正苦於以下問題:PHP mPDF::SetWatermarkImage方法的具體用法?PHP mPDF::SetWatermarkImage怎麽用?PHP mPDF::SetWatermarkImage使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類mPDF
的用法示例。
在下文中一共展示了mPDF::SetWatermarkImage方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: exportBill
/**
* @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;
}
}
示例2: pdf_echo
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);
}
示例3: mPDF
<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;
//==============================================================
//==============================================================
//==============================================================
示例4: elseif
' . $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 {
示例5: renderPDF
//.........這裏部分代碼省略.........
<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'));
}
}
示例6: firmo
<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();
?>
示例7: exporttopdf
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");*/
}
示例8: mPDF
<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;
//==============================================================
//==============================================================
//==============================================================