当前位置: 首页>>代码示例>>PHP>>正文


PHP TCPDF::Image方法代码示例

本文整理汇总了PHP中TCPDF::Image方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::Image方法的具体用法?PHP TCPDF::Image怎么用?PHP TCPDF::Image使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TCPDF的用法示例。


在下文中一共展示了TCPDF::Image方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testPdfOutput

 public function testPdfOutput()
 {
     $this->markTestIncomplete('Transparency rendering on signature not working.');
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 052');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 052', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     /*
     NOTES:
      - To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
      - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
      - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
     */
     // set certificate file
     $certificate = 'file://tests/data/cert/tcpdf.crt';
     // set additional information
     $info = array('Name' => 'TCPDF', 'Location' => 'Office', 'Reason' => 'Testing TCPDF', 'ContactInfo' => 'http://www.tcpdf.org');
     // set document signature
     $pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
     // set font
     $pdf->SetFont('helvetica', '', 12);
     // add a page
     $pdf->AddPage();
     // print a line of text
     $text = 'This is a <b color="#FF0000">digitally signed document</b> using the default (example) <b>tcpdf.crt</b> certificate.<br />To validate this signature you have to load the <b color="#006600">tcpdf.fdf</b> on the Arobat Reader to add the certificate to <i>List of Trusted Identities</i>.<br /><br />For more information check the source code of this example and the source code documentation for the <i>setSignature()</i> method.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
     $pdf->writeHTML($text, true, 0, true, 0);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // *** set signature appearance ***
     // create content for signature (image and/or text)
     $pdf->Image('tests/images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG');
     // define active area for signature appearance
     $pdf->setSignatureAppearance(180, 60, 15, 15);
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // *** set an empty signature appearance ***
     $pdf->addEmptySignatureAppearance(180, 80, 15, 15);
     $this->comparePdfs($pdf);
 }
开发者ID:fooman,项目名称:tcpdf,代码行数:59,代码来源:Example052Test.php

示例2: student_kolizijapdf


//.........这里部分代码省略.........
    if (mysql_num_rows($q20) == 1) {
        $ima_preneseni = 1;
        $preneseni_sifra = mysql_result($q20, 0, 0);
        $preneseni_naziv = mysql_result($q20, 0, 1);
        $preneseni_ects = mysql_result($q20, 0, 2);
        $preneseni_semestar = mysql_result($q20, 0, 3);
    } else {
        $ima_preneseni = 0;
    }
    // Privremeni hack za master
    if ($tipstudija == 3) {
        $mscfile = "-msc";
    } else {
        if ($tipstudija == 2) {
            $mscfile = "";
        }
    }
    // Ako čovjek upisuje prvu godinu nečeka (mastera), broj indexa je netačan!
    if ($godina == 1) {
        $brindexa = "";
    }
    // ----- Pravljenje PDF dokumenta
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Domestic Learning Agreement / Ugovor o ucenju');
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(0, 0, 0);
    //set auto page breaks
    $pdf->SetAutoPageBreak(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('freesans', 'B', 9);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // add a page
    $pdf->AddPage();
    //	$pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150);
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-0.png", 0, 0, 210, 0, '', '', '', true, 150);
    $pdf->SetXY(175, 34);
    $pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
    $pdf->SetXY(175, 42);
    $pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
    $pdf->SetXY(175, 50);
    $pdf->Cell(23, 0, $sem1 . ". & " . $sem2, 0, 0, 'C');
    $pdf->SetXY(70, 48);
    $pdf->Cell(100, 0, $studijeng, 0, 0);
    $pdf->SetXY(70, 52);
    $pdf->Cell(100, 0, $studijbos, 0, 0);
    $pdf->SetXY(70, 62);
    $pdf->Cell(100, 0, $imeprezime);
    $pdf->SetXY(70, 69);
    $pdf->Cell(100, 0, $brindexa);
    // PRVI SEMESTAR
    $pdf->AddPage();
    $pdf->Image("images/content/150dpi/domestic-contract{$mscfile}-1.png", 0, 0, 210);
    $pdf->SetXY(175, 34);
开发者ID:msehalic,项目名称:zamger,代码行数:67,代码来源:kolizijapdf.php

示例3: createPdfFromImage

 function createPdfFromImage($arrImagename, $strFilename)
 {
     $this->load->library('tcpdf/TCPDF');
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
         require_once dirname(__FILE__) . '/lang/eng.php';
         $pdf->setLanguageArray($l);
     }
     // -------------------------------------------------------------------
     $pdf->AddPage();
     $pdf->setJPEGQuality(75);
     $imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
     $pdf->Image('@' . $imgdata);
     $intY = 25;
     foreach ($arrImagename as $intkey => $oneImage) {
         if ($intkey % 2 == 0 && $intkey != 0) {
             $intY = 25;
             $pdf->AddPage();
         }
         $pdf->Image($oneImage, 10, $intY, 180, 103, 'png', '', 'C', true, 150, '', false, false, 1, false, false, false);
         $intY += 125;
     }
     $pdf->Output($strFilename . '.pdf', 'I');
 }
