本文整理汇总了PHP中TCPDF::setJPEGQuality方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::setJPEGQuality方法的具体用法?PHP TCPDF::setJPEGQuality怎么用?PHP TCPDF::setJPEGQuality使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::setJPEGQuality方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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 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);
// 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);
// -------------------------------------------------------------------
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
// The '@' character is used to indicate that follows an image data stream and not an image file name
$pdf->Image('@' . $imgdata);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Image example with resizing
$pdf->Image('./tests/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test fitbox with all alignment combinations
$horizontal_alignments = array('L', 'C', 'R');
$vertical_alignments = array('T', 'M', 'B');
$x = 15;
$y = 35;
$w = 30;
$h = 30;
// test all combinations of alignments
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 15;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
$pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 32;
// new column
}
$y += 32;
// new row
}
$x = 115;
$y = 35;
$w = 25;
$h = 50;
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 115;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
$pdf->Image('./tests/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 27;
// new column
}
$y += 52;
// new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->SetXY(110, 200);
$pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('./tests/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
$this->comparePdfs($pdf);
}
示例2: student_kolizijapdf
//.........这里部分代码省略.........
$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);
$pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
$pdf->SetXY(175, 42);
示例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');
}
示例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
//============================================================+
}
示例5: student_ugovoroucenjupdf
//.........这里部分代码省略.........
$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 mastera, broj indexa je netačan!
if ($godina == 1 && $tipstudija == 3) {
$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);
$pdf->Cell(23, 0, $agnaziv, 0, 0, 'C');
$pdf->SetXY(175, 42);
示例6: printTicket
static function printTicket($ticket_html, $order)
{
ob_end_clean();
$config = JComponentHelper::getParams('com_bookpro');
$page_ticket = "<h1 color='Red'> Wellcome to tcpdf </h1>";
$page_ticket = $ticket_html;
// create new PDF document
$pdf = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', false);
$order_number = $order->order_number;
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Joombooking');
$pdf->SetTitle('Travel Ticket ' . $order_number);
$pdf->SetSubject('Travel Ticket');
$pdf->SetKeywords('TCPDF, PDF, ticket, travel, booking');
// set default header data
//$pdf->SetHeaderData($config->get('company_logo'),50, $config->get('company_name'), "Ticket \n www.");
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
//$pdf->setHeaderMargin(10);
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
//set margins
//$pdf->SetMargins(30, 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
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// set font
$pdf->SetFont('times', '', 11);
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(75);
$style['position'] = 'R';
/*
* $type type of barcode (see tcpdf_barcodes_1d.php for supported formats).
*
*/
//$pdf->write1DBarcode($order_number, 'C128B','', '', '', 10, 0.4, $style, 'M');
// create some HTML content
//$pdf->writeHTML($htmlcontent, true, 0, true, 0);
//$pdf->WriteHTML(file_get_contents('test.html'));
$pdf->WriteHTML($page_ticket);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// reset pointer to the last page
$pdf->lastPage();
// ---------------------------------------------------------
//Close and output PDF document
ob_end_clean();
$pdf->Output($order->name . '.pdf', 'I');
//Should use variable to make file name
ob_end_flush();
}
示例7: 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);
}
}
示例8: showPdf
//.........这里部分代码省略.........
$montoLetra = traducirCifra($maniCosto);
$capIdUsr = $db->f('cap_id_usr');
$capFec = $db->f('cap_fec');
$capUsr = getValueTable("usuario", "USUARIO", "id_usuario", $capIdUsr);
}
// ------------------------------
// DAÑOS
// ------------------------------
$sql = "select * from REL_NOME ";
$sql .= "where id_inventario='{$idReg}' ";
$dano = "";
$db->query($sql);
while ($db->next_record()) {
$idRelNome = $db->f(id_rel_nome);
$idNome = $db->f(id_nome);
$idUbica = $db->f(id_ubicacion);
$idDime = $db->f(id_dimension);
$nome = getValueTable("nombre", "NOMENCLATURA", "id_nome", $idNome);
$nomeCode = getValueTable("codigo", "NOMENCLATURA", "id_nome", $idNome);
$ubica = getValueTable("ubicacion", "UBICACION", "id_ubicacion", $idUbica);
$dimen = getValueTable("dimension", "DIMENSION", "id_dimension", $idDime);
$dano .= "{$nome} ({$nomeCode}) : {$ubica} : {$dimen}\n";
}
$dano = nl2br($dano);
// ---------------------------------------------------------
// DATOS DEL RECIBO
// ---------------------------------------------------------
if ($noRecibo > 0) {
$datoRecibo = "\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>FECHA</b></td>\n <td><b>No.R.I.E.</b></td> \n <td></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$capFec}</td> \n <td>{$idReg}</td>\n <td></td>\n <td>{$conteL}{$conteN}</td>\n <td>{$equipo}</td>\n </tr> \n <tr>\n <td><b>CONCEPTO</b></td> \n <td><b>TRANSPORTISTA</b></td> \n <td><b>OPERADOR</b></td>\n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td>{$tipoManiTx}</td> \n <td>{$transp}</td>\n <td>{$operador}</td> \n <td colspan=\"2\">{$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>MANIOBRA \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>SUBTOTAL \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>IVA \$</b></td>\n <td align=\"left\">{$maniIva}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"left\">{$maniCosto}</td>\n </tr>\n </table>\n </td>\n </tr>\n <tr>\n <td colspan=\"3\" align=\"left\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n </tr>\n </table> \n ";
}
// -------------------------------------------------------------------
$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);
// Encabezado
$pdf->SetFillColor(197, 197, 197);
if ($sesIdOficina == 1) {
$txt = "ALMARTCON, S.A. DE C.V.\n\"El Trébol\"";
$pdf->SetFont('helvetica', '', 14);
$pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
$txt = "Direccion, Guatemala \nTels.: 505-2350-0976 Cel. 505-8635-0708";
$pdf->SetFont('helvetica', '', 7);
$pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
}
/* elseif( $sesIdOficina==3 ){
$txt = "TRANSPORTES MALEJA, S.A. DE C.V.\n\"El Pino\"";
$pdf->SetFont('helvetica', '', 14);
$pdf->MultiCell(65, 4,$txt, 0, 'L',0, 0, 40, 10,true);
$txt="Carretera Querétaro San Luis Potosí Km.28\nCol.Buenavista Santa Rosa Jauregui\nQueretaro, QRO.";
$pdf->SetFont('helvetica', '', 7);
$pdf->MultiCell(60, 4,$txt, 0, 'C',0, 0, 105, 10,true);
}
*/
$pdf->SetFont('helvetica', '', 12);
$tbl = <<<EOD
<table cellspacing="0" cellpadding="3" border="1" align="center">
<tr bgcolor="#cacaca">
<th>FOLIO</th>
</tr>
<tr> \t
示例9: showPdf
//.........这里部分代码省略.........
$sql = "select * from REL_NOME_SAL_PLUS ";
$sql .= "where id_salida='{$idSal}' ";
$dano = "";
$db->query($sql);
while ($db->next_record()) {
$idRelNome = $db->f(id_rel_nome);
$idNome = $db->f(id_nome);
$idUbica = $db->f(id_ubicacion);
$idDime = $db->f(id_dimension);
$nome = getValueTable("nombre", "NOMENCLATURA", "id_nome", $idNome);
$nomeCode = getValueTable("codigo", "NOMENCLATURA", "id_nome", $idNome);
$ubica = getValueTable("ubicacion", "UBICACION", "id_ubicacion", $idUbica);
$dimen = getValueTable("dimension", "DIMENSION", "id_dimension", $idDime);
$dano .= "{$nome} ({$nomeCode}) : {$ubica} : {$dimen}\n";
}
$dano = nl2br($dano);
// ---------------------------------------------------------
// DATOS DEL RECIBO
// ---------------------------------------------------------
if ($noRecibo > 0) {
$subTotal = $maniCosto + $repaCosto;
$total = $subTotal;
$subTotal = number_format($subTotal, 2);
$total = number_format($total, 2);
$datoRecibo = "\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\"> \n <tr>\n <td colspan=\"4\" valign=\"middle\"><b>DEPOSITO DE CONTENEDORES OPEMANTRA</b></td>\n <td>\n <table cellspacing=\"1\" cellpadding=\"2\" border=\"0\" align=\"center\"> \n <tr>\n <td bgcolor=\"black\"><b><font color=\"white\">FOLIO</font></b></td>\n </tr>\n <tr>\n <td><font color=\"red\"><b>No. {$noRecibo}</b></font></td>\n </tr>\n </table>\n </td>\n </tr> \n <tr>\n <td><b>FECHA</b></td>\n <td><b>No.R.I.E.</b></td> \n <td></td>\n <td><b>CONTENEDOR</b></td>\n <td><b>TIPO</b></td>\n </tr>\n <tr>\n <td>{$capFec}</td> \n <td>{$idReg}</td>\n <td></td>\n <td>{$conteL}{$conteN}</td>\n <td>{$equipo}</td>\n </tr> \n <tr>\n <td><b>CONCEPTO</b></td> \n <td><b>TRANSPORTISTA</b></td> \n <td><b>OPERADOR</b></td>\n <td colspan=\"2\"><b>OBSERVACIONES</b></td> \n </tr> \n <tr> \n <td>{$tipoManiTx}</td> \n <td>{$transp}</td>\n <td>{$operador}</td> \n <td colspan=\"2\">{$docu} {$docuRef} / {$nota}</td> \n </tr>\n </table>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td ><b>FIRMA OPERADOR</b></td>\n <td ><b>FIRMA DEL DEPOSITO</b></td>\n <td>\n <table cellspacing=\"0\" cellpadding=\"3\" border=\"1\" align=\"center\">\n <tr>\n <td align=\"right\"><b>MANIOBRA \$</b></td>\n <td align=\"right\">{$maniCosto}</td>\n </tr>\n <tr>\n <td align=\"right\"><b>REPARACIONES \$</b></td>\n <td align=\"right\">{$repaCosto}</td>\n </tr> \n <tr>\n <td align=\"right\"><b>TOTAL \$</b></td>\n <td align=\"right\">{$total}</td>\n </tr>\n </table>\n </td>\n </tr>\n ";
if ($docTipo == "EFECTIVO") {
$datoRecibo .= "\n <tr> \n <td colspan=\"3\" align=\"right\">RECIBIMOS DE <u>{$operador}</u> LA CANTIDAD DE {$montoLetra} PESOS M.N. 00/100 </td>\n </tr>\n ";
}
$datoRecibo .= "</table>";
}
// -------------------------------------------------------------------
$pdf->AddPage();
// Logo
$pdf->setJPEGQuality(100);
$pdf->Image('../images/logo.jpg', 13, 4, 60, 30, '', '', '', false);
//$pdf->Image('../images/nome.jpg', 15, 145, 185, 120,'','','',false);
// set cell padding
$pdf->setCellPaddings(1, 1, 1, 1);
// set cell margins
$pdf->setCellMargins(1, 1, 1, 1);
// Encabezado
$pdf->SetFillColor(197, 197, 197);
// Trebol
$pdf->SetFont('helvetica', '', 14);
$pdf->MultiCell(65, 4, $txt, 0, 'L', 0, 0, 40, 10, true);
//$txt="Av. ";
$pdf->SetFont('helvetica', '', 7);
$pdf->MultiCell(60, 4, $txt, 0, 'C', 0, 0, 105, 10, true);
$pdf->SetFont('helvetica', '', 12);
$tbl = <<<EOD
<table cellspacing="0" cellpadding="3" border="0" align="center">
<tr bgcolor="#cacaca">
<th>FOLIO</th>
</tr>
<tr> \t
\t<td><font color="red">S {$eir}</font></td>
</tr>
</table>
EOD;
$pdf->writeHTML($tbl, true, false, false, false, '');
$txt = "RECIBO DE INTERCAMBIO DE EQUIPO (R.I.E)";
$pdf->SetFont('helvetica', 'B', 12);
$pdf->MultiCell(100, 4, $txt, 0, 'C', 0, 0, 60, 37, true);
$pdf->SetFont('helvetica', '', 8);
$tbl = <<<EOD
<br><br><br>
示例10: TCPDF
$TRANSACTION_ID = mysql_real_escape_string($_GET['MNT_TRANSACTION_ID']);
$q_gos = "SELECT * FROM payment WHERE payment_id = \"" . $TRANSACTION_ID . "\" AND payment_confirm= \"1\" LIMIT 1";
$res_gos = mysql_query($q_gos);
if (mysql_num_rows($res_gos) > 0) {
$row_gos = mysql_fetch_array($res_gos);
require_once $up_way . 'dir/modules/tcpdf/config/lang/rus.php';
require_once $up_way . 'dir/modules/tcpdf/tcpdf.php';
// PDF_PAGE_FORMAT - A4
// PDF_PAGE_ORIENTATION
// PDF_UNIT - mm
$pdf = new TCPDF('P', 'mm', array(108, 200), true, 'UTF-8', false);
$pdf->SetTitle('Transaction ID Ref ' . $TRANSACTION_ID);
// remove default header/footer
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
$pdf->setJPEGQuality(100);
$pdf->SetMargins(10, 10, true);
// add a page
$pdf->AddPage();
$pdf->SetFont('arial', '', 8);
$strContent = '<div style="border:1px dashed #aaa;"><br/><span style="text-align:center">НКО «МОНЕТА.РУ» (ООО)</span><br/>
<span style="text-align:center">424000, Российская Федерация,</span><br/>
<span style="text-align:center">Республика Марий Эл, г. Йошкар-Ола,</span><br/>
<span style="text-align:center">ул. Гоголя, д. 2, строение "А"</span><br/>
<span style="text-align:center">тел./факс: 8 (495) 743-49-85,</span><br/>
<span style="text-align:center;">e-mail: helpdesk.support@moneta.ru</span><br/>
<div style="text-align:center;border-top:1px solid #aaa;border-bottom:1px solid #aaa;height:100px"><br/>
<b>Квитанция об оплате</b><br/>
</div><br/>
<span style="text-align:left;"> Номер операции: ' . $row_gos['MNT_OPERATION_ID'] . '</span><br/>
<span style="text-align:left;"> Дата и время: ' . $row_gos['payment_date'] . '</span><br/><br/>
示例11: 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
//.........这里部分代码省略.........
示例12: _html2pdf_tcpdf
/**
* Convert html to tcpdf.
*
* @param $paper_size
* @param $orientation
* @param $margins
* @param $html
* @param $output
* @param $fileName
* @param $stationery_path
*/
public static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path)
{
// Documentation on the TCPDF library can be found at: http://www.tcpdf.org
// This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
// Syntax borrowed from https://github.com/jake-mw/CDNTaxReceipts/blob/master/cdntaxreceipts.functions.inc
require_once 'tcpdf/tcpdf.php';
require_once 'FPDI/fpdi.php';
// This library is only in the 'packages' area as of version 4.5
$paper_size_arr = array($paper_size[2], $paper_size[3]);
$pdf = new TCPDF($orientation, 'pt', $paper_size_arr);
$pdf->Open();
if (is_readable($stationery_path)) {
$pdf->SetStationery($stationery_path);
}
$pdf->SetAuthor('');
$pdf->SetKeywords('CiviCRM.org');
$pdf->setPageUnit($margins[0]);
$pdf->SetMargins($margins[4], $margins[1], $margins[2], TRUE);
$pdf->setJPEGQuality('100');
$pdf->SetAutoPageBreak(TRUE, $margins[3]);
$pdf->AddPage();
$ln = TRUE;
$fill = FALSE;
$reset_parm = FALSE;
$cell = FALSE;
$align = '';
// output the HTML content
$pdf->writeHTML($html, $ln, $fill, $reset_parm, $cell, $align);
// reset pointer to the last page
$pdf->lastPage();
// close and output the PDF
$pdf->Close();
$pdf_file = 'CiviLetter' . '.pdf';
$pdf->Output($pdf_file, 'D');
CRM_Utils_System::civiExit(1);
}
示例13: izvjestaj_prijave
function izvjestaj_prijave()
{
require_once 'lib/tcpdf/tcpdf.php';
global $userid, $conf_files_path;
// Poslani parametar
$ispit_termin = intval($_GET['ispit_termin']);
$predmet = intval($_GET['predmet']);
$ag = intval($_GET['ag']);
$student = intval($_GET['student']);
$nasa_slova = array("č" => "c", "ć" => "c", "đ" => "d", "š" => "s", "ž" => "z", "Č" => "C", "Ć" => "C", "Đ" => "D", "Š" => "S", "Ž" => "Z");
// Odredjujemo filename
if ($ispit_termin > 0) {
$q5 = myquery("select p.id, p.naziv, UNIX_TIMESTAMP(it.datumvrijeme), i.akademska_godina from predmet as p, ispit as i, ispit_termin as it where it.id={$ispit_termin} and it.ispit=i.id and i.predmet=p.id");
$predmet = mysql_result($q5, 0, 0);
$ag = mysql_result($q5, 0, 3);
$filename = "prijave-" . strtr(mysql_result($q5, 0, 1), $nasa_slova) . "-" . date("d-m-Y", mysql_result($q5, 0, 2)) . ".pdf";
} else {
if ($predmet > 0) {
$q5 = myquery("select naziv from predmet where id={$predmet}");
$filename = "prijave-" . strtr(mysql_result($q5, 0, 0), $nasa_slova) . ".pdf";
} else {
$filename = "prijave.pdf";
}
}
$upit = "SELECT o.id, o.ime, o.prezime, o.brindexa, pk.semestar, s.naziv, p.naziv, ag.naziv, ";
// slijedi datum
// Stampaj sve studente na terminu
if ($ispit_termin > 0) {
// Uzimamo datum termina
$upit .= "UNIX_TIMESTAMP(it.datumvrijeme) from osoba as o, ispit_termin as it, student_ispit_termin as sit, student_predmet as sp, ponudakursa as pk, ispit as i, studij as s, predmet as p, akademska_godina as ag where sit.ispit_termin=it.id and sit.student=o.id and it.id={$ispit_termin} and o.id=sp.student and sp.predmet=pk.id and it.ispit=i.id and i.predmet=pk.predmet and i.akademska_godina=pk.akademska_godina and pk.studij=s.id and pk.predmet=p.id and pk.akademska_godina=ag.id order by o.prezime, o.ime";
} else {
if ($predmet <= 0 || $ag <= 0) {
biguglyerror("Neispravni parametri");
print "Da li je moguće da ste odabrali neispravan ili nepostojeći predmet?";
return;
// Stampaj jednog studenta
} else {
if ($student > 0) {
// Uzecemo danasnji datum
$upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id={$student} and sp.student={$student} and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id";
// Sve studente koji nemaju ocjenu
} else {
if ($_GET['tip'] == "bez_ocjene" || $_GET['tip'] == "uslov") {
// Naknadno provjeravamo da li ima uslov
// Uzecemo danasnji datum
$upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id and (select count(*) from konacna_ocjena as ko where ko.student=o.id and ko.predmet={$predmet})=0 order by o.prezime, o.ime";
// Sve studente koji imaju ocjenu
} else {
if ($_GET['tip'] == "sa_ocjenom") {
// Uzecemo danasnji datum
$upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id and (select count(*) from konacna_ocjena as ko where ko.student=o.id and ko.predmet={$predmet})>0 order by o.prezime, o.ime";
// Sve studente na predmetu
} else {
if ($_GET['tip'] == "sve") {
// Uzecemo danasnji datum
$upit .= "UNIX_TIMESTAMP(NOW()) from osoba as o, ponudakursa as pk, studij as s, predmet as p, akademska_godina as ag, student_predmet as sp where o.id=sp.student and sp.predmet=pk.id and pk.predmet={$predmet} and pk.akademska_godina={$ag} and p.id={$predmet} and ag.id={$ag} and pk.studij=s.id order by o.prezime, o.ime";
// Ovo se može desiti ako se klikne na prikaz pojedinačnog studenta, a nijedan student nije izabran
// (npr. ako nijedan student ne sluša predmet)
} else {
biguglyerror("Neispravni parametri");
print "Da li je moguće da ovaj predmet ne sluša niti jedan student?";
return;
}
}
}
}
}
}
// PDF inicijalizacija
$pdf = new TCPDF('P', 'mm', 'a5', true, 'UTF-8', false);
$pdf->SetCreator("Zamger");
$pdf->SetTitle('Printanje prijava');
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
$pdf->SetMargins(0, 0, 0);
$pdf->SetAutoPageBreak(false);
$pdf->setLanguageArray($l);
$pdf->SetFont('freesans', 'B', 9);
$pdf->SetHeaderData("", 0, "", "");
$pdf->SetPrintHeader(false);
$pdf->setFooterMargin($fm = 0);
$pdf->SetPrintFooter(false);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO*2.083333);
$pdf->setJPEGQuality(100);
// Izvršenje upita
$q10 = myquery($upit);
while ($r10 = mysql_fetch_row($q10)) {
$student = $r10[0];
$imeprezime = $r10[1] . " " . $r10[2];
$brind = $r10[3];
$godStudija = intval(($r10[4] + 1) / 2);
$odsjek = $r10[5];
$nazivPr = $r10[6];
$skolskaGod = $r10[7];
// $NastavnikSl=$r10[9];
$datumIspita = date("d. m. Y.", $r10[8]);
// $NastavnikPr=$r10[8];
// $datumPrijave=$r10[12];
$datumPrijave = $datumIspita;
//.........这里部分代码省略.........
示例14: pdf_seven
/**
* 图片
*/
function pdf_seven()
{
require_once 'tcpdf.php';
// 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 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);
// 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);
}
// -------------------------------------------------------------------
// add a page
$pdf->AddPage();
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Example of Image from data stream ('PHP rules')
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
// The '@' character is used to indicate that follows an image data stream and not an image file name
$pdf->Image('@' . $imgdata);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Image example with resizing
$pdf->Image('examples/images/image_demo.jpg', 15, 140, 75, 113, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// test fitbox with all alignment combinations
$horizontal_alignments = array('L', 'C', 'R');
$vertical_alignments = array('T', 'M', 'B');
$x = 15;
$y = 35;
$w = 30;
$h = 30;
// test all combinations of alignments
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 15;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 128));
$pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 32;
// new column
}
$y += 32;
// new row
}
$x = 115;
$y = 35;
$w = 25;
$h = 50;
for ($i = 0; $i < 3; ++$i) {
$fitbox = $horizontal_alignments[$i] . ' ';
$x = 115;
for ($j = 0; $j < 3; ++$j) {
$fitbox[1] = $vertical_alignments[$j];
$pdf->Rect($x, $y, $w, $h, 'F', array(), array(128, 255, 255));
$pdf->Image('examples/images/image_demo.jpg', $x, $y, $w, $h, 'JPG', '', '', false, 300, '', false, false, 0, $fitbox, false, false);
$x += 27;
// new column
}
$y += 52;
// new row
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Stretching, position and alignment example
$pdf->SetXY(110, 200);
$pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', 'T', false, 300, '', false, false, 1, false, false, false);
$pdf->Image('examples/images/image_demo.jpg', '', '', 40, 40, '', '', '', false, 300, '', false, false, 1, false, false, false);
// -------------------------------------------------------------------
//饼状图
// add a page
$pdf->AddPage();
$pdf->Write(0, 'Example of PieSector() method.');
$xc = 105;
$yc = 100;
//.........这里部分代码省略.........
示例15: dc_YDown
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Print a table
/* dc_YDown() */
function dc_YDown($a = 0)
{
global $pdf;
$pdf->SetY($pdf->GetY() + $a);
// Line break 2mm
return $pdf->GetY();
}
// set JPEG quality
$pdf->setJPEGQuality(75);
// Image method signature:
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// set font
$pdf->SetFont('dejavusans', '', 11, '', true);
// set cell padding
$pdf->setCellPaddings(0, 0, 0, 0.5);
//$left='', $top='', $right='', $bottom='')
// set cell margins
$pdf->setCellMargins(0, 0, 0, 0);
// set color for background
$pdf->SetFillColor(255, 255, 255);
// MultiCell($w, $h, $txt, $border=0, $align='J', $fill=0, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0)
// START //////////////////////////
// Queries:
//$t=dbSel("*","catalog","W/`dcid`='$dcid' LIMIT 0,1");