function generate_mitgliedsbescheinigung($titleAndName, $strasse, $plz, $ort, $land, $jahr, $vorstand, $datum) { // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the source file $pdf->setSourceFile(HOME_DIRECTORY . 'alumpiHP_libraries/Mitgliedsbestaetigung_blank.pdf'); // import page 1 $tplIdx = $pdf->importPage(1); // use the imported page and place it at position 0,0 with a width of 210 mm (full page) $pdf->useTemplate($tplIdx, 0, 0, 210); // add the font DejaVu $pdf->AddFont('DejaVuSans', '', 'DejaVuSans.ttf', true); $pdf->AddFont('DejaVuSans-Bold', '', 'DejaVuSans-Bold.ttf', true); // text settings $pdf->SetTextColor(0, 0, 0); // add address of the member $addressString = $titleAndName . "\n"; $addressString .= $strasse . "\n"; $addressString .= $plz . " " . $ort . "\n"; $addressString .= $land; $pdf->SetFont('DejaVuSans'); $pdf->SetFontSize(12); $pdf->SetXY(20, 23); $pdf->Multicell(80, 6, $addressString); //add heading $headingString = "Mitgliedsbescheinigung " . $jahr; $pdf->SetFont('DejaVuSans-Bold'); $pdf->SetFontSize(16); $pdf->SetXY(20, 80); $pdf->Multicell(170, 6, $headingString); // add main text $textString = "Hiermit wird bestätigt, dass " . $titleAndName . " im Kalenderjahr " . $jahr; $textString .= " ordentliches Mitglied des Absolventen- und Förderverein MPI Uni Bayreuth e.V. (aluMPI) ist.\n"; $textString .= "\n"; $pdf->SetFont('DejaVuSans'); $pdf->SetFontSize(12); $pdf->SetXY(20, 100); $pdf->Multicell(170, 6, $textString); // add signature text $signatureString = "Absolventen- und Förderverein MPI Uni Bayreuth e.V.\n"; $signatureString .= "1. Vorstand: " . $vorstand . "\n"; $pdf->SetXY(20, 140); $pdf->Multicell(170, 6, $signatureString); // add signature $pdf->Image(HOME_DIRECTORY . 'alumpiHP_libraries/unterschrift_krinninger.png', 20, 155, 50); // add place and date $dateString = "Bayreuth, " . $datum; $pdf->SetXY(20, 180); $pdf->Multicell(170, 6, $dateString); ob_clean(); $pdf->Output(); }
$sql = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($sql) == 1) { $row = mysql_fetch_assoc($sql); } } $pdf = new FPDI(); $pageCount = $pdf->setSourceFile("img/ugoda2014.pdf"); $pageNo = 1; $templateId = $pdf->importPage($pageNo); $size = $pdf->getTemplateSize($templateId); $pdf->AddPage('P', array($size['w'], $size['h'])); $pdf->useTemplate($templateId); $pdf->AddFont('Times', '', 'times.php'); $pdf->SetFont('Times', '', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(11); $pdf->SetXY(35, 61); $pdf->Write(5, $row['lastname'] . " " . $row['firstname'] . " " . $row['patronymic']); $pdf->SetXY(55, 70); if ($row['type'] == "mag") { $pdf->Write(5, "6-й курс, " . $row['faculty']); } if ($row['type'] == "spc") { $pdf->Write(5, "5-й курс " . $row['faculty']); } if ($row['study_type'] == "Денна") { $type = ", денна форма навчання"; } if ($row['study_type'] == "Заочна") { $type = ", заочна форма навчання"; }
file_put_contents('img.png', $unencodedData); //Show the image //echo '<img src="'.$_POST['img_val'].'" />'; $pdf = new FPDI(); $pdf->setSourceFile('TemplateReporte.pdf'); // seteamos la fuente, el estilo y el tamano $pdf->SetFont('Times', 'B', 10); // seteamos la posicion inicial $pdf->SetXY(25, 80); date_default_timezone_set('America/Bogota'); setlocale(LC_ALL, "es_ES"); $dias = array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"); $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); //agregamos una pagina $pdf->AddPage(); $pdf->SetFont('Arial'); // seleccionamos la primera pagina del docuemnto importado $tplIdx = $pdf->importPage(1); // usamos la pagina importado como template $pdf->useTemplate($tplIdx); //seteamos la posicion X $pdf->SetX(25); //salto de linea $pdf->Ln(55.2); $pdf->SetFontSize(9); $pdf->Write(0, utf8_decode(" " . $dias[date('w')] . " " . date('d') . " de " . $meses[date('n') - 1] . " del " . date('Y'))); $pdf->Image('img.png', 50, 110, 200); unlink('img.png'); $pdf->Ln(155); $pdf->Write(0, utf8_decode(" Relación de costos anuales sobre proyectos ejecutados con éxito.")); $pdf->Output();
$pdf->useTemplate($templateId); $pdf->SetAutoPageBreak(false); $pdf->SetFillColor(255, 242, 0); //$db = new SQLite3('/home1/columch7/public_html/Columbia.db'); $db = new SQLite3($columbiaDB); $ID = $_GET["ID"]; $AUTH = $_GET["AUTH"]; $results = $db->query('SELECT * FROM benton_new_patients where ID =' . $ID . ' and AUTH = ' . $AUTH); //$results = $db->query('SELECT * FROM Pasco_new_patients where ID=24'); $row = $results->fetchArray(); //print var_dump($row); //exit(); //Name $pdf->SetFont('Helvetica'); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(10); $pdf->SetXY(17, 10.7); $pdf->Write(10, $row["FIRST_NAME"] . " " . $row["LAST_NAME"]); //Date $pdf->SetFontSize(10); $pdf->SetXY(115, 10.7); $pdf->Write(10, $row["TODAY_DATE"]); //Age $pdf->SetFontSize(10); $pdf->SetXY(168, 10.7); $pdf->Write(10, $row["AGE"]); //Gender if ('M' == $row["GENDER"]) { $pdf->Rect(195, 13, 4, 4); } elseif ('F' == $row["GENDER"]) { $pdf->Rect(200.5, 13, 3.5, 4);
public static function appendVoidText($path_to_dir,$filename,$page=''){ require_once(Yii::app()->basePath.'/extensions/Fpdf/fpdf.php'); require_once(Yii::app()->basePath.'/extensions/Fpdi/fpdi.php'); $pdf = new FPDI(); $pdf->setSourceFile($path_to_dir.'/'.$filename); $tplIdx = $pdf->importPage(1, '/MediaBox'); $pdf->addPage(); $pdf->useTemplate($tplIdx, true); //die("after set sourse"); try{ $pdf->SetFont('Helvetica','B',20); $pdf->SetTextColor(255,0,0); $pdf->SetXY (10,5); $pdf->SetFontSize(10); $pdf->Write(5,'VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID void VOID '); $pdf->Output($path_to_dir.'/'.$filename,'F'); }catch (Exception $e) { $result['error']="Could not render this file"; die('Could not render this file'); } $result['path_to_dir']=$path_to_dir; $result['filename']=$filename; $result['ext']='pdf'; return $result; }
public function download_card() { $theme = Input::has('theme') ? Input::get('theme') : '1'; $card_name = Input::has('name') ? Input::get('name') : 'Sam Sample'; $card_number = substr_replace(str_pad(Input::has('no') ? Input::get('no') : '1', 8, '0', STR_PAD_LEFT), ' ', 4, 0); if ($user = Auth::user()) { $member = Member::where('user_id', '=', $user->id)->first(); $card_name = $member->firstname . ' ' . $member->lastname; $theme = $member->member_type != '' ? $member->member_type : '0'; $card_number = substr_replace(str_pad($member->id, 8, '0', STR_PAD_LEFT), ' ', 4, 0); } $pdf = new FPDI('L'); $pdf->setPrintHeader(false); $pdf->setPrintFooter(false); $pdf->AddPage(); switch ($theme) { case '0': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/01_tigerair_if_70s_brown_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '1': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/02_tigerair_if_green_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '2': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/03_tigerair_if_purple_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '3': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/19_tigerair_if_bling_bling_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '4': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/05_tigerair_if_bronze_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '5': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/06_tigerair_if_second_place_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '6': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/07_tigerair_if_platinum_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '7': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/08_tigerair_if_chocolate_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '8': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/09_tigerair_if_dark_black_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '9': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/10-tigerair_if_boring_white_memcard.pdf'); $pdf->SetTextColor(90, 89, 85); break; case '10': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/11_tigerair_if_antarctic_memcard.pdf'); $pdf->SetTextColor(90, 89, 85); break; case '11': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/12_tigerair_if_soy_latte_memcard.pdf'); $pdf->SetTextColor(90, 89, 85); break; case '12': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/20_tigerair_if_triple_platinum_emerald_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '13': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/14_tigerair_if_beer_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '14': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/15_tigerair_if_wood_paneling_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '15': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/16_tigerair_if_aerobics_blue_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; case '16': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/17_tigerair_if_turkish_delight_memcard.pdf'); $pdf->SetTextColor(90, 89, 85); break; case '17': $pdf->setSourceFile(realpath(dirname(__FILE__)) . '/../../public/assets/pdf/18_tigerair_if_golden_glow_memcard.pdf'); $pdf->SetTextColor(255, 255, 255); break; } $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx); $pdf->SetFont('museosansrounded700'); $pdf->SetFontSize(8); $pdf->SetXY(52, 118); $pdf->Write(10, $card_name); $pdf->SetXY(52, 122); $pdf->Write(10, $card_number); $pdf->Output('membership-card.pdf'); }
$sql = mysql_query($query) or die(mysql_error()); if (mysql_num_rows($sql) == 1) { $row = mysql_fetch_assoc($sql); } } $pdf = new FPDI(); $pageCount = $pdf->setSourceFile("img/dogovir2015.pdf"); $pageNo = 1; $templateId = $pdf->importPage($pageNo); $size = $pdf->getTemplateSize($templateId); $pdf->AddPage('P', array($size['w'], $size['h'])); $pdf->useTemplate($templateId); $pdf->AddFont('Times', '', 'times.php'); $pdf->SetFont('Times', '', 10); $pdf->SetTextColor(0, 0, 0); $pdf->SetFontSize(11); $pdf->SetXY(20, 40); $pdf->Write(5, $row['lastname'] . " " . $row['firstname'] . " " . $row['patronymic']); $pdf->SetXY(20, 47); $pdf->Write(5, $row['pasp_serial'] . " " . $row['pasp_number'] . " виданий " . $row['pasp_issue'] . " " . date("d.m.Y", $row['pasp_date'])); $pdf->SetXY(20, 80); $pdf->Write(5, $row['lastname'] . " " . $row['firstname'] . " " . $row['patronymic']); $pdf->SetXY(35, 87); if ($row['study_type'] == "Денна") { $pdf->Write(5, "денною"); } if ($row['study_type'] == "Заочна") { $pdf->Write(5, "заочною"); } $pdf->SetXY(160, 87); if ($row['type'] == "mag") {
} else { $info_veto = json_decode($info_veto, true); } // initiate FPDI $pdf = new FPDI(); // add a page $pdf->AddPage(); // set the source file $pdf->setSourceFile("../image/patron_image/certificat_sanitaire.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, 0, 0, 0); // now write some text above the imported page $pdf->SetFont('Helvetica'); $pdf->SetFontSize(12); $pdf->SetTextColor(0, 0, 0); foreach ($array_sani as $row) { $pdf->SetXY($row['posx'], $row['posy']); $pdf->Write(0, requetemysql::gestion_string_maj(remplissage_formulaire($row, $info_veto, $info_client, $info_animal))); } $pdf->Output('../sauvegarde/animaux/' . $_POST['animal_id'] . '/certif_sanitaire_' . $variable . '.pdf', F); echo json_encode($variable); } elseif ($_GET['action'] == 'modif_lot') { $sql = "UPDATE medicament set lot=:lot WHERE nom=:nom and permission=:permission LIMIT 1"; $st2 = $db->prepare($sql, array(PDO::ATTR_CURSOR => PDO::CURSOR_FWDONLY)); $st2->execute(array(':lot' => $_POST['lot'], ':nom' => $_POST['nom'], ':permission' => $_SESSION['login'])); $st2->closeCursor(); echo json_encode("ok"); } elseif ($_GET['action'] == 'medic') { $medicament = requetemysql::recup_medic(array('nom' => $_GET['recherche']));
date_default_timezone_set('America/Bogota'); setlocale(LC_ALL, "es_ES"); $dias = array("Domingo", "Lunes", "Martes", "Miercoles", "Jueves", "Viernes", "Sábado"); $meses = array("Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"); //agregamos una pagina $pdf->AddPage(); $pdf->SetFont('Arial'); // seleccionamos la primera pagina del docuemnto importado $tplIdx = $pdf->importPage(1); // usamos la pagina importado como template $pdf->useTemplate($tplIdx); //seteamos la posicion X $pdf->SetX(25); //salto de linea $pdf->Ln(55.2); $pdf->SetFontSize(9); $pdf->Write(0, utf8_decode(" " . $dias[date('w')] . " " . date('d') . " de " . $meses[date('n') - 1] . " del " . date('Y'))); $pdf->Ln(10); $pdf->SetFontSize(15); $pdf->write(15, ' ' . $proBasic["nombreProyecto"]); $pdf->Ln(10); $pdf->SetFontSize(12); $pdf->write(15, ' ' . utf8_decode($proBasic["nombreProyecto"])); $pdf->Ln(6); $pdf->write(15, ' ' . $proBasic["fechaInicio"]); $pdf->Ln(6); $pdf->write(15, ' ' . $proBasic["fechaFin"]); $pdf->Ln(6); $pdf->write(15, ' ' . utf8_decode($proBasic["estadoProyecto"])); $pdf->Ln(6); $pdf->write(15, ' ' . $proBasic["ejecutado"] . '%');
$tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx, 5, 5, 200, 0, true); } else { $pdf->setSourceFile('pdf/gurps4e-oficial-en.pdf'); $tplIdx = $pdf->importPage(1); $pdf->useTemplate($tplIdx, -5, 7, 220, 0, true); } $pdf->SetFont('Helvetica', '', 9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(72, 15.5); $pdf->Write(0, $personagem->getNome()); $pdf->SetXY(134, 15.5); $pdf->Write(0, $jogador->getNome()); $pdf->SetXY(188, 15.5); $pdf->Write(0, $personagem->getTotalPonto()); $pdf->SetFontSize(7); $pdf->SetXY(71.5, 21.5); $pdf->WriteCenter(9, 0, number_format($personagem->getPeso(), 1, ',', '.')); $pdf->SetXY(89, 21.5); $pdf->Write(0, $personagem->getAlturaTexto()); $pdf->SetFontSize(9); $pdf->SetXY(149, 21.5); $pdf->Write(0, $personagem->getIdade()); $pdf->SetXY(79, 27.5); $pdf->Write(0, $personagem->getAparencia()); $pdf->SetFont('Helvetica', '', 16); $pdf->SetXY(23, 43); $pdf->WriteCenter(10, 0, $personagem->getST()); $pdf->SetXY(23, 55); $pdf->WriteCenter(10, 0, $personagem->getDX()); $pdf->SetXY(23, 68);
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", "*****@*****.**"], ["Mailingliste", "*****@*****.**"], ["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); $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...\n"; $pdf->AddFont('lato-bold'); $pdf->AddFont('lato-regular'); $pdf->AddFont('alternategothic'); // Rendern Titel Text echo "Verarbeite Titel Text...\n"; $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', $kontaktTitelText)); // Rendern Info Text echo "Verarbeite Info Text...\n"; $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetFontSize($kontaktInfoFontSize); foreach ($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...\n"; $pdf->Image($kontaktLogoDateiName, $kontaktLogoPositionX + $anschnitt, $kontaktLogoPositionY + $anschnitt, $kontaktLogoWidth, 0); // Rendern Fusszeilen Text echo "Verarbeite Fusszeile...\n"; $pdf->SetFont('lato-regular'); $pdf->SetFontSize($kontaktFooterFontSize); $pdf->SetTextColor(255, 255, 255); //weiss $pdf->SetXY($kontaktFooterPositionX + $anschnitt, $kontaktFooterPositionY + $anschnitt); $pdf->Cell($kontaktFooterWidth, 0, iconv('UTF-8', 'windows-1252', $kontaktFusszeileText), 0, 0, 'C'); // Rendern Community Name echo "Verarbeite Community Name...\n"; $pdf->SetFont('alternategothic'); $pdf->SetFontSize($communityNameFontSize); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($communityNamePositionX + $anschnitt, $communityNamePositionY + $anschnitt); $pdf->MultiCell($wRechts, 10, iconv('UTF-8', 'windows-1252', $communityNameText), 0, 'C'); // Das war's mit dem Editieren // Original PDF Rueckseit uebernehmen $pdf->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf->importPage(2); $pdf->useTemplate($tplRueckseite); // und erstmal abspeichern echo "Zwischenspeichern...\n"; $pdf->Output($outputFile); // Hier geht jetzt der Hack wegen der Footerzeile weiter // Die gerade abgespeicherte Datei wird erneut eingelesen // um dann im Seiten-Format der Ursprungsdatei erneut abgespeichert zu werden. // Is' doof, muss aber sein $pdf_2 = new FPDI(); echo "Erneut laden...\n"; $pageCount = $pdf_2->setSourceFile($outputFile); echo "Feinschliff...\n"; $Vorderseite_2 = $pdf_2->ImportPage(1); $Rueckseite_2 = $pdf_2->ImportPage(2); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplForderseite = $pdf_2->importPage(1); $pdf_2->useTemplate($tplForderseite); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf_2->importPage(2); $pdf_2->useTemplate($tplRueckseite); echo "Output: {$outputFile}\n"; $pdf_2->Output($outputFile); unset($pdf); unset($pdf_2); }
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); $pdf->SetTextColor(255, 255, 255); //weiss $pdf->SetXY($kontaktFooterPositionX + $anschnitt, $kontaktFooterPositionY + $anschnitt); $pdf->Cell($kontaktFooterWidth, 0, iconv('UTF-8', 'windows-1252', $config['kontaktFusszeileText']), 0, 0, 'C'); // Rendern Community Name echo 'Verarbeite Community Name...' . PHP_EOL; $pdf->SetFont('alternategothic'); $pdf->SetFontSize($config['communityNameFontSize']); $pdf->SetTextColor(0, 0, 0); //schwarz $pdf->SetXY($communityNamePositionX + $anschnitt, $communityNamePositionY + $anschnitt); $pdf->MultiCell($wRechts, 10, iconv('UTF-8', 'windows-1252', $config['communityNameText']), 0, 'C'); // Das war's mit dem Editieren // Original PDF Rueckseit uebernehmen $pdf->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf->importPage(2); $pdf->useTemplate($tplRueckseite); // und erstmal abspeichern echo 'Zwischenspeichern...' . PHP_EOL; $pdf->Output($outputFile); // Hier geht jetzt der Hack wegen der Footerzeile weiter // Die gerade abgespeicherte Datei wird erneut eingelesen // um dann im Seiten-Format der Ursprungsdatei erneut abgespeichert zu werden. // Is' doof, muss aber sein $pdf_2 = new FPDI(); echo 'Erneut laden...' . PHP_EOL; $pageCount = $pdf_2->setSourceFile($outputFile); echo 'Feinschliff...' . PHP_EOL; $Vorderseite_2 = $pdf_2->ImportPage(1); $Rueckseite_2 = $pdf_2->ImportPage(2); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplVorderseite = $pdf_2->importPage(1); $pdf_2->useTemplate($tplVorderseite); $pdf_2->AddPage('L', array($dokumentBreite, $dokumentHoehe)); $tplRueckseite = $pdf_2->importPage(2); $pdf_2->useTemplate($tplRueckseite); echo 'Output: ' . basename($outputFile) . PHP_EOL; $pdf_2->Output($outputFile); unset($pdf); unset($pdf_2); }