开发者ID:riyajk,项目名称:nmsApp,代码行数:33,代码来源:Report.php

示例4: izvjestaj_prijemni_brzi_unos

function izvjestaj_prijemni_brzi_unos()
{
    require_once 'lib/tcpdf/tcpdf.php';
    $termin = intval($_REQUEST['termin']);
    $osoba = intval($_REQUEST['osoba']);
    $q10 = myquery("select ime, prezime, imeoca, jmbg from osoba where id={$osoba}");
    if (mysql_num_rows($q10) < 1) {
        biguglyerror("Nepostojeća osoba");
        zamgerlog("nepostojeca osoba {$osoba}", 3);
        return;
    }
    $ime = mysql_result($q10, 0, 0);
    $prezime = mysql_result($q10, 0, 1);
    $imeoca = mysql_result($q10, 0, 2);
    $jmbg = mysql_result($q10, 0, 3);
    $q20 = myquery("select sifra, jezik from prijemni_obrazac where osoba={$osoba} and prijemni_termin={$termin}");
    if (mysql_num_rows($q20) < 1) {
        biguglyerror("Ne postoji obrazac za ovu osobu");
        zamgerlog("za osobu u{$osoba} ne postoji obrazac na terminu {$termin}", 3);
        return;
    }
    $sifra = mysql_result($q20, 0, 0);
    $jezik = mysql_result($q20, 0, 1);
    $datum = date("d. m. Y.");
    $vrijeme = date("h:i");
    // ----- Pravljenje PDF dokumenta
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set document information
    $pdf->SetCreator("Zamger");
    $pdf->SetTitle('Sifra kandidata i pregled vaznijih datuma');
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(0, 0, 0);
    //set auto page breaks
    $pdf->SetAutoPageBreak(false);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
    $pdf->setJPEGQuality(100);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('freesans', '', 48);
    $pdf->SetHeaderData("", 0, "", "");
    $pdf->SetPrintHeader(false);
    $pdf->SetPrintFooter(false);
    // add a page
    $pdf->AddPage();
    //	$pdf->Image("images/content/150dpi/ETF-Domestic-contract-PGS-ALL-0.png",210,297,0,0,'','','',true,150);
    if ($jezik == "en") {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom_en.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 7;
    } else {
        $pdf->Image("images/content/150dpi/obrazac_sa_sifrom.png", 0, 0, 210, 0, '', '', '', true, 150);
        $en_offset = 0;
    }
    $pdf->SetXY(130, 15);
    $pdf->Cell(23, 0, $sifra, 0, 0, 'C');
    $pdf->SetFont('freesans', '', 16);
    $pdf->SetXY(80, 62 + $en_offset);
    $pdf->Cell(23, 0, "{$ime} ({$imeoca}) {$prezime}");
    $pdf->SetXY(80, 73 + $en_offset);
    $pdf->Cell(23, 0, $jmbg);
    $pdf->SetFont('freesans', '', 14);
    $pdf->SetXY(40, 113 + $en_offset);
    $pdf->Cell(23, 0, $datum);
    $pdf->SetXY(130, 113 + $en_offset);
    $pdf->Cell(23, 0, $vrijeme);
    // ---------------------------------------------------------
    //Close and output PDF document
    $pdf->Output('obrazac_sa_sifrom.pdf', 'I');
    //============================================================+
    // END OF FILE
    //============================================================+
}
开发者ID:msehalic,项目名称:zamger,代码行数:77,代码来源:prijemni_brzi_unos.php

