本文整理汇总了PHP中FPDI::SetDisplayMode方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDI::SetDisplayMode方法的具体用法?PHP FPDI::SetDisplayMode怎么用?PHP FPDI::SetDisplayMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDI
的用法示例。
在下文中一共展示了FPDI::SetDisplayMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeBatchPrintBadge
public function executeBatchPrintBadge(sfWebRequest $request)
{
$ids = $request->getParameter('ids');
// initiate FPDI
$pdf = new FPDI('P', 'pt');
// set the sourcefile
$pdf->setSourceFile(sfConfig::get('sf_upload_dir') . '/badges/ID_new.pdf');
foreach ($ids as $id) {
$this->employee = EmployeePeer::retrieveByPk($id);
// import page 1
$tplIdx = $pdf->importPage(1);
// add a new page based on size of the badge
$s = $pdf->getTemplatesize($tplIdx);
$pdf->AddPage('P', array($s['w'], $s['h']));
$pdf->useTemplate($tplIdx);
$pdf->setMargins(0, 0, 0, 0);
$pdf->SetAutoPageBreak(false);
if ($this->employee->getPicture()) {
$pdf->Image(sfConfig::get('sf_upload_dir') . '/' . sfConfig::get('app_employee_images_dir') . '/' . $this->employee->getPicture(), 29.5, 25.5, 60.3, 74.3);
} else {
$pdf->Image(sfConfig::get('sf_upload_dir') . '/badges/picture_missing.jpg', 29.5, 25.5, 60.3, 74.3);
}
// now write some text above the imported page
$pdf->SetFont('freesans', 'B', 12);
$pdf->SetTextColor(82, 78, 134);
$pdf->SetXY(22, 110);
$pdf->Cell(0, 12, $this->employee->getFullName());
$pdf->Ln();
$pdf->SetX(22);
$pdf->SetFont('freesans', 'BI', 10);
$pdf->Cell(0, 14, $this->employee->getJob());
$pdf->SetDisplayMode('real');
}
return $pdf->Output('newpdf.pdf', 'D');
}
示例2: generatePDF
function generatePDF($id_invoice, $introduction_letter = false, $target = 'file', $docs = false)
{
if (!is_numeric($id_invoice)) {
error_log('$id_invoice not defined');
exit(1);
}
if (!defined('EURO')) {
define('EURO', chr(128));
}
$facture = Facture::getInfos($id_invoice);
foreach (array(LC_MESSAGES, LC_TIME, LC_MONETARY, LC_CTYPE) as $locale) {
setlocale($locale, $facture->language . ".UTF-8") or die("locale {$locale} language failed {$facture->language}");
}
bindtextdomain('webfinance', dirname(__FILE__) . '/../../lang') or die("Set gettext bindtextdomain language failed\n");
textdomain('webfinance') or die("Set gettext textdomain language failed\n");
$type_doc = $facture->type_doc;
if ($facture->language == 'en_US' and $facture->type_doc == 'facture') {
$type_doc = 'invoice';
}
if ($facture->language == 'en_US' and $facture->type_doc == 'devis') {
$type_doc = 'quote';
}
// Generate PDF filename
$filename = sys_get_temp_dir() . '/' . ucfirst($type_doc) . ' ' . preg_replace('/[^a-z0-9éàçùî\\._-]/i', ' ', $facture->num_facture . ' ' . $facture->nom_client) . '.pdf';
foreach ($facture as $n => $v) {
if (!is_array($v)) {
$facture->{$n} = preg_replace("/€/", "EUROSYMBOL", $facture->{$n});
// FPDF ne support pas l'UTF-8
$facture->{$n} = utf8_decode($facture->{$n});
$facture->{$n} = preg_replace("/EUROSYMBOL/", chr(128), $facture->{$n});
$facture->{$n} = preg_replace("/\\\\EUR\\{([0-9.,]+)\\}/", "\\1 " . chr(128), $facture->{$n});
}
}
$pdf = new FPDI('P', 'mm', 'A4');
// Address
$address = "{$facture->nom_client}\n";
for ($i = 0; $i < 3; $i++) {
$n = sprintf("addr%d", $i + 1);
if ($facture->{$n} != "") {
$address .= $facture->{$n} . "\n";
}
}
$address .= "{$facture->cp} {$facture->ville}\n{$facture->pays}";
//Get docs, if needed
if ($docs !== false) {
$pagecount = $pdf->SetSourceFile(dirname(__FILE__) . '/../admin/invoice_docs/docs_' . $facture->language . '.pdf');
for ($n = 1; $n <= $pagecount; $n++) {
$tplidx = $pdf->ImportPage($n, '/MediaBox');
$pdf->AddPage();
$pdf->UseTemplate($tplidx);
}
}
$pdf->SetMargins(10, 10, 10);
$pdf->SetDisplayMode('fullwidth');
$pdf->AddPage();
$prefs = new WebfinancePreferences();
// UTF8 to ISO
$prefs->prefs['societe']->invoice_top_line1 = preg_replace("/€/", "EUROSYMBOL", $prefs->prefs['societe']->invoice_top_line1);
// FPDF ne support pas l'UTF-8
$prefs->prefs['societe']->invoice_top_line1 = utf8_decode($prefs->prefs['societe']->invoice_top_line1);
$prefs->prefs['societe']->invoice_top_line1 = preg_replace("/EUROSYMBOL/", chr(128), $prefs->prefs['societe']->invoice_top_line1);
// Save the logo to a temp file since fpdf cannot read from a var
$tempfile_logo = tempnam(sys_get_temp_dir(), 'logo') . '.png';
$logo_tmp = fopen($tempfile_logo, "w");
fwrite($logo_tmp, $prefs->prefs['logo']);
fclose($logo_tmp);
// Logo
$pdf->Image($tempfile_logo, 90, 5, 25, 0, 'PNG');
// Display text headers
$pdf->SetFont('Arial', '', 5);
$logo_size = getimagesize($tempfile_logo);
$logo_height = $logo_size[1] * 25 / $logo_size[0];
$pdf->SetXY(10, $logo_height + 5);
$pdf->Cell(190, 5, $prefs->prefs['societe']->invoice_top_line1, 0, 0, "C");
$pdf->SetLineWidth(0.3);
$pdf->SetXY(10, $logo_height + 8);
$pdf->Cell(190, 5, utf8_decode($prefs->prefs['societe']->invoice_top_line2), "B", 0, "C");
// Address
$pdf->SetFont('Arial', 'B', 11);
$pdf->SetXY(115, 50);
$pdf->Cell(80, 5, $facture->nom_client, 0, 0);
$pdf->SetFont('Arial', '', 11);
$y = 54;
for ($i = 0; $i < 3; $i++) {
$n = sprintf("addr%d", $i + 1);
if ($facture->{$n} != "") {
$pdf->SetXY(115, $y);
$pdf->Cell(80, 5, $facture->{$n}, 0, 0);
$y += 5;
}
}
$pdf->SetXY(115, $y);
$pdf->Cell(80, 4, $facture->cp . " " . $facture->ville, 0, 0);
$pdf->SetXY(115, $y + 5);
$pdf->Cell(80, 4, $facture->pays, 0, 0);
// Donnees factures
$pdf->SetXY(10, 19 + $logo_height);
$pdf->SetFont('Arial', 'B', 14);
$pdf->Cell(60, 4, ucfirst($type_doc) . utf8_decode(_(' #')) . $facture->num_facture);
$pdf->SetFont('Arial', '', 9);
//.........这里部分代码省略.........