public function runProcessStep($dokument)
 {
     $file = $dokument->getLatestRevision()->getFile();
     $extension = array_pop(explode(".", $file->getExportFilename()));
     #$this->ziphandler->addFile($file->getAbsoluteFilename(), $file->getExportFilename());
     // Print Metainfo for PDFs
     if (strtolower($extension) == "pdf") {
         try {
             $fpdf = new FPDI();
             $pagecount = $fpdf->setSourceFile($file->getAbsoluteFilename());
             $fpdf->SetMargins(0, 0, 0);
             $fpdf->SetFont('Courier', '', 8);
             $fpdf->SetTextColor(0, 0, 0);
             $documentSize = null;
             for ($i = 0; $i < $pagecount; $i++) {
                 $string = $dokument->getLatestRevision()->getIdentifier() . " (Seite " . ($i + 1) . " von " . $pagecount . ", Revision " . $dokument->getLatestRevision()->getRevisionID() . ")";
                 $fpdf->AddPage();
                 $tpl = $fpdf->importPage($i + 1);
                 $size = $fpdf->getTemplateSize($tpl);
                 // First Page defines documentSize
                 if ($documentSize === null) {
                     $documentSize = $size;
                 }
                 // Center Template on Document
                 $fpdf->useTemplate($tpl, intval(($documentSize["w"] - $size["w"]) / 2), intval(($documentSize["h"] - $size["h"]) / 2), 0, 0, true);
                 $fpdf->Text(intval($documentSize["w"]) - 10 - $fpdf->GetStringWidth($string), 5, $string);
             }
             $this->ziphandler->addFromString($dokument->getLatestRevision()->getIdentifier() . "." . $extension, $fpdf->Output("", "S"));
         } catch (Exception $e) {
             $this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
         }
     } else {
         $this->ziphandler->addFile($file->getAbsoluteFilename(), $dokument->getLatestRevision()->getIdentifier() . "." . $extension);
     }
 }