示例5: testPdfOutput

 public function testPdfOutput()
 {
     $this->markTestIncomplete('Travis failure needs further investigation. ');
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 042');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 042', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set JPEG quality
     //$pdf->setJPEGQuality(75);
     $pdf->SetFont('helvetica', '', 18);
     // add a page
     $pdf->AddPage();
     // create background text
     $background_text = str_repeat('TCPDF test PNG Alpha Channel ', 50);
     $pdf->MultiCell(0, 5, $background_text, 0, 'J', 0, 2, '', '', true, 0, false);
     // --- Method (A) ------------------------------------------
     // the Image() method recognizes the alpha channel embedded on the image:
     $pdf->SetAlpha(0.71);
     $pdf->Image('tests/images/image_with_alpha.png', 50, 50, 100, '', '', 'http://www.tcpdf.org', '', false, 300);
     $pdf->SetAlpha(1);
     // --- Method (B) ------------------------------------------
     // provide image + separate 8-bit mask
     // first embed mask image (w, h, x and y will be ignored, the image will be scaled to the target image's size)
     $mask = $pdf->Image('tests/images/alpha.png', 50, 140, 100, '', '', '', '', false, 300, '', true);
     // embed image, masked with previously embedded mask
     $pdf->Image('tests/images/img.png', 50, 140, 100, '', '', 'http://www.tcpdf.org', '', false, 300, '', false, $mask);
     $this->comparePdfs($pdf);
 }
开发者ID:fooman,项目名称:tcpdf,代码行数:50,代码来源:Example042Test.php

示例6: processing

 function processing($contextData, $options)
 {
     $prodId = $contextData[0]['id'];
     $prodName = $contextData[0]['name'];
     $unitPrice = $contextData[0]['unitprice'];
     $pFile = $contextData[0]['photofile'];
     $timestamp = new DateTime();
     $tsString = $timestamp->format("Y-m-d H:i:s");
     $fileName = "{$prodId}.pdf";
     require_once './tcpdf/tcpdf.php';
     $pdf = new TCPDF("P", "mm", "A4", true, "UTF-8");
     $pdf->setPrintHeader(false);
     $pdf->setPrintFooter(false);
     $pdf->SetMargins(0, 0, 0, 0);
     $pdf->AddPage();
     $pdf->setTextColor(100, 100, 100);
     $pdf->SetFont('', '', 14);
     $pdf->Text(40, 40, "Product ID: {$prodId}");
     $pdf->Text(40, 50, "Product Name: {$prodName}");
     $pdf->Text(40, 60, "Unit Price: {$unitPrice}");
     $pdf->Text(40, 70, "Today: {$tsString}");
     $pdf->Image("../Sample_products/images/{$pFile}", 40, 80, 100);
     header("Content-Type: application/pdf");
     header("Content-Disposition: attachment; filename=\"{$fileName}\"");
     header('X-Frame-Options: SAMEORIGIN');
     $pdf->Output();
 }
开发者ID:haya-sann,项目名称:INTER-Mediator,代码行数:27,代码来源:PDFSample.php

