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(); }
} if ($_SESSION['status'] == "admin") { $query = "SELECT * FROM `abiturients` WHERE `ab_id` = '" . $id . "'"; $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 = ", денна форма навчання"; }
public function view_sign_oc(){ require_once('./assets/fpdf17/fpdf.php'); require_once('./assets/fpdf17/fpdi.php'); $oc_id=$this->uri->segment(3,''); // init pce data $oc_dat=$this->m_oc->get_oc_by_id($oc_id); $project=$this->m_project->get_project_by_id($oc_dat->project_id); //init sign pic $ae_sign_user_dat=$this->m_user->get_user_by_login_name($project->project_cs); $ae_sign_filename="no"; if (isset($ae_sign_user_dat->sign_filename)) { $ae_sign_filename=$ae_sign_user_dat->sign_filename; } $finance_sign_dat=$this->m_user->get_user_by_login_name($oc_dat->fc_sign); $finance_sign_filename="no"; if (isset($finance_sign_dat->sign_filename)) { $finance_sign_filename=$finance_sign_dat->sign_filename; } // initiate FPDI $pdf = new FPDI(); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวธรรมดา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','','angsa.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','B','angsab.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','I','angsai.php'); // เพิ่มฟอนต์ภาษาไทยเข้ามา ตัวหนา กำหนด ชื่อ เป็น angsana $pdf->AddFont('angsana','BI','angsaz.php'); // get the page count $pageCount = $pdf->setSourceFile("./media/real_pdf/".$oc_dat->filename); // iterate through all pages for ($pageNo = 1; $pageNo <= $pageCount; $pageNo++) { // import a page $templateId = $pdf->importPage($pageNo); // get the size of the imported page $size = $pdf->getTemplateSize($templateId); // create a page (landscape or portrait depending on the imported page size) if ($size['w'] > $size['h']) { $pdf->AddPage('L', array($size['w'], $size['h'])); } else { $pdf->AddPage('P', array($size['w'], $size['h'])); } // use the imported page $pdf->useTemplate($templateId); $pdf->SetTextColor(0,0,0); $pdf->SetFont('angsana','B',14); $pdf->SetXY(5, 5); //$pdf->Write(8, 'A complete document imported with FPDI'); //// temporaly disable if ($finance_sign_filename!="no"&&$finance_sign_filename!=""&&$finance_sign_filename!=null) { //$pdf->Image("./media/sign_photo/".$finance_sign_filename,100,10,40,0); } if ($ae_sign_filename!="no"&&$ae_sign_filename!=""&&$ae_sign_filename!=null) { //$pdf->Image("./media/sign_photo/".$ae_sign_filename,100,110,40,0); } //$pdf->Image("images/play.png",100,100,100,0); } $new_filename=$oc_dat->oc_no."_A.pdf"; // Output the new PDF //@unlink("./media/real_pdf/".$new_filename); $pdf->Output($new_filename,"I"); //redirect("media/real_pdf/".$new_filename); }
function write_instruction($rec_ind, $q, $data) { // $ind = recipe index, $q = quote array, $data = recipe data array // Dynamic Data $bul = html_entity_decode("•", ENT_HTML401, "cp1252"); $deg = html_entity_decode("°", ENT_HTML401, "cp1252"); $recipe = $data[$rec_ind][0]; $style = $data[$rec_ind][1]; $og = $data[$rec_ind][2]; $fg = $data[$rec_ind][3]; $abv = $data[$rec_ind][4] . "%"; //$hop1 = $bul . " " . $data[$rec_ind][5]; if (empty($data[$rec_ind][5])) { $hop1 = ""; } else { $hop1 = $bul . " " . $data[$rec_ind][5]; } if (empty($data[$rec_ind][6])) { $hop2 = ""; } else { $hop2 = $bul . " " . $data[$rec_ind][6]; } if (empty($data[$rec_ind][7])) { $hop3 = ""; } else { $hop3 = $bul . " " . $data[$rec_ind][7]; } if (empty($data[$rec_ind][8])) { $hop4 = ""; } else { $hop4 = $bul . " " . $data[$rec_ind][8]; } if (empty($data[$rec_ind][9])) { $hop5 = ""; } else { $hop5 = $bul . " " . $data[$rec_ind][9]; } if (empty($data[$rec_ind][10])) { $hop6 = ""; } else { $hop6 = $bul . " " . $data[$rec_ind][10]; } if (empty($data[$rec_ind][11])) { $sp_inst = "No special instructions needed. Instead, we have included a quote about beer: \n" . $q[rand(0, 12)]; } else { $sp_inst = $data[$rec_ind][11]; } if (empty($data[$rec_ind][12])) { $ing1 = ""; } else { $ing1 = $bul . " " . $data[$rec_ind][12]; } if (empty($data[$rec_ind][13])) { $ing2 = ""; } else { $ing2 = $bul . " " . $data[$rec_ind][13]; } if (empty($data[$rec_ind][14])) { $ing3 = ""; } else { $ing3 = $bul . " " . $data[$rec_ind][14]; } if (empty($data[$rec_ind][15])) { $ing4 = ""; } else { $ing4 = $bul . " " . $data[$rec_ind][15]; } if (empty($data[$rec_ind][16])) { $ing5 = ""; } else { $ing5 = $bul . " " . $data[$rec_ind][16]; } if (empty($data[$rec_ind][17])) { $ing6 = ""; } else { $ing6 = $bul . " " . $data[$rec_ind][17]; } if (empty($data[$rec_ind][18])) { $ing7 = ""; } else { $ing7 = $bul . " " . $data[$rec_ind][18]; } if (empty($data[$rec_ind][19])) { $ing8 = ""; } else { $ing8 = $bul . " " . $data[$rec_ind][19]; } if (empty($data[$rec_ind][20])) { $ing9 = ""; } else { $ing9 = $bul . " " . $data[$rec_ind][20]; } if (empty($data[$rec_ind][21])) { $ing10 = ""; } else { $ing10 = $bul . " " . $data[$rec_ind][21]; } if (empty($data[$rec_ind][22])) { $ing11 = ""; } else { $ing11 = $bul . " " . $data[$rec_ind][22]; } if (empty($data[$rec_ind][23])) { $ing12 = ""; } else { $ing12 = $bul . " " . $data[$rec_ind][23]; } if (empty($data[$rec_ind][24])) { $ing13 = ""; } else { $ing13 = $bul . " " . $data[$rec_ind][24]; } if (empty($data[$rec_ind][25])) { $ing14 = ""; } else { $ing14 = $bul . " " . $data[$rec_ind][25]; } if (empty($data[$rec_ind][26])) { $ing15 = ""; } else { $ing15 = $bul . " " . $data[$rec_ind][26]; } if (empty($data[$rec_ind][27])) { $ing16 = ""; } else { $ing16 = $bul . " " . $data[$rec_ind][27]; } if (empty($data[$rec_ind][28])) { $ing17 = ""; } else { $ing17 = $bul . " " . $data[$rec_ind][28]; } if (empty($data[$rec_ind][29])) { $ing18 = ""; } else { $ing18 = $bul . " " . $data[$rec_ind][29]; } // Initiate FPDI & FPDF $pdf = new FPDI(); $pdf->setSourceFile("extract_template.pdf"); // Create page 1 & Read Template Page 1 $pdf->AddPage('P', 'Letter'); $tmp = $pdf->importPage(1); $pdf->useTemplate($tmp, 0, 0); // Declare Fonts $pdf->AddFont('Kenyancoffee', '', 'Kenyancoffeerg.php'); $pdf->AddFont('Roboto', '', 'Roboto-Regular.php'); $pdf->AddFont('Roboto', 'L', 'Roboto-Light.php'); $pdf->AddFont('Roboto', 'B', 'Roboto-Bold.php'); // Write Dynamic Data - Header $pdf->SetFont('Kenyancoffee', '', 23); $pdf->SetTextColor(229, 80, 84); $pdf->SetXY(57.3, 19); $pdf->Cell(0, 0, $recipe); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(57.3, 25.5); $pdf->Cell(0, 0, $style); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(65.2, 36.2); $pdf->Cell(0, 0, $og); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(85.2, 36.2); $pdf->Cell(0, 0, $fg); $pdf->SetFont('Roboto', 'L', 9.9); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(108.5, 36.2); $pdf->Cell(0, 0, $abv); // Write Dynamic Data - Ingredients $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 156.5); $pdf->Cell(0, 0, $ing1); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 161.5); $pdf->Cell(0, 0, $ing2); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 166.5); $pdf->Cell(0, 0, $ing3); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 171.5); $pdf->Cell(0, 0, $ing4); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 176.5); $pdf->Cell(0, 0, $ing5); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 181.5); $pdf->Cell(0, 0, $ing6); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 186.5); $pdf->Cell(0, 0, $ing7); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 191.5); $pdf->Cell(0, 0, $ing8); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 196.5); $pdf->Cell(0, 0, $ing9); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 201.5); $pdf->Cell(0, 0, $ing10); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 206.5); $pdf->Cell(0, 0, $ing11); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 211.5); $pdf->Cell(0, 0, $ing12); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 216.5); $pdf->Cell(0, 0, $ing13); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 221.5); $pdf->Cell(0, 0, $ing14); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 226.5); $pdf->Cell(0, 0, $ing15); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 231.5); $pdf->Cell(0, 0, $ing16); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 236.5); $pdf->Cell(0, 0, $ing17); $pdf->SetFont('Roboto', 'B', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(5.3, 241.5); $pdf->Cell(0, 0, $ing18); // Write Dynamic Data - Hop Schedule $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 171); $pdf->Cell(0, 0, $hop1); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 174.2); $pdf->Cell(0, 0, $hop2); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 177.4); $pdf->Cell(0, 0, $hop3); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 180.6); $pdf->Cell(0, 0, $hop4); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 183.8); $pdf->Cell(0, 0, $hop5); $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(114, 187); $pdf->Cell(0, 0, $hop6); // Create page 2 & Read Template Page 2 $pdf->AddPage('P', 'Letter'); $tmp = $pdf->importPage(2); $pdf->useTemplate($tmp, 0, 0); // Write Dynamic Data - Special Instructions $pdf->SetFont('Roboto', '', 7.5); $pdf->SetTextColor(255, 255, 255); $pdf->SetXY(11, 13); $pdf->MultiCell(165, 3, utf8_decode($sp_inst)); $shortname = str_replace(' ', '', $recipe); $filename = "C:/Users/tyler/Google Drive/MonsterBrew/Product/Recipe Kits/Instructions/Instructions - Extract/EX_INS_" . $shortname . ".pdf"; $pdf->Output($filename, 'F'); }
class FPDF extends tFPDF { protected $_tplIdx; } $pdf = new FPDI(); if ($user->getPrivilege() <= 10) { $source = "docs/certificatelead.pdf"; } else { $source = "docs/certificate.pdf"; } $pagecount = $pdf->setSourceFile($source); $tplidx = $pdf->importPage(1); $pdf->addPage('L'); $pdf->useTemplate($tplidx, 0, 0, 0); $date = date('jS F Y'); $pdf->AddFont('DejaVu', '', 'DejaVuSansCondensed.ttf', true); $pdf->SetFont('DejaVu', '', 30); $pdf->SetTextColor(0, 0, 0); $pdf->SetXY(0, 95); $pdf->Cell(297, 15, $name, 0, 0, 'C', 0); $pdf->SetFont('Arial', '', 18); $pdf->SetXY(170, 160); $pdf->Write(0, $date); $attachment = $pdf->output('Certificate.pdf', 'S'); header('Pragma: public'); header('Expires: -1'); header('Content-Transfer-Encoding: binary'); header('Content-Type: application/pdf'); header('Content-Disposition: attachment;filename="ISOS%20Certificate.pdf"'); header('Cache-Control: max-age=0'); // output the file
} $contract_data = mysql_fetch_assoc(mysql_query($query)); //Получаем данные страхователя $insurer_data = mysql_fetch_assoc(mysql_query("SELECT * FROM `" . ($contract_data["insurer_type"] == 1 ? "contact_phiz" : "contact_jur") . "` WHERE `id` = '" . $contract_data["insurer_id"] . "'")); $owner_data = mysql_fetch_assoc(mysql_query("SELECT * FROM `" . ($contract_data["owner_type"] == 1 ? "contact_phiz" : "contact_jur") . "` WHERE `id` = '" . $contract_data["owner_id"] . "'")); $vehicle_data = unserialize($contract_data['vehicle_data']); $step_2_data = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", $contract_data['step_2_data']); //боримся с проблемой unserialize если есть кавычки $step_2_data = unserialize($step_2_data); $calc_data = unserialize($contract_data['calc_data']); $calc_result = unserialize($contract_data['calc_result']); require_once 'fpdf17/fpdf.php'; require_once 'fpdi/fpdi.php'; //Вносим необходимые данные в полис и отдаём в формате pdf $pdf = new FPDI(); $pdf->AddFont('ArialMT', '', 'arial_cyr.php'); $pdf->AddFont('Arial-BoldMT', '', 'arialbold.php'); $pdf->AddPage(); // $pdf->setSourceFile('blank/bso3.pdf'); // // Указываем номер импортируемой страницы // $tplIdx = $pdf->importPage(1); // //указываем размер страницы // //$pdf->useTemplate($tplIdx, 0, 0, 210, 297, true); // $pdf->useTemplate($tplIdx, 0, 0, 210, 297, true); //Ставим поля по нулям $pdf->SetMargins(0, 0, 0, 0); $pdf->SetAutoPageBreak(false); //указываем шрифт и размер $pdf->SetFont('Arial-BoldMT', '', '13'); //указываем цвет текста $pdf->SetTextColor(0, 0, 0);
$file = __DIR__ . '/cupon_001.pdf'; if (!file_exists($file)) { die("File does not exist"); } else { $fullName = $_REQUEST['suname'] . ' ' . $_REQUEST['name'] . ' ' . $_REQUEST['midlname']; $currentDate = currentDate(); $cuponNum = generateCuponNumber(); sendEmail($cuponNum, $currentDate, $fullName); $pdf = new FPDI(); $pdf->setSourceFile($file); $tpl = $pdf->importPage(1); $size = $pdf->getTemplateSize($tpl); $orientation = $size['h'] > $size['w'] ? 'P' : 'L'; $pdf->AddPage($orientation); $pdf->useTemplate($tpl, null, null, $size['w'], $size['h'], true); $pdf->AddFont('AgencyFBCyrillic', '', 'agenfbcyr.php'); $pdf->AddFont('GoodVibesPro', '', 'good_vibes_pro_regular.php'); $pdf->SetXY(41.628, 91.017); $pdf->SetFont('GoodVibesPro', '', 40); $pdf->SetTextColor(184, 153, 106); $pdf->Cell(212.019, 20.814, iconv('UTF-8', 'CP1251', $fullName), 0, 2, 'C'); $pdf->SetXY(56.797, 160.396); $pdf->SetFont('AgencyFBCyrillic', '', 21); $pdf->SetTextColor(32, 22, 0); $pdf->Cell(44.097, 7.173, iconv('UTF-8', 'CP1251', $currentDate), 0, 2, 'C'); $pdf->SetXY(194.263, 160.396); $pdf->SetFont('AgencyFBCyrillic', '', 21); $pdf->SetTextColor(32, 22, 0); $pdf->Cell(44.332, 7.173, iconv('UTF-8', 'CP1251', $cuponNum), 0, 2, 'C'); $pdf->Output('Your_Cupon.pdf', 'D'); }
// just require FPDI afterwards require_once './FPDI-1.4.4/fpdi.php'; // Page in is in mm -- 215.9 wide, by 279.4 = 8.5 x 11 inches // initiate PDF $pdf = new FPDI("P", "mm", "letter"); // Shortcut so we don't have to write $this_border so much; $b = $pdf->border; // Set page break distance from bottom $pdf->SetAutoPageBreak(false, 30); // Load the dynamic content from the post $content = json_decode(utf8_encode($_POST['content'])); $pdf->content = $content; // Note - Don't add all the fonts. They all get embedded in the PDF wether you use them or not. // Add some Unicode font (uses UTF-8) // Hairline $pdf->AddFont('Lato-100', '', 'Lato-Hai.ttf', true); // Regular $pdf->AddFont('Lato', '', 'Lato-Lig.ttf', true); // Bold $pdf->AddFont('Lato', 'B', 'Lato-Reg.ttf', true); // Really Bold $pdf->AddFont('Lato-700', '', 'Lato-Bol.ttf', true); // $pdf->SetFont('Lato', '', 10); $pdf->AddPage("portrait", "letter"); $font["h4"] = 16; $font["h3"] = 20; $font["h2"] = 17; $font["h1"] = 19.5; $font["legend"] = 12; $font["label"] = array(9, 10, 12);
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); }