本文整理汇总了PHP中mPDF::SetProtection方法的典型用法代码示例。如果您正苦于以下问题:PHP mPDF::SetProtection方法的具体用法?PHP mPDF::SetProtection怎么用?PHP mPDF::SetProtection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mPDF
的用法示例。
在下文中一共展示了mPDF::SetProtection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pdf
public function pdf($content, $namafile, $paper_size = '', $orientation = 'P', $border = true, $title = '', $subject = '', $mode = 'D', $watermark = false)
{
$margin = 20;
$namafile = preg_replace('/\\.pdf$/', '', $namafile);
$mL = $mR = $mT = $mB = $margin;
// $mB = $margin + 50;
$mH = 0;
$mF = 0;
if (!$paper_size) {
$paper_size = array(215, 330);
}
Yii::import('system.docotel.cms.extensions.mpdf.mPDF');
$mpdf = new mPDF('', $paper_size, 0, '', $mL, $mR, $mT, $mB, $mH, $mF, $orientation);
$mpdf->SetDefaultFont('Arial');
$mpdf->SetProtection(array('print', 'print-highres'), '', md5(time()), 128);
$mpdf->SetTitle($title);
$mpdf->SetAuthor('Makarim & Taira');
$mpdf->SetCreator('News');
$mpdf->SetSubject($subject);
$mpdf->h2toc = array('H4' => 0, 'H5' => 1);
//$mpdf->setFooter('{PAGENO}');
// $stylesheet = file_get_contents(Yii::app()->getBaseUrl(true).'/themes/flatlab/assets/css/bootstrap.min.css'); // external css
// $mpdf->WriteHTML($stylesheet,1);
// echo $content; exit;
$mpdf->WriteHTML($content);
$mpdf->Output($namafile . '.pdf', $mode);
if ($mode === 'D' or $mode === 'I') {
exit;
}
}
示例2: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
if (!empty($cfg)) {
foreach ($cfg as $key => $value) {
Config::set('pdf.' . $key, $value);
}
}
$mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.Footer'), Config::get('pdf.orientation'));
$permissions = [];
foreach (Config::get('pdf.protection.permissions') as $perm => $enable) {
if ($enable) {
$permissions[] = $perm;
}
}
$mpdf->SetProtection($permissions, Config::get('pdf.protection.user_password'), Config::get('pdf.protection.owner_password'), Config::get('pdf.protection.length'));
$mpdf->SetTitle(Config::get('pdf.title'));
$mpdf->SetAuthor(Config::get('pdf.author'));
$mpdf->SetWatermarkText(Config::get('pdf.watermark'));
$mpdf->showWatermarkText = Config::get('pdf.showWatermark');
$mpdf->watermark_font = Config::get('pdf.watermarkFont');
$mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha');
$mpdf->SetDisplayMode(Config::get('pdf.displayMode'));
return $mpdf;
});
return new PdfWrapper($app['mpdf.pdf']);
});
}
示例3: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
if ($cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
$mpdf = new \mPDF($cfg[0], $cfg[1], $cfg[2], $cfg[3], $cfg[4], $cfg[5], $cfg[6], $cfg[7], $cfg[8], $cfg[9], $cfg[10]);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("");
$mpdf->SetAuthor("");
$mpdf->SetWatermarkText("");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
return $mpdf;
});
} else {
$mpdf = new \mPDF('th', 'A4', '', '', 10, 10, 10, 10, 10, 5);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("");
$mpdf->SetAuthor("");
$mpdf->SetWatermarkText("");
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$app['mpdf.pdf'] = $mpdf;
}
return new PdfWrapper($app['mpdf.pdf']);
});
// // work --------------------------------------------------------------------------start ----------
// $this->app['mpdf.pdf'] = $this->app->share(function($app)
// {
// // $cfg =['th','A0','','',10,10,10,10,10,5,'L'];
// $cfg = $app['config']['mpdfconfig.pdf.options'];
// consolelog('cfg',$cfg);
// if($cfg) {
// $mpdf = new \mPDF( $cfg[0],$cfg[1],$cfg[2],$cfg[3],$cfg[4],$cfg[5],$cfg[6],$cfg[7],$cfg[8],$cfg[9],$cfg[10] );
// } else {
// $mpdf=new \mPDF('th','A4','','',10,10,10,10,10,5);
// }
// $mpdf->SetProtection(array('print'));
// $mpdf->SetTitle("TOMATO POS - Invoice");
// $mpdf->SetAuthor("Thongchai Lim");
// $mpdf->SetWatermarkText("Paid");
// $mpdf->showWatermarkText = true;
// $mpdf->watermark_font = 'DejaVuSansCondensed';
// $mpdf->watermarkTextAlpha = 0.1;
// $mpdf->SetDisplayMode('fullpage');
// return $mpdf;
// });
// $this->app['mpdf.wrapper'] = $this->app->share(function($app)
// {
// return new PdfWrapper($app['mpdf.pdf']);
// });
// // work --------------------------------------------------------------------------end----------
}
示例4: createMpdfInstance
/**
* @param array $options Options for mPDF.
* @return \mPDF
*/
protected function createMpdfInstance($options)
{
$tempDir = sys_get_temp_dir() . '/mpdf';
is_dir($tempDir) or mkdir($tempDir);
defined('_MPDF_TEMP_PATH') or define('_MPDF_TEMP_PATH', $tempDir);
$mpdf = new \mPDF(isset($options['lang']) ? $options['lang'] : static::DEFAULT_LANGUAGE, isset($options['format']) ? $options['format'] : static::DEFAULT_PAGE_FORMAT, isset($options['fontSize']) ? $options['fontSize'] : static::DEFAULT_FONT_SIZE, isset($options['font']) ? $options['font'] : static::DEFAULT_FONT, isset($options['marginLeft']) ? $options['marginLeft'] : static::DEFAULT_MARGIN, isset($options['marginRight']) ? $options['marginRight'] : static::DEFAULT_MARGIN, isset($options['marginTop']) ? $options['marginTop'] : static::DEFAULT_MARGIN, isset($options['marginBottom']) ? $options['marginBottom'] : static::DEFAULT_MARGIN, isset($options['marginHeader']) ? $options['marginHeader'] : static::DEFAULT_MARGIN, isset($options['marginFooter']) ? $options['marginFooter'] : static::DEFAULT_MARGIN, isset($options['orientation']) ? $options['orientation'] : static::DEFAULT_ORIENTATION);
$mpdf->SetDisplayMode('fullpage', 'two');
$mpdf->SetProtection(['copy', 'print', 'print-highres'], null, uniqid(), 128);
return $mpdf;
}
示例5: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
// load config
$this->mergeConfigFrom(__DIR__ . '/../../config/pdf.php', 'pdf');
// bind wrapper
$this->app->bind('mpdf.wrapper', function ($app, $cfg) {
$app['mpdf.pdf'] = $app->share(function ($app) use($cfg) {
if (!empty($cfg)) {
foreach ($cfg as $key => $value) {
Config::set('pdf.' . $key, $value);
}
}
$mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.format'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.marginFooter'), Config::get('pdf.orientation'));
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle(Config::get('pdf.title'));
$mpdf->SetAuthor(Config::get('pdf.author'));
$mpdf->SetWatermarkText(Config::get('pdf.watermark'));
$mpdf->showWatermarkText = Config::get('pdf.showWatermark');
$mpdf->watermark_font = Config::get('pdf.watermarkFont');
$mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha');
$mpdf->SetDisplayMode(Config::get('pdf.displayMode'));
return $mpdf;
});
return new PdfWrapper($app['mpdf.pdf']);
});
}
示例6: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->package('kendu/l4-mpdf');
$this->app['mpdf.pdf'] = $this->app->share(function ($app) {
$base = $app['config']->get('l4-mpdf::config.pdf.base');
$options = $app['config']->get('l4-mpdf::config.pdf.options');
$mpdf = new \mPDF(Config::get('pdf.mode'), Config::get('pdf.defaultFontSize'), Config::get('pdf.defaultFont'), Config::get('pdf.marginLeft'), Config::get('pdf.marginRight'), Config::get('pdf.marginTop'), Config::get('pdf.marginBottom'), Config::get('pdf.marginHeader'), Config::get('pdf.Footer'), Config::get('pdf.orientation'));
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle(Config::get('pdf.title'));
$mpdf->SetAuthor(Config::get('pdf.author'));
$mpdf->SetWatermarkText(Config::get('pdf.watermark'));
$mpdf->showWatermarkText = Config::get('pdf.showWatermark');
$mpdf->watermark_font = Config::get('pdf.watermarkFont');
$mpdf->watermarkTextAlpha = Config::get('pdf.watermarkTextAlpha');
$mpdf->SetDisplayMode(Config::get('pdf.displayMode'));
return $mpdf;
});
$this->app['mpdf.wrapper'] = $this->app->share(function ($app) {
return new PdfWrapper($app['mpdf.pdf']);
});
}
示例7: register
/**
* Register the service provider.
*
* @return void
*/
public function register()
{
$this->package('shinomontaz/l4-mpdf');
if ($this->app['config']->get('l4-mpdf::config.pdf.enabled')) {
$this->app['mpdf.pdf'] = $this->app->share(function ($app) {
$base = $app['config']->get('l4-mpdf::config.pdf.base');
$options = $app['config']->get('l4-mpdf::config.pdf.options');
$mpdf = new \mPDF('win-1252', 'A4', '', '', 10, 10, 40, 35, 10, 5);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("Acme Trading Co. - Invoice");
$mpdf->SetAuthor("Acme Trading Co.");
$mpdf->SetWatermarkText("Paid");
$mpdf->showWatermarkText = false;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
return $mpdf;
});
$this->app['mpdf.wrapper'] = $this->app->share(function ($app) {
return new PdfWrapper($app['mpdf.pdf']);
});
}
}
示例8: testPDF
//.........这里部分代码省略.........
<sethtmlpagefooter name="myfooter" value="on" />
mpdf-->
<table class="table items">
<tr>
<th scope="row" style="border-top:0"><img src="' . $logoUrl . '" style="float:left;display:inline-block;text-align:left;"></th>
</tr>
</table>
<table class="table table-bordered items" width="100%" style="width:800px; margin: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;">Receipt</th>
</tr>
</thead>
<tbody>
<tr >
<td style="padding-top:30px;"><strong>Billed to:</strong></td>
<td style="padding-top:30px;"></td>
<td style="text-align:right;padding-top:30px;line-height:25px;"><strong>Receipt Date</strong> Sep 10. 2015<br>
Order Total: &15.99 </td>
</tr>
<tr style="border:none;">
<td style="padding-top:20px;"></td>
<td style="padding-top:20px;"></td>
<td style="padding-top:20px;"></td>
</tr>
<tr style="border:none;">
<td class="bt">tmara@gmail.com<br>
Tamara Miller<br>
44-61 11th Street
</td>
<td class="bt"></td>
<td class="bt"></td>
</tr>
<tr style="border:none;">
<td style="padding-top:20px;"> </td>
<td style="padding-top:20px;"></td>
<td style="padding-top:20px;"></td>
</tr>
<tr style="border:none;border-bottom:1ps solid #ddd;">
<td class="bt" style="padding-bottom:10px;">lic.NY 11101<br>
United States of America
</td>
<td class="bt"></td>
<td class="bt"></td>
</tr>
<tr>
<th style="text-align:left;padding-bottom:20px;">Item Number</th>
<th style="text-align:left;padding-bottom:20px;">Description</th>
<th style="text-align:right;padding-bottom:20px;">Price</th>
</tr>
<tr>
<td style="padding-bottom:40px;">1 </td>
<td style="padding-bottom:40px;">Pro Plus Account</td>
<td style="text-align:right;padding-bottom:40px;">$15.99</td>
</tr>
<tr>
<td></td>
<td></td>
<td style="text-align:right;line-height:25px;">Sales Tax: $0.00 <br>
<b>Order Total: $15.99</b> </td>
</tr>
</tbody>
</table>
</body>
</html>
';
$mpdf = new mPDF('c', 'A4', '', '', 20, 15, 48, 25, 10, 10);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("FOXHOPR - Invoice");
$mpdf->SetAuthor("FOXHOPR");
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output();
exit;
}
示例9: generate
public function generate($payment_id)
{
$this->data['payment_id'] = $payment_id;
$payment_info = $this->payment->getPayment($payment_id);
if ($payment_info) {
if ($this->ion_auth->is_customer() || $this->input->get_post('view') == 'customer') {
$user_id = $payment_info->retailer_id;
} else {
$user_id = $payment_info->depot_id;
}
$this->data['payment_info'] = $payment_info;
$user_info = $this->ion_auth->getSimbanicUser($user_id);
$this->data['user_info'] = $user_info;
$invoice_month = date("M", strtotime($payment_info->confirm_date));
$pdfFilePath = $invoice_month . '_' . $user_info->full_name . '_' . $user_info->customer_id . '_' . $payment_info->id . ".pdf";
//load mPDF library
$this->load->library('m_pdf');
$pdf = $this->m_pdf->load();
$mpdf = new mPDF('c', 'A4', '', '', 20, 15, 38, 25, 10, 10);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("Walart Pharmaceutical. - Payment Receipt");
$mpdf->SetAuthor("Walart Pharmaceutical.");
$mpdf->SetDisplayMode('fullpage');
$header = $this->load->view(BACKEND . '/payment/generate/header', $this->data, true);
$footer = $this->load->view(BACKEND . '/payment/generate/footer', $this->data, true);
$html = $this->load->view(BACKEND . '/payment/generate', $this->data, true);
$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLFooter($footer);
$mpdf->WriteHTML($html);
$mpdf->Output($pdfFilePath, "D");
} else {
redirect_backend_url('invoice');
}
}
示例10: generate
/**
* Generate the PDF file using the mPDF library.
*
* @param string $html
* contents of the template already with the node data.
* @param string $filename
* name of the PDF file to be generated.
*/
public function generate($html, $config, $filename = 'newPdfDocument')
{
// International Paper Sizes ( width x height).
$paper_size = array('4A0' => array('w' => 1682, 'h' => 2378), '2A0' => array('w' => 1189, 'h' => 1682), 'A0' => array('w' => 841, 'h' => 1189), 'A1' => array('w' => 594, 'h' => 841), 'A2' => array('w' => 420, 'h' => 594), 'A3' => array('w' => 297, 'h' => 420), 'A4' => array('w' => 210, 'h' => 297), 'A5' => array('w' => 148, 'h' => 210), 'A6' => array('w' => 105, 'h' => 148), 'A7' => array('w' => 74, 'h' => 105), 'A8' => array('w' => 52, 'h' => 74), 'A9' => array('w' => 37, 'h' => 52), 'A10' => array('w' => 26, 'h' => 37), 'B0' => array('w' => 1000, 'h' => 1414), 'B1' => array('w' => 707, 'h' => 1000), 'B2' => array('w' => 500, 'h' => 707), 'B3' => array('w' => 353, 'h' => 500), 'B4' => array('w' => 250, 'h' => 353), 'B5' => array('w' => 176, 'h' => 250), 'B6' => array('w' => 125, 'h' => 176), 'B7' => array('w' => 88, 'h' => 125), 'B8' => array('w' => 62, 'h' => 88), 'B9' => array('w' => 44, 'h' => 62), 'B10' => array('w' => 31, 'h' => 44), 'C0' => array('w' => 917, 'h' => 1297), 'C1' => array('w' => 648, 'h' => 917), 'C2' => array('w' => 458, 'h' => 648), 'C3' => array('w' => 324, 'h' => 458), 'C4' => array('w' => 229, 'h' => 324), 'C5' => array('w' => 162, 'h' => 229), 'C6' => array('w' => 114, 'h' => 162), 'C7' => array('w' => 81, 'h' => 114), 'C8' => array('w' => 57, 'h' => 81), 'C9' => array('w' => 40, 'h' => 57), 'C10' => array('w' => 28, 'h' => 40), 'RA0' => array('w' => 860, 'h' => 1220), 'RA1' => array('w' => 610, 'h' => 860), 'RA2' => array('w' => 430, 'h' => 610), 'SRA0' => array('w' => 900, 'h' => 1280), 'SRA1' => array('w' => 640, 'h' => 900), 'SRA2' => array('w' => 450, 'h' => 640), 'Letter' => array('w' => 215.9, 'h' => 279.4), 'Legal' => array('w' => 215.9, 'h' => 355.6), 'Ledger' => array('w' => 279.4, 'h' => 431.8));
$page = $config['page_type'];
//conf
$font_size = $config['font_size'];
$font_style = $config['font_style'];
// DEFAULT PDF margin Values.
$margin_top = $config['margin_top'];
//conf
$margin_right = $config['margin_right'];
$margin_bottom = $config['margin_bottom'];
$margin_left = $config['margin_left'];
$margin_header = $config['margin_header'];
$margin_footer = $config['margin_footer'];
// Creating Instance of mPDF Class Library.
require_once 'Src/Modules/Pdf/Libs/mpdf60/mpdf.php';
$mpdf = new \mPDF('', array($paper_size[$page]['w'], $paper_size[$page]['h']), $font_size, $font_style, $margin_left, $margin_right, $margin_top, $margin_bottom, $margin_header, $margin_footer);
// set document DPI
$mpdf->dpi = 96;
// Set image DPI
$mpdf->img_dpi = 96;
// Enabling header option if available.
$header = $config['header'];
//string in conf
if (isset($header) && $header != NULL) {
//$header = token_replace($header);
$mpdf->SetHTMLHeader($header);
}
// Enabling Footer option if available.
$footer = $config['footer'];
if (isset($footer) && $footer != NULL) {
//$footer = token_replace($footer);
$mpdf->SetHTMLFooter($footer);
}
// Setting Watermark Text to PDF.
$watermark_option = 'text';
//conf
$watermark_opacity = $config['watermark_opacity'];
// For watermark Text.
if ($watermark_option == 'text') {
$text = $config['watermark_text'];
if (isset($text) && $text != NULL) {
$mpdf->SetWatermarkText($text, $watermark_opacity);
$mpdf->showWatermarkText = TRUE;
}
}
// Setting Title to PDF.
$title = $config['doc_title'];
if (isset($title) && $title != NULL) {
$mpdf->SetTitle($title);
}
// Setting Author to PDF.
$author = $config['doc_author'];
//conf
if (isset($author) && $author != NULL) {
$mpdf->SetAuthor($author);
}
// Setting Subject to PDF.
$subject = $config['doc_subject'];
if (isset($subject) && $subject != NULL) {
$mpdf->SetSubject($subject);
}
// Setting creator to PDF.
$creator = $config['doc_creator'];
if (isset($creator) && $creator != NULL) {
$mpdf->SetCreator($creator);
}
// Setting Password to PDF.
$password = $config['password'];
if (isset($password) && $password != NULL) {
// Print and Copy is allowed.
$mpdf->SetProtection(array('print', 'copy'), $password, $password);
}
// Setting CSS stylesheet to PDF.
if (!empty($config['stylesheets'])) {
$cssArr = explode('<br />', nl2br($config['stylesheets']));
$cssArr = array_map('trim', $cssArr);
$cssArr = array_filter($cssArr);
foreach ($cssArr as $key => $stylesheet) {
$stylesheet_content = NULL;
if (isset($stylesheet) && $stylesheet != NULL) {
$stylesheet_content = file_get_contents($stylesheet);
$mpdf->WriteHTML($stylesheet_content, 1);
}
}
}
// Writing html content for pdf buffer.
$mpdf->WriteHTML($html);
return $mpdf->Output($filename . '.pdf', $config['save_option']);
}
示例11: 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'));
}
}
示例12: htmlToPdf
public function htmlToPdf($srcHTML, $destPDF = null, $styles = array(), $fromFile = true, $mpdfParams = array())
{
$html = '';
if ($fromFile) {
if (!$destPDF) {
$destPDF = $srcHTML . '.pdf';
}
$html = file_get_contents($srcHTML);
} else {
$html = $srcHTML;
}
$p = array_replace(array('', 'A4', '', '', 10, 10, 10, 10, 10, 10), $mpdfParams);
$mpdf = new \mPDF($p[0], $p[1], $p[2], $p[3], $p[4], $p[5], $p[6], $p[7], $p[8], $p[9]);
$mpdf->useOnlyCoreFonts = true;
$mpdf->SetProtection(array('print'));
$mpdf->SetDisplayMode('fullpage');
foreach ($styles as $style) {
$mpdf->WriteHTML(file_get_contents($style), 1);
}
$mpdf->WriteHTML($html, 2);
$mpdf->Output($destPDF, 'F');
return $destPDF;
}
示例13: mPDF
if (strpos(strtolower($name), ".pdf") === FALSE) {
$name .= ".pdf";
}
// Main PDF Object
$mpdf = new mPDF('utf-8', array($paper_width, $paper_height), 10, 'tahoma', $margin_right, $margin_left, $margin_top, $margin_bottom, $margin_header, $margin_footer);
$mpdf -> SetDirectionality('rtl');
$mpdf -> mirrorMargins = true;
$mpdf -> autoScriptToLang = true;
$mpdf -> autoLangToFont = true;
//$mpdf -> defaultPageNumStyle = 'arabic-indic';
// Security
$permissions = array();
$permissions[] = "print";
$mpdf -> SetProtection($permissions, $signature);
// Header & Footer
$mpdf -> SetHTMLHeader($header, "O");
$mpdf -> SetHTMLHeader($header, "E");
$mpdf -> SetHTMLFooter($footer, "O");
$mpdf -> SetHTMLFooter($footer, "E");
// Actual Content
$mpdf -> WriteHTML($html);
$mpdf -> Output();
exit ;
?>
示例14: email
function email($purchase_id, $to, $cc = NULL, $bcc = NULL, $from_name, $from, $subject, $note)
{
$data['message'] = validation_errors() ? validation_errors() : $this->session->flashdata('message');
$data['rows'] = $this->inventories_model->getAllInventoryItems($purchase_id);
$inv = $this->inventories_model->getInventoryByPurchaseID($purchase_id);
$supplier_id = $inv->supplier_id;
$data['supplier'] = $this->inventories_model->getSupplierByID($supplier_id);
$data['inv'] = $inv;
$data['pid'] = $purchase_id;
$data['page_title'] = $this->lang->line("inventory");
$html = $this->load->view('view_inventory', $data, TRUE);
$this->load->library('MPDF/mpdf');
$mpdf = new mPDF('utf-8', 'A4', '12', '', 10, 10, 10, 10, 9, 9);
$mpdf->useOnlyCoreFonts = true;
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle(SITE_NAME);
$mpdf->SetAuthor(SITE_NAME);
$mpdf->SetCreator(SITE_NAME);
$mpdf->SetDisplayMode('fullpage');
$mpdf->SetAutoFont();
$stylesheet = file_get_contents('assets/css/bootstrap-' . THEME . '.css');
$mpdf->WriteHTML($stylesheet, 1);
$search = array("<div class=\"row-fluid\">", "<div class=\"span6\">");
$replace = array("<div style='width: 100%;'>", "<div style='width: 48%; float: left;'>");
$html = str_replace($search, $replace, $html);
$name = $this->lang->line("inventory") . "-" . $inv->id . ".pdf";
$mpdf->WriteHTML($html);
$mpdf->Output($name, 'F');
if ($note) {
$message = html_entity_decode($note) . "<br><hr>" . $html;
} else {
$message = $html;
}
$this->load->library('email');
$config['mailtype'] = 'html';
$config['wordwrap'] = TRUE;
$this->email->initialize($config);
$this->email->from($from, $from_name);
$this->email->to($to);
if ($cc) {
$this->email->cc($cc);
}
if ($bcc) {
$this->email->bcc($bcc);
}
$this->email->subject($subject);
$this->email->message($message);
$this->email->attach($name);
if ($this->email->send()) {
// email sent
unlink($name);
return true;
} else {
//email not sent
unlink($name);
//echo $this->email->print_debugger();
return false;
}
}
示例15: mPDF
function ajax_create_pdf($quotation_id)
{
$data['quotation'] = $this->quotations_model->get_quotation($quotation_id);
$data['qtemplates'] = $this->qtemplates_model->qtemplate_list();
$data['companies'] = $this->customers_model->company_list();
$data['staffs'] = $this->staff_model->staff_list();
$data['pricelists'] = $this->pricelists_model->pricelists_list();
$data['qo_products'] = $this->quotations_model->quot_order_products($quotation_id);
$html = $this->load->view('quotations/ajax_create_pdf',$data,true);
$filename = 'Quotation-'.$data['quotation']->quotations_number;
$pdfFilePath = FCPATH."/pdfs/".$filename.".pdf";
$mpdf=new mPDF('c','A4','','',20,15,48,25,10,10);
$mpdf->SetProtection(array('print'));
$mpdf->SetTitle("Acme Trading Co. - Invoice");
$mpdf->SetAuthor("Acme Trading Co.");
$mpdf->SetWatermarkText($data['quotation']->payment_term);
$mpdf->showWatermarkText = true;
$mpdf->watermark_font = 'DejaVuSansCondensed';
$mpdf->watermarkTextAlpha = 0.1;
$mpdf->SetDisplayMode('fullpage');
$mpdf->WriteHTML($html);
$mpdf->Output($pdfFilePath, 'F');
echo base_url()."pdfs/".$filename.".pdf";
exit;
}