示例7: image

 /**
  * Add an image to the pdf.
  *
  * The image is placed at the specified x and y coordinates with the
  * given width and height.
  *
  * @param string $img_url the path to the image
  * @param string $img_type the type (e.g. extension) of the image
  * @param float $x x position
  * @param float $y y position
  * @param int $w width (in pixels)
  * @param int $h height (in pixels)
  */
 function image($img_url, $img_type, $x, $y, $w, $h)
 {
     dompdf_debug("trace", "({$img_url}, {$img_type}, {$x}, {$y}, {$w}, {$h})");
     if ($img_type == 'gif') {
         $img_url = $this->_convert_gif_to_png($img_url);
         $img_type = 'png';
     }
     $this->_pdf->Image($img_url, $x, $y, $w, $h, $img_type);
 }
开发者ID:Razinsky,项目名称:echaude-com,代码行数:22,代码来源:tcpdf_adapter.cls.php

示例8: prepareDownloadImagePdf

 public function prepareDownloadImagePdf($filename, $newfilename, $firstname, $lastname, $title, $description, $code, $date_end)
 {
     // calculate date
     $currentDate = new DateTime();
     $currentDate->modify('+ ' . $date_end . ' month');
     $date_end = $currentDate->format('Y-m-d');
     $this->load->model('tool/image');
     require_once DIR_SYSTEM . 'library/tcpdf/tcpdf.php';
     $pdf = new TCPDF();
     // disable auto-page-break
     $pdf->SetAutoPageBreak(false, 0);
     // set image 1
     $pdf->AddPage();
     $pdf->Image(DIR_IMAGE . $filename, 0, 0, 210, 297, '', '', '', false, 300, '', false, false, 0);
     $pdf->setPageMark();
     /*if(stripos('.pdf',$newfilename)===false)
       {
           $t = explode('.',$newfilename);
           array_pop($t);
           $newfilename = implode('.',$t).'.pdf';
       }*/
     $pdf->SetFont('times', '', 13);
     $pdf->SetTextColor(50, 50, 50);
     for ($i = 0; $i <= 16; $i++) {
         $pdf->Ln(10);
     }
     $pdf->setCellPaddings(90);
     $pdf->Ln(10);
     $pdf->Write(0, $firstname . ' ' . $lastname);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Write(0, $title);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 11);
     $pdf->Write(0, $description);
     $pdf->setCellPaddings(70);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->Ln(10);
     $pdf->SetFont('times', '', 7);
     $pdf->Write(0, 'Beauty Center Billstedt');
     $pdf->Ln(4);
     $pdf->SetFont('times', 'B', 9);
     $pdf->Write(0, '#' . $code);
     $pdf->Ln(4);
     $pdf->SetFont('times', '', 9);
     $pdf->Write(0, 'Gültig bis:: ' . $date_end);
     $pdf->Output(DIR_IMAGE . $newfilename, 'F');
 }
开发者ID:miechuliv,项目名称:BeautyCenter,代码行数:51,代码来源:download.php

示例9: image

 /**
  * Add an image to the pdf.
  *
  * The image is placed at the specified x and y coordinates with the
  * given width and height.
  *
  * @param string $img_url the path to the image
  * @param string $img_type the type (e.g. extension) of the image
  * @param float $x x position
  * @param float $y y position
  * @param int $w width (in pixels)
  * @param int $h height (in pixels)
  */
 function image($img, $x, $y, $w, $h, $resolution = "normal")
 {
     //***		if ($img_type == 'gif') {
     //			$img_url = $this->_convert_gif_to_png($img_url);
     //			$img_type = 'png';
     //		}
     $path_parts = pathinfo($img);
     $img_url = $img;
     $img_type = strtolower($path_parts['extension']);
     if ($img_type == 'gif') {
         $img_url = $this->_convert_gif_to_png($img_url);
         $img_type = 'png';
     }
     $this->_pdf->Image($img_url, $x, $y, $w, $h, $img_type);
 }
