本文整理汇总了PHP中FPDI::ImportPage方法的典型用法代码示例。如果您正苦于以下问题:PHP FPDI::ImportPage方法的具体用法?PHP FPDI::ImportPage怎么用?PHP FPDI::ImportPage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FPDI
的用法示例。
在下文中一共展示了FPDI::ImportPage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRAuftrag
define("FONTSTYLE", "1");
$rep = getRAuftrag($_GET["aid"]);
$masch = getAllMaschine($rep["mid"]);
$firma = getFirmenStamm($masch["customer_id"]);
$hist = getHistory($rep["mid"]);
$material = getAllMat($_GET["aid"], $rep["mid"]);
if ($material) {
foreach ($material as $zeile) {
$mat .= $zeile["menge"] . " x " . substr($zeile["description"], 0, 70) . "\n";
}
}
require "fpdf.php";
require "fpdi.php";
$pdf = new FPDI('P', 'mm', 'A4');
$seiten = $pdf->setSourceFile("vorlage/repauftrag.pdf");
$hdl = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($hdl);
$pdf->SetFont($repfont, 'B', $repsizeL);
$pdf->Text($repname[x], $repname[y], utf8_decode($firma["name"]));
$pdf->Text($repstr[x], $repstr[y], utf8_decode($firma["street"]));
$pdf->Text($report[x], $report[y], $firma["zipcode"] . " " . utf8_decode($firma["city"]));
$pdf->Text($repphone[x], $repphone[y], $firma["phone"]);
$pdf->Text($repaid[x], $repaid[y], $_GET["aid"]);
$pdf->SetFont($repfont, '', $repsizeN);
$pdf->Text($repwvnr[x], $repwvnr[y], $masch['contractnumber']);
$pdf->Text($repkdnr[x], $repkdnr[y], $firma["customernumber"]);
$pdf->Text($repdate[x], $repdate[y], date("d.m.Y"));
$pdf->Text($repmasch[x], $repmasch[y], utf8_decode($masch["description"]));
$pdf->Text($repser[x], $repser[y], $masch["serialnumber"]);
$pdf->Text($repsort[x], $repsort[y], utf8_decode($masch["standort"]));
示例2: FPDI
function back_id($results)
{
$this->load->helper('settings');
//print preview of MR
$this->load->library('fpdf');
$this->load->library('fpdi');
// initiate FPDI
$pdf = new FPDI('L');
// add a page
$pdf->AddPage();
// set the sourcefile
$pagecount = $pdf->setSourceFile('pdf-report/id/back-id.pdf');
// import page 1
$tplIdx = $pdf->importPage(1);
// use the imported page and place it at point 10,10 with a width of 100 mm
$pdf->useTemplate($tplIdx);
// now write some text above the imported page
$pdf->SetTextColor(0, 0, 0);
$pdf->SetFont('Arial', '', 7);
$n = 1;
foreach ($results as $result) {
$s = new Personal_m();
$row = $s->get_by_employee_id($result->employee_id);
//======================== START Column 1 | Right to Left ==============================
if ($n == 11) {
//add new page
$pdf->addPage();
for ($n = 1; $n <= 1; $n++) {
$tplidx = $pdf->ImportPage(1);
$pdf->useTemplate($tplIdx);
//, 1, 1, 210
}
$n = $n - 1;
}
$bday = $row->birth_date;
$address = $row->res_address;
$blood_type = '"' . $row->blood_type . '"';
$gsis = $row->gsis;
$pagibig = $row->pagibig;
$philhealth = $row->philhealth;
$tin = $row->tin;
$emergency = '';
$contact = $row->cp;
//----------------------------- Row 1 ----------------------------------
///Birthday
if ($n == 1) {
//Birthday
if ($bday != '0000-00-00') {
$pdf->SetXY(247, 23);
$pdf->Cell(50, 0, date('F d, Y', strtotime(date('F d, Y', strtotime($bday)))), '0', 0, 'C', false);
}
//Address
$pdf->SetXY(257, 15);
$addr = splitstroverflow(ucwords(strtolower(utf8_decode($address))), 28);
$pdf->Cell(30, 0, $addr[0], '0', 0, 'C', false);
//display text overflow
if ($addr[1]) {
$pdf->Ln(2.5);
$pdf->SetX(257);
$pdf->Cell(30, 0, $addr[1], '0', 0, 'C', false);
}
if ($addr[2]) {
$pdf->Ln(2.5);
$pdf->SetX(257);
$pdf->Cell(30, 0, $addr[2], '0', 0, 'C', false);
}
if ($addr[3]) {
$pdf->Ln(2.5);
$pdf->SetX(257);
$pdf->Cell(30, 0, $addr[3], '0', 0, 'C', false);
}
//Blood Type
$pdf->SetXY(247, 28.3);
$pdf->Cell(50, 0, strtoupper($blood_type), '0', 0, 'C', false);
//GSIS
$pdf->SetXY(247, 33);
$pdf->Cell(50, 0, strtoupper($gsis), '0', 0, 'C', false);
//PAGIBIG
$pdf->SetXY(247, 38);
$pdf->Cell(50, 0, strtoupper($pagibig), '0', 0, 'C', false);
//PHILHEALTH
$pdf->SetXY(247, 43.5);
$pdf->Cell(50, 0, strtoupper($philhealth), '0', 0, 'C', false);
//PHILHEALTH
$pdf->SetXY(247, 48.5);
$pdf->Cell(50, 0, strtoupper($tin), '0', 0, 'C', false);
//in case of emergency
$pdf->SetXY(235, 75.5);
$pdf->Cell(60, 0, strtoupper($emergency), '0', 0, 'C', false);
//CP No.
$pdf->SetXY(250, 78);
$cpno = splitstroverflow($contact, 13);
$pdf->Cell(30, 0, $cpno[0], '0', 0, 'C', false);
if ($cpno[1]) {
$pdf->Ln(3);
$pdf->SetX(250);
$pdf->Cell(30, 0, $cpno[1], '0', 0, 'C', false);
}
}
//----------------------------- Row 2 ----------------------------------
//.........这里部分代码省略.........
示例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");
}
示例4: FlyerRendering
function FlyerRendering($inputFile, $outputPostfix, $anschnitt)
{
/*------------------------------------------------------------------------------------
* Bitte tragt hier eure lokalen Freifunk Daten ein.
*------------------------------------------------------------------------------------
*
* Hinweiss Community-Logo:
* Moegliche Format sind GIF, JPG und PNG.
*
* Laenge des Community Namen:
* Falls der Community-Name zu lang ist und es zu einem Zeilenumbruch kommt,
* dann sollte $communityNameFontSize verkleiner werden
*
-------------------------------------------------------------------------------------*/
// Community Name fuer Hauptseite
$communityNameText = "Freifunk Duckburg";
$communityNameFontSize = 48.0;
//in pt
$communityNamePositionOffsetX = 0.0;
// +/- in mm
$communityNamePositionOffsetY = 0.0;
// +/- in mm
// Logo auf Kontaktseite
$kontaktLogoDateiName = "logo-template.png";
$kontaktLogoWidth = 66.25;
//in mm // Muss kleiner 98.0 mm sein! Hier bitte die gewuenschte Breite des Logos auf dem Flyer eintragen.
$kontaktLogoPositionY = 47.0;
//in mm // Die Hoeheneinstellung ist etwas frickelig. Es klappt aber :-)
// Texte fuer Seite mit Kontaktdaten
$kontaktTitelText = "Kontakt";
$kontaktInfoTexte = [["Webseite", "http://ffdb.freifunk.net"], ["Mail", "info@ff-duckburg.ffdb"], ["Mailingliste", "subscribe@ff-duckburg.ffdb"], ["Twitter", "@FreiFunkDB"], ["Treffen", "Jeden zweiten Montag"], ["", "Und wo? Siehe unsere Webseite"], ["", ""], ["", ""]];
// Text Fusszeile
$kontaktFusszeileText = "Freifunk Duckburg e.V.";
/*-----------------------------------------------------------------------------------
*
* Ab hier sollte nichts mehr geander werden!
*
------------------------------------------------------------------------------------*/
// Breite der einzelnen Seiten
$wRechts = 99.0;
//mm
$wMitte = 98.0;
//mm
$wLinks = 97.0;
//mm
// Community Name
$communityNamePositionX = $wLinks + $wMitte + $communityNamePositionOffsetX;
//mm
$communityNamePositionY = 12.2 + $communityNamePositionOffsetY;
//mm
// Kontakt Titel
$kontaktTitelPositionX = $wLinks + 3.975;
//mm
$kontaktTitelPositionY = 10.425;
//mm
$kontaktTitelFontSize = 15.0;
//pt
// Kontakt Info
$kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0;
//mm
$kontaktInfoPositionY = $kontaktTitelPositionY + 7.0;
//mm
$kontaktInfoZeilenOffsetY = 4.7;
//mm
$kontaktInfoFontSize = 10.9;
//pt
// Kontakt Logo
$kontaktLogoPositionX = $wLinks + $wMitte / 2 - $kontaktLogoWidth / 2;
// Kontakt Footer
$kontaktFooterPositionX = $wLinks;
//mm
$kontaktFooterPositionY = 95.40000000000001;
//mm
$kontaktFooterWidth = $wMitte;
//mm
$kontaktFooterFontSize = 10.9;
//pt
echo "\n";
// Output-Dasteiname zusammenbauen
$outputFile = $outputPostfix . "-" . $inputFile;
// initiate FPDI
$pdf = new FPDI();
echo "Input: {$inputFile}\n";
$pageCount = $pdf->setSourceFile($inputFile);
// Importiere Vorder- und Rueckseite
$Vorderseite = $pdf->ImportPage(1);
$Rueckseite = $pdf->ImportPage(2);
// Seitenabmessungen holen
$size = $pdf->getTemplateSize($Vorderseite);
$dokumentBreite = round($size['w'], 2);
$dokumentHoehe = round($size['h'], 2);
echo "Dokumenten Breite: {$dokumentBreite} mm\n";
echo "Dokumenten Hoehe: {$dokumentHoehe} mm\n";
echo "Anschnitt: {$anschnitt} mm\n";
// Vorderseite uebernehmen
// Anfang eines bloeden Hacks wegen des FooterZeilen-Textes.
// Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist.
// Keine Ahnung warum!
$pdf->AddPage('L');
$tplVorderseite = $pdf->importPage(1);
//.........这里部分代码省略.........
示例5: 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);
//.........这里部分代码省略.........
示例6: FlyerRendering
function FlyerRendering($config, $inputFile, $outputPath, $outputPostfix, $anschnitt = 0.0)
{
// Breite der einzelnen Seiten
$wRechts = 99.0;
//mm
$wMitte = 98.0;
//mm
$wLinks = 97.0;
//mm
// Community Name
$communityNamePositionX = $wLinks + $wMitte + $config['communityNamePositionOffsetX'];
//mm
$communityNamePositionY = 12.2 + $config['communityNamePositionOffsetY'];
//mm
// Kontakt Titel
$kontaktTitelPositionX = $wLinks + 3.975;
//mm
$kontaktTitelPositionY = 10.425;
//mm
$kontaktTitelFontSize = 15.0;
//pt
// Kontakt Info
$kontaktInfoTextPositionX = $kontaktTitelPositionX + 25.0;
//mm
$kontaktInfoPositionY = $kontaktTitelPositionY + 7.0;
//mm
$kontaktInfoZeilenOffsetY = 4.7;
//mm
$kontaktInfoFontSize = 10.9;
//pt
// Kontakt Logo
$kontaktLogoPositionX = $wLinks + $wMitte / 2 - $config['kontaktLogoWidth'] / 2;
// Kontakt Footer
$kontaktFooterPositionX = $wLinks;
//mm
$kontaktFooterPositionY = 95.40000000000001;
//mm
$kontaktFooterWidth = $wMitte;
//mm
$kontaktFooterFontSize = 10.9;
//pt
// Output-Dasteiname zusammenbauen
$outputFile = $outputPath . DIRECTORY_SEPARATOR . $outputPostfix . '_' . basename($inputFile);
// initiate FPDI
$pdf = new FPDI();
echo 'Input: ' . basename($inputFile) . PHP_EOL;
$pageCount = $pdf->setSourceFile($inputFile);
// Importiere Vorder- und Rueckseite
$Vorderseite = $pdf->ImportPage(1);
$Rueckseite = $pdf->ImportPage(2);
// Seitenabmessungen holen
$size = $pdf->getTemplateSize($Vorderseite);
$dokumentBreite = round($size['w'], 2);
$dokumentHoehe = round($size['h'], 2);
echo 'Dokumenten Breite: ' . $dokumentBreite . 'mm' . PHP_EOL;
echo 'Dokumenten Hoehe: ' . $dokumentHoehe . 'mm' . PHP_EOL;
echo 'Anschnitt: ' . $anschnitt . 'mm' . PHP_EOL;
// Vorderseite uebernehmen
// Anfang eines bloeden Hacks wegen des FooterZeilen-Textes.
// Der Footertext laesst sich nur einfügen, wenn die Seite eine A4 Seite ist.
// Keine Ahnung warum!
$pdf->AddPage('L');
$tplVorderseite = $pdf->importPage(1);
$pdf->useTemplate($tplVorderseite);
//Margin ist wegen der Rand-Platzierung des Community Names wichtig.
$pdf->SetMargins(0, 0, 0);
// erstmal alle Fonts laden
echo 'Lade Fonts...' . PHP_EOL;
$pdf->AddFont('lato-bold');
$pdf->AddFont('lato-regular');
$pdf->AddFont('alternategothic');
// Rendern Titel Text
echo 'Verarbeite Titel Text...' . PHP_EOL;
$pdf->SetFont('lato-bold');
$pdf->SetFontSize($kontaktTitelFontSize);
$pdf->SetTextColor(0, 0, 0);
//schwarz
$pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktTitelPositionY + $anschnitt);
$pdf->Write(0, iconv('UTF-8', 'windows-1252', $config['kontaktTitelText']));
// Rendern Info Text
echo 'Verarbeite Info Text...' . PHP_EOL;
$pdf->SetTextColor(0, 0, 0);
//schwarz
$pdf->SetFontSize($kontaktInfoFontSize);
foreach ($config['kontaktInfoTexte'] as $a) {
$pdf->SetFont('lato-bold');
$pdf->SetXY($kontaktTitelPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt);
$pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[0]));
$pdf->SetFont('lato-regular');
$pdf->SetXY($kontaktInfoTextPositionX + $anschnitt, $kontaktInfoPositionY + $anschnitt);
$pdf->Write(0, iconv('UTF-8', 'windows-1252', $a[1]));
$kontaktInfoPositionY = $kontaktInfoPositionY + $kontaktInfoZeilenOffsetY;
}
// Rendern Community Logo
echo 'Verarbeite Logo...' . PHP_EOL;
$pdf->Image($config['kontaktLogoDateiName'], $kontaktLogoPositionX + $anschnitt, $config['kontaktLogoPositionY'] + $anschnitt, $config['kontaktLogoWidth'], 0);
// Rendern Fusszeilen Text
echo 'Verarbeite Fusszeile...' . PHP_EOL;
$pdf->SetFont('lato-regular');
$pdf->SetFontSize($kontaktFooterFontSize);
//.........这里部分代码省略.........
示例7: suchVertrag
include "inc/FirmenLib.php";
include "inc/wvLib.php";
include "inc/pdfpos.php";
define("FPDF_FONTPATH", "/usr/share/fpdf/font/");
define("FONTART", "2");
define("FONTSTYLE", "1");
$rep = suchVertrag($_GET["aid"]);
$rep = $rep[0];
$masch = getVertragMaschinen($rep["cid"]);
$firma = getFirmenStamm($rep["customer_id"]);
require "fpdf.php";
require "fpdi.php";
$pdf = new FPDI('P', 'mm', 'A4');
$seiten = $pdf->setSourceFile("vorlage/wv" . $rep["template"]);
$ende = $rep["endedatum"] == $rep["anfangdatum"] ? "offen" : db2date($rep["endedatum"]);
$hdl = $pdf->ImportPage(1);
$pdf->addPage();
$pdf->useTemplate($hdl);
$pdf->SetFont($wvfont, '', $wvsize);
$pdf->Text($wvname[x], $wvname[y], utf8_decode($firma["name"]));
$pdf->Text($wvstr[x], $wvstr[y], utf8_decode($firma["street"]));
$pdf->Text($wvort[x], $wvort[y], $firma["zipcode"] . " " . utf8_decode($firma["city"]));
$pdf->Text($wvkdnr[x], $wvkdnr[y], $firma["customernumber"]);
$pdf->Text($wvwvnr[x], $wvwvnr[y], $rep['contractnumber']);
$pdf->Text($wvstart[x], $wvstart[y], db2date($rep["anfangdatum"]));
$pdf->Text($wvende[x], $wvende[y], $ende);
$pdf->Text($wvbetrag[x], $wvbetrag[y], sprintf("%0.2f", $rep["betrag"]));
$pdf->SetFont('Helvetica', '', 10);
$bem = $rep["bemerkung"] ? utf8_decode($rep["bemerkung"]) : "Es werden keine Sondervereinbarungen getroffen";
$pdf->SetY($wvbem[y]);
$pdf->SetX($wvbem[x]);