本文整理汇总了PHP中TCPDF::SetXY方法的典型用法代码示例。如果您正苦于以下问题:PHP TCPDF::SetXY方法的具体用法?PHP TCPDF::SetXY怎么用?PHP TCPDF::SetXY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TCPDF
的用法示例。
在下文中一共展示了TCPDF::SetXY方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: text
/**
* Writes text at the specified x and y coordinates
*
* See {@link Style::munge_color()} for the format of the color array.
*
* @param float $x
* @param float $y
* @param string $text the text to write
* @param string $font the font file to use
* @param float $size the font size, in points
* @param array $color
* @param float $adjust word spacing adjustment
*/
function text($x, $y, $text, $font, $size, $color = array(0, 0, 0), $adjust = 0, $angle = 0, $blend = "Normal", $opacity = 1.0)
{
dompdf_debug("trace", "({$x}, {$y}, {$text}, " . basename($font) . ", {$size}, [{$color['0']}, {$color['1']}, {$color['2']}], {$adjust}, {$angle}, {$blend}, {$opacity})");
list($r, $g, $b) = $this->_get_rgb($color);
$this->_pdf->SetTextColor($r, $g, $b);
$this->_set_line_transparency($blend, $opacity);
$this->_set_fill_transparency($blend, $opacity);
$fontdata = $this->_get_font($font);
$this->_pdf->SetFont($fontdata['family'], $fontdata['style'], $size, $font);
//$this->_pdf->SetFontSize($size);
// ???
if ($adjust > 0) {
$a = explode(' ', $text);
//$this->_pdf->SetXY($x - 3, $y + (self::FONT_HEIGHT_SCALE - 1) * $size);
$this->_pdf->SetXY($x, $y);
//$y += self::FONT_HEIGHT_SCALE * $size + 1;
for ($i = 0; $i < count($a) - 1; $i++) {
$this->_pdf->Write($size, $a[$i] . ' ', '');
//$this->_pdf->Text($x, $y, $a[$i].' ');
$this->_pdf->SetX($this->_pdf->GetX() + $adjust);
//$x += $this->_pdf->GetX() + $adjust;
}
$this->_pdf->Write($size, $a[$i], '');
//$this->_pdf->Text($x, $y, $a[$i].' ');
} else {
if ($angle != 0) {
$this->_pdf->StartTransform();
//$y += self::FONT_HEIGHT_SCALE * $size;
//$y += $size;
$this->_pdf->Rotate(-$angle, $x, $y);
$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
$this->_pdf->StopTransform();
} else {
//$pippo = $this->_pdf->getFontAscent($fontdata['family'], $fontdata['style'], $size);
//$y += $pippo / 8;
//$y = $y - 0.85 * $size; // + 0.8 * $size;
$this->_pdf->Text($x, $y, $text, false, false, true, 0, 0, '', 0, '', 0, false, 'T', 'T');
}
}
}
示例2: student_kolizijapdf
//.........这里部分代码省略.........
}
}
// 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);
$pdf->Cell(23, 0, $godina . ".", 0, 0, 'C');
$pdf->SetXY(175, 50);
$pdf->Cell(23, 0, $sem1 . ".", 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);
// Spisak obaveznih predmeta na neparnom semestru
// Ako je ponovac, ne prikazujemo predmete koje je polozio
示例3: 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);
}
示例4: SetXY
/**
* we redifine the original SetXY method, because we don't want the automatic treatment.
* It is HTML2PDF that make the treatment.
* If language is RTL direction this method will call to parent (TCPDF class).
*
* @param integer $x
* @param integer $y
* @param boolean $rtloff
* @access public
*/
public function SetXY($x, $y, $rtloff=false)
{
if (!$rtloff AND $this->rtl) {
parent::SetXY($x, $y, $rtloff);
} else {
$this->x=$x;
$this->y=$y;
}
}
示例5: prepareRowAsPdf
/**
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
*
* @param string $spatial GIS MULTILINESTRING object
* @param string $label Label for the GIS MULTILINESTRING object
* @param string $line_color Color for the GIS MULTILINESTRING object
* @param array $scale_data Array containing data related to scaling
* @param TCPDF $pdf TCPDF instance
*
* @return TCPDF the modified TCPDF instance
* @access public
*/
public function prepareRowAsPdf($spatial, $label, $line_color, $scale_data, $pdf)
{
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
// allocate colors
$red = hexdec($pmaString->substr($line_color, 1, 2));
$green = hexdec($pmaString->substr($line_color, 3, 2));
$blue = hexdec($pmaString->substr($line_color, 4, 2));
$line = array('width' => 1.5, 'color' => array($red, $green, $blue));
// Trim to remove leading 'MULTILINESTRING((' and trailing '))'
$multilinestirng = $pmaString->substr($spatial, 17, $pmaString->strlen($spatial) - 19);
// Separate each linestring
$linestirngs = explode("),(", $multilinestirng);
$first_line = true;
foreach ($linestirngs as $linestring) {
$points_arr = $this->extractPoints($linestring, $scale_data);
foreach ($points_arr as $point) {
if (!isset($temp_point)) {
$temp_point = $point;
} else {
// draw line section
$pdf->Line($temp_point[0], $temp_point[1], $point[0], $point[1], $line);
$temp_point = $point;
}
}
unset($temp_point);
// print label
if (isset($label) && trim($label) != '' && $first_line) {
$pdf->SetXY($points_arr[1][0], $points_arr[1][1]);
$pdf->SetFontSize(5);
$pdf->Cell(0, 0, trim($label));
}
$first_line = false;
}
return $pdf;
}
示例6: 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
//============================================================+
}
示例7:
* the same results each time, subject only to the graphics state at
* the time it is invoked.
*/
// start a new XObject Template
$template_id = $pdf->startTemplate(60, 60);
// create Template content
// ...................................................................
//Start Graphic Transformation
$pdf->StartTransform();
// set clipping mask
$pdf->StarPolygon(30, 30, 29, 10, 3, 0, 1, 'CNZ');
// draw jpeg image to be clipped
//$pdf->Image('../images/image_demo.jpg', 0, 0, 60, 60, '', '', '', true, 72, '', false, false, 0, false, false, false);
//Stop Graphic Transformation
$pdf->StopTransform();
$pdf->SetXY(0, 0);
$pdf->SetFont('times', '', 40);
$pdf->SetTextColor(255, 0, 0);
// print a text
$pdf->Cell(60, 60, 'Template', 0, 0, 'C', false, '', 0, false, 'T', 'M');
// ...................................................................
// end the current Template
$pdf->endTemplate();
// print the selected Template various times
$pdf->printTemplate($template_id, 15, 50, 20, 20, '', '', false);
$pdf->printTemplate($template_id, 27, 62, 40, 40, '', '', false);
$pdf->printTemplate($template_id, 55, 85, 60, 60, '', '', false);
$pdf->printTemplate($template_id, 95, 125, 80, 80, '', '', false);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_062.pdf', 'I');
示例8: prepareRowAsPdf
/**
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
*
* @param string $spatial GIS POLYGON object
* @param string $label Label for the GIS POLYGON object
* @param string $fill_color Color for the GIS POLYGON object
* @param array $scale_data Array containing data related to scaling
* @param TCPDF $pdf TCPDF instance
*
* @return TCPDF the modified TCPDF instance
* @access public
*/
public function prepareRowAsPdf($spatial, $label, $fill_color, $scale_data, $pdf)
{
// allocate colors
$red = hexdec(mb_substr($fill_color, 1, 2));
$green = hexdec(mb_substr($fill_color, 3, 2));
$blue = hexdec(mb_substr($fill_color, 4, 2));
$color = array($red, $green, $blue);
// Trim to remove leading 'POLYGON((' and trailing '))'
$polygon = mb_substr($spatial, 9, mb_strlen($spatial) - 11);
// If the polygon doesn't have an inner polygon
if (mb_strpos($polygon, "),(") === false) {
$points_arr = $this->extractPoints($polygon, $scale_data, true);
} else {
// Separate outer and inner polygons
$parts = explode("),(", $polygon);
$outer = $parts[0];
$inner = array_slice($parts, 1);
$points_arr = $this->extractPoints($outer, $scale_data, true);
foreach ($inner as $inner_poly) {
$points_arr = array_merge($points_arr, $this->extractPoints($inner_poly, $scale_data, true));
}
}
// draw polygon
$pdf->Polygon($points_arr, 'F*', array(), $color, true);
// print label if applicable
if (isset($label) && trim($label) != '') {
$pdf->SetXY($points_arr[2], $points_arr[3]);
$pdf->SetFontSize(5);
$pdf->Cell(0, 0, trim($label));
}
return $pdf;
}
示例9: prepareRowAsPdf
/**
* Adds to the TCPDF instance, the data related to a row in the GIS dataset.
*
* @param string $spatial GIS MULTIPOINT object
* @param string $label Label for the GIS MULTIPOINT object
* @param string $point_color Color for the GIS MULTIPOINT object
* @param array $scale_data Array containing data related to scaling
* @param TCPDF $pdf TCPDF instance
*
* @return TCPDF the modified TCPDF instance
* @access public
*/
public function prepareRowAsPdf($spatial, $label, $point_color, $scale_data, $pdf)
{
/** @var PMA_String $pmaString */
$pmaString = $GLOBALS['PMA_String'];
// allocate colors
$red = hexdec($pmaString->substr($point_color, 1, 2));
$green = hexdec($pmaString->substr($point_color, 3, 2));
$blue = hexdec($pmaString->substr($point_color, 4, 2));
$line = array('width' => 1.25, 'color' => array($red, $green, $blue));
// Trim to remove leading 'MULTIPOINT(' and trailing ')'
$multipoint = $pmaString->substr($spatial, 11, $pmaString->strlen($spatial) - 12);
$points_arr = $this->extractPoints($multipoint, $scale_data);
foreach ($points_arr as $point) {
// draw a small circle to mark the point
if ($point[0] != '' && $point[1] != '') {
$pdf->Circle($point[0], $point[1], 2, 0, 360, 'D', $line);
}
}
// print label for each point
if (isset($label) && trim($label) != '' && ($points_arr[0][0] != '' && $points_arr[0][1] != '')) {
$pdf->SetXY($points_arr[0][0], $points_arr[0][1]);
$pdf->SetFontSize(5);
$pdf->Cell(0, 0, trim($label));
}
return $pdf;
}
示例10: floor
if($plbcode=='Y') $lheight+=10;
*/
$q = mysql_query("SELECT * FROM `p_label`");
$k = 0;
$kol = 0;
$row = 0;
$i = 0;
$nkol = floor($dcPageW / ($lwidth + 1));
$nrow = 99;
//$nrow=floor($dcPageH/$lheight);
while ($r = mysql_fetch_array($q)) {
$b = dbSFA("*", "book", "W/dcid='" . $r['book'] . "'");
// Print Label >>
$x = ($lwidth + 1) * $kol + $dcMarginL;
$y = $lheight * $row + $dcMarginT;
$pdf->SetXY($x, $y);
$pl = false;
if ($plhead == 'Y') {
$pl = true;
$pdf->setCellPaddings(0, 0.5, 0, 0);
$pdf->SetFont('dejavusans', '', 10, '', true);
$pdf->MultiCell($lwidth, 0, $title, 'LTR', 'C', 0, 1, '', '', true);
if ($k == 0) {
$lheight += $pdf->getLastH();
}
$pdf->SetX($x);
$pdf->setCellPaddings(0, 0, 0, 0.5);
$pdf->SetFont('dejavusans', '', 7, '', true);
$pdf->MultiCell($lwidth, 0, $desc, 'LBR', 'C', 0, 9, '', '', true);
if ($k == 0) {
$lheight += $pdf->getLastH();
示例11: printPost
/**
* [พิมพ์ post]
* @param [type] $id [description]
* @return [type] [description]
*/
public function printPost($id)
{
if (Session::get('c3') == 1) {
$sql = ' select c.*, concat(n.pname,n.fname," ",n.lname) as fullname from c_blog_posts c left join n_datageneral n on n.cid=c.created_by';
$sql .= ' where postID =' . e($id) . ' ';
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(array('angsanaupc', '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array('angsanaupc', '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(15, 15, 15);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
$pdf->AddPage();
$pdf->SetFont('angsanaupc', 'B', 16, '', true);
$pdf->SetXY(15, 15);
$pdf->MultiCell(180, 0, 'ใบประสานงานขอรถ', 0, 'C', 0, 1, '', '', true);
$data = DB::select($sql);
$pdf->SetFont('angsanaupc', '', 14, '', true);
$tbl = '<br /><br /><table style="width: 100%; padding:2px;" cellspacing="0">';
foreach ($data as $key => $value) {
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> เรื่อง ' . $value->postTitle . '</td>
</tr>';
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> สร้างโดย ' . $value->fullname . ' วันที่ ' . date("d-m", strtotime($value->postDate)) . '-' . (date("Y", strtotime($value->postDate)) + 543) . ' เวลา ' . date("H:i:s", strtotime($value->postDate)) . '</td>
</tr>';
$tbl = $tbl . '<tr>
<td style="border: 0px solid #000000; text-align:left"> ' . $value->postDesc . '</td>
</tr>';
}
$tbl = $tbl . '</table>';
$pdf->writeHTML($tbl, true, false, false, false, '');
$filename = storage_path() . '/report_post.pdf';
$contents = $pdf->output($filename, 'I');
$headers = array('Content-Type' => 'application/pdf');
return Response::make($contents, 200, $headers);
} else {
return Redirect::to('contact');
}
}
示例12: generateJobOrderReportPDF
public function generateJobOrderReportPDF()
{
/* E_STRICT doesn't like FPDF. */
$errorReporting = error_reporting();
error_reporting($errorReporting & ~ E_STRICT);
include_once('./lib/fpdf/fpdf.php');
error_reporting($errorReporting);
// FIXME: Hook?
$isASP = $_SESSION['CATS']->isASP();
$unixName = $_SESSION['CATS']->getUnixName();
$siteName = $this->getTrimmedInput('siteName', $_GET);
$companyName = $this->getTrimmedInput('companyName', $_GET);
$jobOrderName = $this->getTrimmedInput('jobOrderName', $_GET);
$periodLine = $this->getTrimmedInput('periodLine', $_GET);
$accountManager = $this->getTrimmedInput('accountManager', $_GET);
$recruiter = $this->getTrimmedInput('recruiter', $_GET);
$notes = $this->getTrimmedInput('notes', $_GET);
if (isset($_GET['dataSet']))
{
$dataSet = $_GET['dataSet'];
$dataSet = explode(',', $dataSet);
}
else
{
$dataSet = array(4, 3, 2, 1);
}
/* PDF Font Face. */
// FIXME: Customizable.
$fontFace = 'helvetica';
$pdf=new \TCPDF();
//$pdf = new FPDF();
$pdf->AddPage();
if (!eval(Hooks::get('REPORTS_CUSTOMIZE_JO_REPORT_PRE'))) return;
$pdf->SetFont($fontFace, 'B', 10);
if ($isASP && $unixName == 'cognizo')
{
/* TODO: MAKE THIS CUSTOMIZABLE FOR EVERYONE. */
$pdf->Image('images/cognizo-logo.jpg', 130, 10, 59, 20);
$pdf->SetXY(129,27);
$pdf->Write(5, 'Information Technology Consulting');
}
$pdf->SetXY(25, 35);
$pdf->SetFont($fontFace, 'BU', 14);
$pdf->Write(5, "Recruiting Summary Report\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, DateUtility::getAdjustedDate('l, F d, Y') . "\n\n\n");
$pdf->SetFont($fontFace, 'B', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Company: '. $companyName . "\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Position: ' . $jobOrderName . "\n\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Period: ' . $periodLine . "\n\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Account Manager: ' . $accountManager . "\n");
$pdf->SetFont($fontFace, '', 10);
$pdf->SetX(25);
$pdf->Write(5, 'Recruiter: ' . $recruiter . "\n");
/* Note that the server is not logged in when getting this file from
* itself.
*/
// FIXME: Pass session cookie in URL? Use cURL and send a cookie? I
// really don't like this... There has to be a way.
// FIXME: "could not make seekable" - http://demo.catsone.net/index.php?m=graphs&a=jobOrderReportGraph&data=%2C%2C%2C
// in /usr/local/www/catsone.net/data/lib/fpdf/fpdf.php on line 1500
$URI = CATSUtility::getAbsoluteURI(
CATSUtility::getIndexName()
. '?m=graphs&a=jobOrderReportGraph&data='
. urlencode(implode(',', $dataSet))
);
$pdf->Image($URI, 70, 95, 80, 80, 'jpg');
$pdf->SetXY(25,180);
$pdf->SetFont($fontFace, '', 10);
$pdf->Write(5, 'Total Candidates ');
$pdf->SetTextColor(255, 0, 0);
$pdf->Write(5, 'Screened');
$pdf->SetTextColor(0, 0, 0);
$pdf->Write(5, ' by ' . $siteName . ": \n\n");
//.........这里部分代码省略.........
示例13: array
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
//set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
//set some language-dependent strings
$pdf->setLanguageArray($l);
// ---------------------------------------------------------
// NOTE: 2D barcode algorithms must be implemented on 2dbarcode.php class file.
// set font
$pdf->SetFont('helvetica', '', 10);
// add a page
$pdf->AddPage();
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => true, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// write RAW 2D Barcode
$pdf->SetXY(30, 30);
$code = '111011101110111,010010001000010,010011001110010,010010000010010,010011101110010';
$pdf->write2DBarcode($code, 'RAW', '', '', 30, 20, $style, 'N');
$pdf->SetXY(100, 30);
// write RAW2 2D Barcode
$code = '[111011101110111][010010001000010][010011001110010][010010000010010][010011101110010]';
$pdf->write2DBarcode($code, 'RAW2', '', '', 30, 20, $style, 'N');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// set style for barcode
$style = array('border' => 2, 'vpadding' => 'auto', 'hpadding' => 'auto', 'fgcolor' => array(0, 0, 0), 'bgcolor' => false, 'module_width' => 1, 'module_height' => 1);
// QRCODE,L : QR-CODE Low error correction
$pdf->SetXY(30, 60);
$pdf->write2DBarcode('www.tcpdf.org', 'QRCODE,L', '', '', 50, 50, $style, 'N');
$pdf->Text(30, 55, 'QRCODE L');
// QRCODE,M : QR-CODE Medium error correction
$pdf->SetXY(100, 60);
示例14: array
Fusce et felis vitae diam lobortis sollicitudin. Aenean tincidunt accumsan nisi, id vehicula quam laoreet elementum. Phasellus egestas interdum erat, et viverra ipsum ultricies ac. Praesent sagittis augue at augue volutpat eleifend. Cras nec orci neque. Mauris bibendum posuere blandit. Donec feugiat mollis dui sit amet pellentesque. Sed a enim justo. Donec tincidunt, nisl eget elementum aliquam, odio ipsum ultrices quam, eu porttitor ligula urna at lorem. Donec varius, eros et convallis laoreet, ligula tellus consequat felis, ut ornare metus tellus sodales velit. Duis sed diam ante. Ut rutrum malesuada massa, vitae consectetur ipsum rhoncus sed. Suspendisse potenti. Pellentesque a congue massa.
Integer non sem eget neque mattis accumsan. Maecenas eu nisl mauris, sit amet interdum ipsum. In pharetra erat vel lectus venenatis elementum. Nulla non elit ligula, sit amet mollis urna. Morbi ut gravida est. Mauris tincidunt sem et turpis molestie malesuada. Curabitur vel nulla risus, sed mollis erat. Suspendisse vehicula accumsan purus nec varius. Donec fermentum lorem id felis sodales dictum. Quisque et dolor ipsum. Nam luctus consectetur dui vitae fermentum. Curabitur sodales consequat augue, id ultricies augue tempor ac. Aliquam ac magna id ipsum vehicula bibendum. Sed elementum congue tristique. <img src="../images/image_demo.jpg" width="5mm" height="5mm" /> Phasellus vel lorem eu lectus porta sodales. Etiam neque tortor, sagittis id pharetra quis, laoreet vel arcu.
Cras quam mi, ornare laoreet laoreet vel, vehicula at lacus. Maecenas a lacus accumsan augue convallis sagittis sed quis odio. Morbi sit amet turpis diam, dictum convallis urna. Cras eget interdum augue. Cras eu nisi sit amet dolor faucibus porttitor. Suspendisse potenti. Nunc vitae dolor risus, at cursus libero. Suspendisse bibendum tellus non nibh hendrerit tristique. Mauris eget orci elit. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam porta libero non ante laoreet semper. Proin volutpat sodales mi, ac fermentum erat sagittis in. Vivamus at viverra felis. Ut pretium facilisis ante et pharetra.
Nulla facilisi. Cras varius quam eget libero aliquam vitae tincidunt leo rutrum. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque a nisl massa, quis pretium urna. Proin vel porttitor tortor. Cras rhoncus congue velit in bibendum. Donec pharetra semper augue id lacinia. Quisque magna quam, hendrerit eu aliquam et, pellentesque ut tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Maecenas nulla quam, rutrum eu feugiat at, elementum eu libero. Maecenas ullamcorper leo et turpis rutrum ac laoreet eros faucibus. Phasellus condimentum lorem quis neque imperdiet quis molestie enim iaculis. Phasellus risus est, vestibulum ut convallis ultrices, dignissim nec erat. Etiam congue lobortis laoreet. Nulla ut neque sed velit dapibus semper. Quisque nec dolor id nibh eleifend iaculis. Vivamus vitae fermentum odio. Etiam malesuada quam in nulla aliquam sed convallis dui feugiat.</p>';
// add a page
$pdf->AddPage();
// print some graphic content
$pdf->Image('../images/image_demo.jpg', 155, 30, 40, 40, 'JPG', '', '', true);
$pdf->Image('../images/image_demo.jpg', 15, 230, 40, 40, 'JPG', '', '', true);
// define some graphic styles
$styleA = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(255, 0, 0));
$styleB = array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 3, 'color' => array(127, 127, 127));
$pdf->SetFillColor(220, 255, 220);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(15, 90, 57, 90, 67, 140, 15, 140), 'DF', array($styleB, $styleA, $styleB, $styleB));
$pdf->SetXY(15, 90);
$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'R', false, '', 0, false, 'T', 'T');
$pdf->SetXY(15, 140);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetXY(15, 115);
$pdf->Cell(40, 0, 'side', 0, 0, 'R', false, '', 0, false, 'B', 'B');
$pdf->SetLineStyle(array('width' => 0.254, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)));
$pdf->Arrow(60, 115, 35, 115, 2, 5, 15);
// write a trapezoid with some information about no-write page regions
$pdf->Polygon(array(145, 130, 195, 130, 195, 180, 155, 180), 'DF', array($styleB, $styleB, $styleB, $styleA));
$pdf->SetXY(145, 130);
$pdf->Cell(42, 0, 'xt,yt', 0, 0, 'L', false, '', 0, false, 'T', 'T');
$pdf->SetXY(155, 180);
$pdf->Cell(52, 0, 'xb,yb', 0, 0, 'L', false, '', 0, false, 'B', 'B');
$pdf->SetXY(160, 155);
$pdf->Cell(30, 0, 'side', 0, 0, 'L', false, '', 0, false, 'B', 'B');
示例15:
/*
if($plhead=='Y') $lheight+=9;
if($plcnum=='Y') $lheight+=14;
if($plbcode=='Y') $lheight+=10;
*/
$q=mysql_query("SELECT * FROM `pus_tpjm` WHERE ssid='$ssid'"); $k=0;
//$pdf->MultiCell(100, 0, mysql_num_rows($q), 'LTRB', 'C', 0, 1, '', '', true);
$kol=0; $row=0; $i=0; $nkol=floor($dcPageW/($lwidth+1)); $nrow=99; //$nrow=floor($dcPageH/$lheight);
while($r=mysql_fetch_array($q)){
$t01=mysql_query("SELECT pus_buku.replid,pus_buku.idbuku,pus_buku.barkode,pus_katalog.callnumber FROM pus_buku LEFT JOIN pus_katalog ON pus_katalog.replid=pus_buku.katalog WHERE pus_buku.replid='".$r['buku']."' LIMIT 0,1");
$b=mysql_fetch_array($t01);
//$b=dbSFA("*","pus_buku","W/replid='".$r['buku']."'");
// Print Label >>
$x=($lwidth+1)*$kol+$dcMarginL; $y=$lheight*$row+$dcMarginT;
$pdf->SetXY($x,$y); $pl=false;
if($plhead=='1'){ $pl=true;
$pdf->setCellPaddings(0, 0.5, 0, 0);
$pdf->SetFont('dejavusans', '', 10, '', true);
$pdf->MultiCell($lwidth, 0, $title, 'LTR', 'C', 0, 1, '', '', true);
if($k==0) $lheight+=$pdf->getLastH();
$pdf->SetX($x);
$pdf->setCellPaddings(0, 0, 0, 0.5);
$pdf->SetFont('dejavusans', '', 7, '', true);
$pdf->MultiCell($lwidth, 0, $desc, 'LBR', 'C', 0, 9, '', '', true);
if($k==0) $lheight+=$pdf->getLastH();
}
if($plcnum=='1'){ $pl=true;
//dc_YDown(1);
$pdf->SetX($x);
$pdf->setCellPaddings(0,0.5,0,0.5);