开发者ID:demian054,项目名称:APCB_WebPagePHP,代码行数:28,代码来源:tcpdf_adapter.cls.php

示例10: testPdfOutput

 public function testPdfOutput()
 {
     // create new PDF document
     $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     // set document information
     $pdf->SetCreator(PDF_CREATOR);
     $pdf->SetAuthor('Nicola Asuni');
     $pdf->SetTitle('TCPDF Example 034');
     $pdf->SetSubject('TCPDF Tutorial');
     $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
     // set default header data
     $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE . ' 034', PDF_HEADER_STRING);
     // set header and footer fonts
     $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     // set default monospaced font
     $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
     // set margins
     $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     // set auto page breaks
     $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     // set image scale factor
     $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
     // set some language-dependent strings (optional)
     $pdf->setLanguageArray($this->langSettings);
     // ---------------------------------------------------------
     // set font
     $pdf->SetFont('helvetica', 'B', 20);
     // add a page
     $pdf->AddPage();
     $pdf->Write(0, 'Image Clipping using geometric functions', '', 0, 'C', 1, 0, false, false, 0);
     //Start Graphic Transformation
     $pdf->StartTransform();
     // set clipping mask
     $pdf->StarPolygon(105, 100, 30, 10, 3, 0, 1, 'CNZ');
     // draw jpeg image to be clipped
     $pdf->Image('tests/images/image_demo.jpg', 75, 70, 60, 60, '', 'http://www.tcpdf.org', '', true, 72);
     //Stop Graphic Transformation
     $pdf->StopTransform();
     $this->comparePdfs($pdf);
 }
开发者ID:fooman,项目名称:tcpdf,代码行数:43,代码来源:Example034Test.php

