本文整理汇总了PHP中FPDI::getTemplatesize方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDI::getTemplatesize方法的具体用法?PHP FPDI::getTemplatesize怎么用?PHP FPDI::getTemplatesize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDI
的用法示例。
在下文中一共展示了FPDI::getTemplatesize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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:
//$pdf->AddPage();
//$title=$langs->trans("BillsCustomersUnpaid");
//if ($option=='late') $title=$langs->trans("BillsCustomersUnpaid");
//$pdf->MultiCell(100, 3, $title, 0, 'J');
// Add all others
foreach($files as $file)
{
print "Merge PDF file for invoice ".$file."\n";
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++)
{
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Create output dir if not exists
create_exdir($diroutputpdf);
// Save merged file
$filename='mergedpdf';
if (! empty($option)) $filename.='_'.$option;
if ($pagecount)
{
示例3: mergeDocuments
/**
* Simple helper function which actually merges a given array of document-paths
* @param $paths
* @return string The created document's url
*/
private function mergeDocuments($paths)
{
include_once 'engine/Library/Fpdf/fpdf.php';
include_once 'engine/Library/Fpdf/fpdi.php';
$pdf = new FPDI();
foreach ($paths as $path) {
$numPages = $pdf->setSourceFile($path);
for ($i = 1; $i <= $numPages; $i++) {
$template = $pdf->ImportPage($i);
$size = $pdf->getTemplatesize($template);
$pdf->AddPage('P', array($size['w'], $size['h']));
$pdf->useTemplate($template);
}
}
$hash = md5(uniqid(rand()));
$pdf->Output($hash . '.pdf', "D");
}