Пример #2
0
     $pdf->Write(0.3, $fax_header);
 }
 //fax, cover sheet
 $pdf->SetTextColor(0, 0, 0);
 $pdf->SetFont($pdf_font, "B", 55);
 $pdf->SetXY($x + 4.55, $y + 0.25);
 $pdf->Cell($x + 3.5, $y + 0.4, $text['label-fax-fax'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
 $pdf->SetFont($pdf_font, "", 12);
 $pdf->SetFontSpacing(0.0425);
 $pdf->SetXY($x + 4.55, $y + 1.0);
 $pdf->Cell($x + 3.5, $y + 0.4, $text['label-fax-cover-sheet'], 0, 0, 'R', false, null, 0, false, 'T', 'T');
 $pdf->SetFontSpacing(0);
 //field labels
 $pdf->SetFont($pdf_font, "B", 12);
 if ($fax_recipient != '' || sizeof($fax_numbers) > 0) {
     $pdf->Text($x + 0.5, $y + 2.0, strtoupper($text['label-fax-recipient']) . ":");
 }
 if ($fax_sender != '' || $fax_caller_id_number != '') {
     $pdf->Text($x + 0.5, $y + 2.3, strtoupper($text['label-fax-sender']) . ":");
 }
 if ($fax_page_count > 0) {
     $pdf->Text($x + 0.5, $y + 2.6, strtoupper($text['label-fax-attached']) . ":");
 }
 if ($fax_subject != '') {
     $pdf->Text($x + 0.5, $y + 2.9, strtoupper($text['label-fax-subject']) . ":");
 }
 //field values
 $pdf->SetFont($pdf_font, "", 12);
 $pdf->SetXY($x + 2.0, $y + 1.95);
 if ($fax_recipient != '') {
     $pdf->Write(0.3, $fax_recipient);
Пример #3
0
 public function save_design()
 {
     if ($this->input->post('mode') == 'edit') {
         $this->db->delete('designs', array('id' => $this->input->post('design_id')));
     }
     $faceMacket = str_replace('http://klever.media/', '', $this->input->post('faceMacket'));
     $backMacket = str_replace('http://klever.media/', '', $this->input->post('backMacket'));
     $face = $this->input->post('face');
     $back = $this->input->post('back');
     // get all fonts
     $query = $this->db->get('fonts');
     $fonts = array();
     foreach ($query->result() as $font) {
         $fonts[$font->family] = $font->source;
     }
     // generate pdf face template name and preview name
     $face_pdf = 'uploads/redactor/face_' . md5(microtime(true)) . '.pdf';
     $face_preview = 'uploads/redactor/face_' . md5(microtime(true)) . '.jpg';
     // convert face image to pdf
     $img = new Imagick($faceMacket);
     $img->setresolution(300, 300);
     $img->setcolorspace(Imagick::COLORSPACE_CMYK);
     $img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
     $img->setimageformat('pdf');
     $img->writeimage($face_pdf);
     // include TCPDF ana FPDI
     include_once APPPATH . 'libraries/tcpdf/tcpdf.php';
     include_once APPPATH . 'libraries/tcpdf/fpdi.php';
     include_once APPPATH . 'libraries/tcpdf/include/tcpdf_fonts.php';
     $fontMaker = new TCPDF_FONTS();
     // создаём лист
     $pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
     $pdf->SetMargins(0, 0, 0, true);
     $pdf->AddPage('L');
     // загрузим ранее сохранённый шаблон
     $pdf->setSourceFile($face_pdf);
     $pdf->SetMargins(0, 0, 0, true);
     $tplIdx = $pdf->importPage(1);
     $pdf->useTemplate($tplIdx, null, null, 0, 0, true);
     // установим опции для pdf
     $pdf->setCellHeightRatio(1);
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->setCellMargins(0, 0, 0, 0);
     $pdf->SetAutoPageBreak(false, 0);
     $pdf->SetPrintHeader(false);
     $pdf->SetPrintFooter(false);
     if (!empty($face)) {
         // отрисуем сначала изображения лица
         foreach ($face as $item) {
             if ($item['type'] == 'image') {
                 $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/' . str_replace('http://klever.media/', '', $item['content']), $this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $this->px_to_mm($item['width']), '', '', '', '', false, 300);
             }
         }
         // потом текст на лице
         foreach ($face as $item) {
             if ($item['type'] == 'text') {
                 $cmyk = $this->rgbToCmyk($item['color']);
                 $pdf->SetTextColor($cmyk['c'] * 100, $cmyk['m'] * 100, $cmyk['y'] * 100, $cmyk['k'] * 100);
                 // set font
                 $tcpdfFont = $fontMaker->addTTFfont(realpath('fonts/redactor/' . $fonts[$item['font']]));
                 $pdf->SetFont($tcpdfFont, '', $item['size'] / 2, '', 'false');
                 $pdf->Text($this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $item['content'], false, false, true, 0, 0, 'L', false, '', 0, false, 'T', 'L', false);
             }
         }
     }
     // сохраним пдф лица
     $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf, 'F');
     // сделаем превью для пользователя
     $im = new Imagick();
     $im->setResolution(300, 300);
     $im->readimage($face_pdf . '[0]');
     $im->flattenimages();
     $im->setImageFormat('jpg');
     $im->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
     $im->writeImage($face_preview);
     $im->clear();
     $im->destroy();
     //exec('$ convert ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_pdf . ' ' . $_SERVER['DOCUMENT_ROOT'] . '/' . $face_preview);
     // есть ли оборот
     if (!empty($backMacket)) {
         // generate pdf back template name and preview name
         $back_pdf = 'uploads/redactor/back_' . md5(microtime(true)) . '.pdf';
         $back_preview = 'uploads/redactor/back_' . md5(microtime(true)) . '.jpg';
         // convert back image to pdf
         $img = new Imagick($backMacket);
         $img->setresolution(300, 300);
         $img->setcolorspace(Imagick::COLORSPACE_CMYK);
         $img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
         $img->setimageformat('pdf');
         $img->writeimage($back_pdf);
         // создаём лист
         $pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
         $pdf->AddPage('L');
         // загрузим ранее сохранённый шаблон
         $pdf->setSourceFile($_SERVER['DOCUMENT_ROOT'] . '/' . $back_pdf);
         $pdf->SetMargins(0, 0, 0, true);
         $tplIdx = $pdf->importPage(1);
         $pdf->useTemplate($tplIdx, null, null, 0, 0, true);
         // установим опции для pdf
         $pdf->SetMargins(0, 0, 0, true);
         $pdf->setCellHeightRatio(1);
         $pdf->setCellPaddings(0, 0, 0, 0);
         $pdf->setCellMargins(1, 1, 1, 1);
         $pdf->SetAutoPageBreak(false);
         $pdf->SetPrintHeader(false);
         $pdf->SetPrintFooter(false);
         if (!empty($back)) {
             // отрисуем сначала изображения оборота
             foreach ($back as $item) {
                 if ($item['type'] == 'image') {
                     $pdf->Image($_SERVER['DOCUMENT_ROOT'] . '/' . str_replace('http://klever.media/', '', $item['content']), $this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $this->px_to_mm($item['width']), '', '', '', '', false, 300);
                 }
             }
             // потом текст на обороте
             foreach ($back as $item) {
                 if ($item['type'] == 'text') {
                     $cmyk = $this->rgbToCmyk($item['color']);
                     $pdf->SetTextColor($cmyk['c'] * 100, $cmyk['m'] * 100, $cmyk['y'] * 100, $cmyk['k'] * 100);
                     // set font
                     $tcpdfFont = $fontMaker->addTTFfont($_SERVER['DOCUMENT_ROOT'] . '/fonts/redactor/' . $fonts[$item['font']]);
                     $pdf->SetFont($tcpdfFont, '', $item['size'] / 2, '', 'false');
                     $pdf->Text($this->px_to_mm($item['left']), $this->px_to_mm($item['top']), $item['content'], false, false, true, 0, 0, 'L', false, '', 0, false, 'T', 'L', false);
                 }
             }
         }
         // сохраним пдф оборота
         $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/' . $back_pdf, 'F');
         // сделаем превью для пользователя
         $im = new Imagick();
         $im->setResolution(300, 300);
         $im->readimage($back_pdf . '[0]');
         $im->setImageFormat('jpg');
         $im->flattenimages();
         $im->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
         $im->writeImage($back_preview);
         $im->clear();
         $im->destroy();
     }
     $this->db->insert('products', array('name' => 'cards_pvc', 'tiraj' => 100, 'weight' => 0.5, 'price' => 0.49, 'cost' => 49, 'macket' => 'my_macket'));
     $product_id = $this->db->insert_id();
     $this->db->insert('designs', array('product_id' => $product_id, 'theme_id' => $this->input->post('theme'), 'face_background' => $faceMacket, 'back_background' => empty($backMacket) ? NULL : $backMacket, 'face' => $face_preview, 'back' => empty($back_preview) ? '' : $back_preview, 'type' => 'system'));
     $design_id = $this->db->insert_id();
     $options = array();
     if (!empty($face)) {
         foreach ($face as $item) {
             if ($item['type'] == 'text') {
                 $options[] = array('design_id' => $design_id, 'type' => 'text', 'front' => 'face', 'top' => $item['top'], 'left' => $item['left'], 'width' => NULL, 'height' => NULL, 'content' => $item['content'], 'font' => $item['font'], 'color' => $item['color'], 'size' => $item['size']);
             } else {
                 $options[] = array('design_id' => $design_id, 'type' => 'image', 'front' => 'face', 'top' => $item['top'], 'left' => $item['left'], 'width' => $item['width'], 'height' => $item['height'], 'content' => $item['content'], 'font' => NULL, 'color' => NULL, 'size' => NULL);
             }
         }
     }
     if (!empty($back)) {
         foreach ($back as $item) {
             if ($item['type'] == 'text') {
                 $options[] = array('design_id' => $design_id, 'type' => 'text', 'front' => 'back', 'top' => $item['top'], 'left' => $item['left'], 'width' => NULL, 'height' => NULL, 'content' => $item['content'], 'font' => $item['font'], 'color' => $item['color'], 'size' => $item['size']);
             } else {
                 $options[] = array('design_id' => $design_id, 'type' => 'image', 'front' => 'back', 'top' => $item['top'], 'left' => $item['left'], 'width' => $item['width'], 'height' => $item['height'], 'content' => $item['content'], 'font' => NULL, 'color' => NULL, 'size' => NULL);
             }
         }
     }
     if (count($options) > 0) {
         $this->db->insert_batch('design_options', $options);
     }
     echo 'OK';
 }
Пример #4
0
//-------------------------------------------------------------------------------------------- 
//--------------------------------------------------------------------------------------------
		
		$pdf = new FPDI();
		$pdf->setSourceFile($_SERVER["DOCUMENT_ROOT"]."/modules/varios/tesoreria/templates/reporte_reemplazo.pdf");


		$pdf->AddPage();
		$tplIdx = $pdf->importPage(1);
		$pdf->SetAuthor('ART');
		$pdf->useTemplate($tplIdx);

		// Dibujo la cabecera..
		$pdf->SetFont("Arial", "", 16);
		$pdf->Text(75, 15, $rowCabecera["OP"]);

		$pdf->SetFont("Arial", "", 11);
		$pdf->Text(40, 21, $rowCabecera["BENEFICIARIO"]);

		$pdf->SetFont("Arial", "", 7);
		$pdf->Text(32, 34, $rowCabecera2["VENDOR_NAME"]);
//---------------------------------------------------------------------------				
		$pdf->Text(32, 38, $rowCabecera2["ADDRESS_LINE1"]);
		$pdf->Text(32, 41, $rowCabecera2["ADDRESS_LINE2"]);
		$pdf->Text(32, 44, $rowCabecera2["CITY"]);
		$pdf->Text(32, 47, $rowCabecera2["STATE"]);				
		$pdf->Text(33, 57, $rowCabecera2["ZIP"]);
//---------------------------------------------------------------------------				
		$pdf->Text(146, 47, $rowCabecera["FECHA_OP"]);
		$pdf->Text(146, 53, 'PES');				
Пример #5
0
$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"]));
$pdf->Text($repcnt[x], $repcnt[y], $masch["counter"]);
$pdf->Text($repinsp[x], $repinsp[y], db2date($masch["inspdatum"]));
$pdf->Text($repkurz[x], $repkurz[y], utf8_decode($rep["cause"]));
$pdf->SetY($replang[x]);
Пример #6
0
 public function test()
 {
     //        $rgb_arr = sscanf('rgb(243, 243, 243)', "rgb(%d, %d, %d)");
     //        print_r($this->rgbToCmyk($rgb_arr[0], $rgb_arr[1], $rgb_arr[2]));
     //        exit();
     //
     $img = new Imagick('test.jpg');
     $img->resizeimage(1076, 720, Imagick::FILTER_LANCZOS, 1);
     $img->setresolution(300, 300);
     $img->setimageformat('pdf');
     $img->writeimage('test.pdf');
     include_once APPPATH . 'libraries/tcpdf/tcpdf.php';
     include_once APPPATH . 'libraries/tcpdf/fpdi.php';
     // создаём лист
     $pdf = new FPDI('L', 'mm', array(91, 61), true, 'UTF-8', false);
     $pdf->AddPage('L');
     // загрузим ранее сохранённый шаблон
     $pdf->setSourceFile('test.pdf');
     $pdf->SetMargins(0, 0, 0, true);
     $tplIdx = $pdf->importPage(1);
     $pdf->useTemplate($tplIdx, null, null, 0, 0, true);
     // установим опции для pdf
     $pdf->SetMargins(0, 0, 0, true);
     $pdf->setCellHeightRatio(1);
     $pdf->setCellPaddings(0, 0, 0, 0);
     $pdf->setCellMargins(1, 1, 1, 1);
     $pdf->SetAutoPageBreak(false);
     $pdf->SetPrintHeader(false);
     $pdf->SetPrintFooter(false);
     $pdf->Image('qwe.png', 30, 30, 20, '', '', '', '', false, 300);
     $pdf->SetTextColor(0, 0, 0, 100);
     $pdf->SetFont('helvetica', 'BI', 10, '', 'false');
     $pdf->Text(12, 9, 'Black CMYK');
     $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/uploads/fynal.pdf', 'F');
     $im = new Imagick();
     $im->setResolution(300, 300);
     $im->readimage('uploads/fynal.pdf[0]');
     $im->setImageFormat('jpeg');
     $im->resizeimage(538, 360, Imagick::FILTER_LANCZOS, 1);
     $im->writeImage('uploads/fynal.jpg');
     $im->clear();
     $im->destroy();
     //        include_once APPPATH . 'libraries/drawer.php';
     //
     //        $drawer = new Drawer();
     //        $drawer->init();
     //        $drawer->setLayout();
     //        $drawer->setBackground('test.jpg');
     //        $drawer->drawImage('test.jpg', 10, 10, 30);
     //        $drawer->drawText('Maxim', 10, 10, 'TimesNewRoman', 20, 'rgb(77, 77, 77)');
     //        $drawer->savePdf($_SERVER['DOCUMENT_ROOT'] . '/1.pdf');
     //        $drawer->makePreview($_SERVER['DOCUMENT_ROOT'] . '/1.pdf', $_SERVER['DOCUMENT_ROOT'] . '/1.jpg');
 }
Пример #7
0
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]);
$pdf->MultiCell(0, 6, $bem, 0);
for ($j = 2; $j <= $seiten; $j++) {
    $hdl = @$pdf->ImportPage($j);
    $pdf->addPage();
Пример #8
-1
 public function generateCoupon($coupon_image_url, $user_id, $email_id)
 {
     require_once $_SERVER['DOCUMENT_ROOT'] . '/application/libraries/fpdf/fpdf.php';
     require_once $_SERVER['DOCUMENT_ROOT'] . '/application/libraries/fpdf/fpdi.php';
     $pdf = new FPDI();
     $pageCount = $pdf->setSourceFile($_SERVER['DOCUMENT_ROOT'] . "/application/libraries/coupon.pdf");
     $tplIdx = $pdf->importPage(1, '/MediaBox');
     $count = 0;
     $y = 145.5;
     $i = 1;
     $amt = 0;
     $pdf->addPage();
     $pdf->useTemplate($tplIdx, 3, 3, 210, 300);
     $pdf->SetFont('Arial', '', '9');
     $pdf->SetTextColor(0, 0, 0);
     $pdf->Text(50, 80, 'User ID :');
     $pdf->Text(100, 80, $user_id);
     $pdf->Text(50, 90, 'Email ID :');
     $pdf->Text(100, 90, $email_id);
     $pdf->Image($coupon_image_url, 50, 100);
     $save_status = 1;
     if (!$save_status) {
         $pdf->Output();
     } else {
         $pdf->Output($_SERVER['DOCUMENT_ROOT'] . '/images/coupons/' . 'coupon_' . $user_id . '.pdf', 'F');
     }
 }