示例11: render

 public function render(\TCPDF $pdf, $width = null)
 {
     $image = $this->_obj->getContent();
     $imgSize = getimagesize(Core::$basePath . $image);
     $height = $pdf->pixelsToUnits($imgSize[1]);
     $width = $pdf->pixelsToUnits($imgSize[0]);
     $pdf->setJPEGQuality(75);
     if ($this->_obj->getParameter('pos_x') || $this->_obj->getParameter('pos_y')) {
         $currentY = $pdf->getY();
         $currentAPB = $pdf->getAutoPageBreak();
         $currentMB = $pdf->getMargins();
         $currentMB = $currentMB['bottom'];
         $pdf->setAutoPageBreak(false, 0);
         $pdf->write('');
     }
     $pdf->Image(Core::$basePath . $image, $this->_obj->getParameter('pos_x') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_x')) : null, $this->_obj->getParameter('pos_y') ? $pdf->pixelsToUnits($this->_obj->getParameter('pos_y')) : null, $width * $this->_obj->getParameter('ratio'), $height * $this->_obj->getParameter('ratio'), null, $this->_obj->getParameter('link'), 'N');
     if (isset($currentY)) {
         $pdf->setY($currentY);
         $pdf->setAutoPageBreak($currentAPB, $currentMB);
     }
 }
开发者ID:crapougnax,项目名称:t41,代码行数:21,代码来源:PdfDefault.php

示例12: getAttatchment

 public function getAttatchment()
 {
     $title = $this->input->get('title');
     $attatch = $this->input->get('attatchment');
     $this->form_validation->set_rules('reportTitle', 'Report Title', 'required');
     $this->form_validation->set_error_delimiters('<div class="error">', '</div>');
     tcpdf();
     // create new PDF document
     $obj_pdf = new TCPDF('P', PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
     //set title of report
     $obj_pdf->SetAuthor($this->session->userdata['username']);
     $obj_pdf->SetTitle($title);
     $obj_pdf->SetCreator(PDF_CREATOR);
     $obj_pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, $title, PDF_HEADER_STRING);
     $obj_pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
     $obj_pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
     $obj_pdf->SetDefaultMonospacedFont('helvetica');
     $obj_pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
     $obj_pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
     $obj_pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
     $obj_pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
     $obj_pdf->SetFont('helvetica', '', 9);
     $obj_pdf->setFontSubsetting(false);
     $obj_pdf->AddPage();
     $obj_pdf->Image($attatch, 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
     $path = 'C:/xampp/htdocs/QADash/public_html/reports';
     // Supply a filename including the .pdf extension
     $filename = $this->{$title};
     // Create the full path
     $full_path = $path . '/' . $filename;
     // Output PDF
     $obj_pdf->Output($full_path, 'F');
     //save report details in database
     $details = $this->saveReport($this->session->userdata['uid'], $filename, $path . '/' . $filename);
     $this->report_m->saveReport($details);
     //redirect to view the generated pdf file
     $this->data['report'] = $filename;
     $this->data['subview'] = 'manager/user/report/singleReport_view';
     $this->load->view("manager/_layout_main", $this->data);
 }
开发者ID:Roledenez,项目名称:QADash,代码行数:40,代码来源:customize_controller.php

示例13: createsignpage

function createsignpage($text, $signatureimagepath, $outputpath)
{
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    // set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    // set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    // set some language-dependent strings (optional)
    if (@file_exists(dirname(__FILE__) . '/lang/eng.php')) {
        require_once dirname(__FILE__) . '/lang/eng.php';
        $pdf->setLanguageArray($l);
    }
    // ---------------------------------------------------------
    // set font
    $pdf->SetFont('helvetica', '', 12);
    // add a page
    $pdf->AddPage();
    // print a line of text
    $pdf->writeHTML($text, true, 0, true, 0);
    // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    // *** set signature appearance ***
    // create content for signature (image and/rm or text)
    $pdf->Image($signatureimagepath, 150, '', 30, '', 'JPG');
    $pdf->Output($outputpath, 'F');
    if (file_exists($outputpath)) {
        return 1;
    } else {
        return 0;
    }
}
开发者ID:bramleksono,项目名称:mobileid-SI,代码行数:37,代码来源:pdfoperation.php

示例14: showPdf

function showPdf($idReg = "")
{
    global $db;
    // -------------------------------
    // CONSULTA DE DATOS
    // -------------------------------
    $sql = "select * from ENTRADA where id_entrada='{$idReg}'";
    $db->query($sql);
    while ($db->next_record()) {
        $entSal = $db->f('ent_sal');
        //$idCliente = $db->f('id_cliente');
        //$cliente = getValueTable("cliente","CLIENTE","id_cliente",$idCliente);
        $cliente = $db->f('consig');
        $idConte = $db->f('id_contenedor');
        $conte = getValueTable("numero", "CONTENEDOR", "id_contenedor", $idConte);
        if (preg_match("/(\\w{4})(\\d{7})/", $conte, $parts)) {
            $conteL = $parts[1];
            $conteN = $parts[2];
        }
        $idEq = getValueTable("id_equipo", "CONTENEDOR", "id_contenedor", $idConte);
        $equipo = getValueTable("equipo", "EQUIPO", "id_equipo", $idEq);
        $bkg = $db->f('bkg');
        $clase = $db->f('clase');
        $damage = $db->f('damage');
        $sello = $db->f('sello');
        $nota = $db->f('nota');
        //$idTrans = $db->f('id_transporte');
        //$transp = getValueTable("transporte","TRANSPORTE","id_transporte",$idTrans);
        $transp = $db->f('transportista');
        $conteP1 = substr($conte, 0, 4);
        $conteP2 = substr($conte, 4, 10);
        if (preg_match("/(\\d+)(\\d)\$/", $conteP2, $parts)) {
            $conteP2 = $parts[1] . "-" . $parts[2];
        }
        $idNav = $db->f('id_naviera');
        $naviera = getValueTable("naviera", "NAVIERA", "id_naviera", $idNav);
        $placas = $db->f('placas');
        // $idOperador = $db->f('id_operador');
        //$operador = getValueTable("operador","OPERADOR","id_operador",$idOperador);
        $operador = $db->f('operador');
        if ($entSal == "E") {
            $entCapFec = $db->f('cap_fec');
            $entTrans = $transp;
            $entOpera = $operador;
            $entPlacas = $placas;
            $entClase = "CLASE : {$clase}";
            $entDamage = $damage;
            $entSello = $sello;
            $entNota = $nota;
        }
        if ($entSal == "S") {
            $salCapFec = $db->f('cap_fec');
            $salTrans = $transp;
            $salOpera = $operador;
            $salPlacas = $placas;
            $salClase = "CLASE : {$clase}";
            $salDamage = $damage;
            $salSello = $sello;
            $salNota = $nota;
        }
    }
    // create new PDF document
    $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, 'LETTER', true, 'ISO-8859-1', false);
    // set document information
    $pdf->SetCreator(PDF_CREATOR);
    $pdf->SetAuthor('Nicola Asuni');
    $pdf->SetTitle('TCPDF Example 009');
    $pdf->SetSubject('TCPDF Tutorial');
    $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
    // set default header data
    //$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 009', PDF_HEADER_STRING);
    // set header and footer fonts
    //$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
    //$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
    // set default monospaced font
    $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
    //set margins
    $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
    //$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
    // $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
    // $pdf->SetFooterMargin(3);
    $pdf->setPageOrientation('P', '', 1);
    //set auto page breaks
    $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
    //set image scale factor
    $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
    //set some language-dependent strings
    $pdf->setLanguageArray($l);
    // -------------------------------------------------------------------
    $pdf->AddPage();
    // Logo
    $pdf->setJPEGQuality(100);
    $pdf->Image('../images/logo_color.jpg', 13, 4, 25, 25, '', '', '', false);
    $pdf->Image('../images/nome.jpg', 15, 140, 185, 96, '', '', '', false);
    // set cell padding
    //$pdf->setCellPaddings(1, 1, 1, 1);
    // set cell margins
    //$pdf->setCellMargins(1, 1, 1, 1);
    $pdf->SetFillColor(197, 197, 197);
    // set font
//.........这里部分代码省略.........
开发者ID:nesmaster,项目名称:anakosta,代码行数:101,代码来源:eirPdf2.php

示例15: array

 - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
 - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
*/
// set certificate file
$certificate = 'file://../config/cert/tcpdf.crt';
// set additional information
$info = array('Name' => 'TCPDF', 'Location' => 'Office', 'Reason' => 'Testing TCPDF', 'ContactInfo' => 'http://www.tcpdf.org');
// set document signature
$pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
// set font
$pdf->SetFont('helvetica', '', 12);
// add a page
$pdf->AddPage();
// print a line of text
$text = 'This is a <b color="#FF0000">digitally signed document</b> using the default (example) <b>tcpdf.crt</b> certificate.<br />To validate this signature you have to load the <b color="#006600">tcpdf.fdf</b> on the Arobat Reader to add the certificate to <i>List of Trusted Identities</i>.<br /><br />For more information check the source code of this example and the source code documentation for the <i>setSignature()</i> method.<br /><br /><a href="http://www.tcpdf.org">www.tcpdf.org</a>';
$pdf->writeHTML($text, true, 0, true, 0);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// *** set signature appearance ***
// create content for signature (image and/or text)
$pdf->Image('../images/tcpdf_signature.png', 180, 60, 15, 15, 'PNG');
// define active area for signature appearance
$pdf->setSignatureAppearance(180, 60, 15, 15);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// *** set an empty signature appearance ***
$pdf->addEmptySignatureAppearance(180, 80, 15, 15);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_052.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
开发者ID:myindexlike,项目名称:MODX.snippets,代码行数:31,代码来源:example_052.php


注:本文中的TCPDF::Image方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。