本文整理汇总了PHP中PDF::PageNo方法的典型用法代码示例。如果您正苦于以下问题:PHP PDF::PageNo方法的具体用法?PHP PDF::PageNo怎么用?PHP PDF::PageNo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDF
的用法示例。
在下文中一共展示了PDF::PageNo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* PDF Text renderer
*
* @param PDF $pdf
*
* @return void
*/
function render($pdf)
{
// Set up the style
if ($pdf->getCurrentStyle() != $this->styleName) {
$pdf->setCurrentStyle($this->styleName);
}
$temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
// underline «title» part of Source item
$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
// Paint the text color or they might use inherited colors by the previous function
$match = array();
if (preg_match("/#?(..)(..)(..)/", $this->color, $match)) {
$r = hexdec($match[1]);
$g = hexdec($match[2]);
$b = hexdec($match[3]);
$pdf->SetTextColor($r, $g, $b);
} else {
$pdf->SetTextColor(0, 0, 0);
}
$temptext = spanLTRRTL($temptext, "BOTH");
$temptext = str_replace(array('<br><span dir="rtl" >', '<br><span dir="ltr" >', '> ', ' <'), array('<span dir="rtl" ><br>', '<span dir="ltr" ><br>', '> ', ' <'), $temptext);
$pdf->writeHTML($temptext, false, false, true, false, "");
//change height - line break etc. - the form is mirror on rtl pages
// Reset the text color to black or it will be inherited
$pdf->SetTextColor(0, 0, 0);
}
示例2: render
/**
* PDF image renderer
*
* @param PDF $pdf
*
* @return void
*/
function render($pdf)
{
global $lastpicbottom, $lastpicpage, $lastpicleft, $lastpicright;
// Check for a pagebreak first
if ($pdf->checkPageBreakPDF($this->height + 5)) {
$this->y = $pdf->GetY();
}
$curx = $pdf->GetX();
// If current position (left)set "."
if ($this->x == ".") {
$this->x = $pdf->GetX();
} else {
$this->x = $pdf->addMarginX($this->x);
$pdf->SetX($curx);
}
if ($this->y == ".") {
//-- first check for a collision with the last picture
if (isset($lastpicbottom)) {
if ($pdf->PageNo() == $lastpicpage && $lastpicbottom >= $pdf->GetY() && $this->x >= $lastpicleft && $this->x <= $lastpicright) {
$pdf->SetY($lastpicbottom + 5);
}
}
$this->y = $pdf->GetY();
} else {
$pdf->SetY($this->y);
}
if ($pdf->getRTL()) {
$pdf->Image($this->file, $pdf->getPageWidth() - $this->x, $this->y, $this->width, $this->height, "", "", $this->line, false, 72, $this->align);
} else {
$pdf->Image($this->file, $this->x, $this->y, $this->width, $this->height, "", "", $this->line, false, 72, $this->align);
}
$lastpicpage = $pdf->PageNo();
$pdf->lastpicpage = $pdf->getPage();
$lastpicleft = $this->x;
$lastpicright = $this->x + $this->width;
$lastpicbottom = $this->y + $this->height;
// Setup for the next line
if ($this->line == "N") {
$pdf->SetY($lastpicbottom);
}
}
示例3: renderFootnote
/**
* Write the Footnote text
* Uses style name "footnote" by default
*
* @param PDF $pdf
*
* @return void
*/
function renderFootnote($pdf)
{
if ($pdf->getCurrentStyle() != $this->styleName) {
$pdf->setCurrentStyle($this->styleName);
}
$temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
// Set the link to this y/page position
$pdf->SetLink($this->addlink, -1, -1);
// Print first the source number
// working
if ($pdf->getRTL()) {
$pdf->writeHTML("<span> ." . $this->num . "</span>", false, false, false, false, "");
} else {
$temptext = "<span>" . $this->num . ". </span>" . $temptext;
}
// underline «title» part of Source item
$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
$pdf->writeHTML($temptext, true, false, true, false, '');
}
示例4:
/**
* Show footer of page. Need this->emetteur object
*
* @param PDF $pdf PDF
* @param Object $object Object to show
* @param Translate $outputlangs Object lang for output
* @param int $hidefreetext 1=Hide free text
* @return void
*/
function _pagefoot(&$pdf, $object, $outputlangs, $hidefreetext = 0)
{
global $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
//return pdf_pagefoot($pdf,$outputlangs,'BANK_CHEQUERECEIPT_FREE_TEXT',$this->emetteur,$this->marge_basse,$this->marge_gauche,$this->page_hauteur,$object);
$paramfreetext = 'BANK_CHEQUERECEIPT_FREE_TEXT';
$marge_basse = $this->marge_basse;
$marge_gauche = $this->marge_gauche;
$page_hauteur = $this->page_hauteur;
// Line of free text
$line = !empty($conf->global->{$paramfreetext}) ? $outputlangs->convToOutputCharset($conf->global->{$paramfreetext}) : "";
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->SetDrawColor(224, 224, 224);
// On positionne le debut du bas de page selon nbre de lignes de ce bas de page
$nbofline = dol_nboflines_bis($line, 0, $outputlangs->charset_output);
//print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy = $marge_basse + $nbofline * 3;
if ($line) {
$pdf->SetXY($marge_gauche, -$posy);
$pdf->MultiCell(20000, 3, $line, 0, 'L', 0);
// Use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
$posy -= $nbofline * 3;
// 6 of ligne + 3 of MultiCell
}
$pdf->SetY(-$posy);
$pdf->line($marge_gauche, $page_hauteur - $posy, 200, $page_hauteur - $posy);
$posy--;
/*if ($line1)
{
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
}
if ($line2)
{
$posy-=3;
$pdf->SetXY($marge_gauche,-$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
}*/
// Show page nb only on iso languages (so default Helvetica font)
if (pdf_getPDFFont($outputlangs) == 'Helvetica') {
$pdf->SetXY(-20, -$posy);
$pdf->MultiCell(11, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
}
}
示例5: Footer
$this->Cell(30, 10, $this->title, 1, 0, 'C');
//spacing after header via line break
$this->Ln(20);
}
//Footer for each page
function Footer()
{
// Position at 1.5 cm from bottom
$this->SetY(-15);
// Arial italic 8
$this->SetFont('Arial', 'I', 8);
// Page number
$this->Cell(0, 10, $this->footer_txt, 0, 0, 'C');
}
}
// Instanciation of inherited class
$pdf = new PDF();
//Tell it to count page number for us
$pdf->AliasNbPages();
//we need a page to put things on
$pdf->footer_txt = 'Page ' . $pdf->PageNo() . '/{nb}';
$pdf->logo = 'click-realty-logo-1-with-effect.png';
$pdf->AddPage();
$pdf->SetFont('Times', '', 12);
//Content!
for ($i = 1; $i <= 40; $i++) {
$pdf->Cell(0, 10, 'Printing line number ' . $i, 0, 1);
}
//$pdf->Output('Test.pdf','D');
$pdf->Output('Test.pdf', 'D');
echo '<pre>' . $pdf->logo . '</pre><br />';
示例6: foreach
$pdf->setXY($margin, $pdf->ypos);
foreach ($cols_value as $rkey => $cr) {
if ($rkey == $col_image - 1) {
$pdf->Cell($colwidth, $lineheight, '', 1, 0, 'C');
// die($cols_value[0]);
$items = $class_pm->retrieveDetail($cols_value[0], 'p');
$img_path = DIR_WS_IMAGES . 'imagecache/';
$img_file = basename(webImageSource($items['p']['products_image'], IMAGE_SIZE_THUMBNAIL_1, IMAGE_SIZE_THUMBNAIL_1));
$img = $img_path . $img_file;
$x_col = $margin + ($col_image - 1) * $colwidth;
$posx_image = $x_col + 3;
$pdf->Image($img, $posx_image, $pdf->ypos + 4, 20);
//PRINT TEXT BELOW IMAGE
$pdf->setXY($x_col, $pdf->ypos + $lineheight - ($lineheight / 2 + 2));
$text_under_image_height = $lineheight;
if ($pdf->PageNo() > 1) {
$text_under_image_height -= 3.1;
} else {
$text_under_image_height -= 2;
}
$pdf->Cell($colwidth, $text_under_image_height, $cr, 0, 0, 'C');
$pdf->setXY($x_col + $colwidth, $pdf->ypos);
//RESET BACK CELL POSITION SAME WITH CELL BEFORE
} else {
$pdf->Cell($colwidth, $lineheight, $cr, 1, 0, 'C');
}
}
if ($key % 5 == 0) {
$pdf->AddPage();
$pdf->ypos = 0;
}
示例7: constructPIContent
//.........这里部分代码省略.........
$pdf->setFont('Arial', 'B', $fontsize_big + 2);
$lineheight = 4;
} elseif ($key == 'f') {
$pdf->setFont('Arial', 'B', $fontsize_big);
$lineheight = 4;
} else {
$pdf->setFont('Arial', '', $fontsize_med);
$lineheight = 3.5;
}
if (array_key_exists($key, $ei_labels)) {
$ei = $ei_labels[$key] . $ei;
}
$pdf->setXY($colpos + $col_subcol_infopos, $rowpos_incol);
$pdf->Cell($col_subcol_width[4], $lineheight, $ei, 0, 0, 'C');
$rowpos_incol += $lineheight;
}
}
if ($pue_rows > $max_rows_el_per_page) {
//IF ELEMENT USED MORE THAN MAX ROWS ELEMENT COULD FIT PER PAGE
$n_rows = $max_rows_el_per_page;
} else {
$n_rows = $pue_rows;
}
if ($pue_counter == $n_rows) {
$colpos = $margin + $colwidth + 5;
$rowpos = $YPOS;
$print_header_el = true;
} else {
$print_header_el = false;
$rowpos += $colheight;
if ($pue_counter % $max_rows_el_per_page == 0 && $pue_counter / $max_rows_el_per_page > 1) {
//IF ELEMENT USED REACH THE END OF PAGE AND THERE STILL ELEMENT NEED TO BE PRINTED
$pdf->AddPage();
if ($pdf->PageNo() > 1) {
$max_rows_el_per_page = $max_rows_el_per_page_n;
}
//SET MARGIN TO THE VERY TOP OF PAGE
$colpos = $margin + 1;
$rowpos = $margin;
$YPOS = $rowpos;
$pue_rows = ceil(($pue_total - $pue_number) / 2);
//RECALCULATE THE REST OF ELEMENTS THAT COULD DIVIDED INTO 2 COLUMNS
$pue_counter = 0;
}
}
}
$YPOS += 5 + 3 + $pue_rows * $colheight;
}
//PRODUCT INFORMATION
if ($pue_rows > 9) {
$pdf->AddPage();
$item_page_count++;
$YPOS = $margin;
}
$lineheight = 4;
$imgbig_width = 60;
$imgsml_width = 25;
$rowpos = $YPOS;
$colpos = $margin + 1;
$pdf->SetXY($margin, $YPOS);
$pdf->setFont('Arial', 'B', $fontsize_big);
$pdf->Cell(100, $lineheight, 'Product Information');
$YPOS += $lineheight + 1;
$rowpos = $YPOS;
$imgbig = $this->getImageForPDF($p['p']['products_image'], '', '212');
//if($imgbig!='') $pdf->Image($imgbig, $colpos, $rowpos, $imgbig_width);
示例8: pdf_pagefoot
//.........这里部分代码省略.........
} else {
$line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $tmpamounttoshow, $outputlangs);
}
}
// Prof Id 1
if ($fromcompany->idprof1 && ($fromcompany->country_code != 'FR' || !$fromcompany->idprof2)) {
$field = $outputlangs->transcountrynoentities("ProfId1", $fromcompany->country_code);
if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
$field = $reg[1];
}
$line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof1);
}
// Prof Id 2
if ($fromcompany->idprof2) {
$field = $outputlangs->transcountrynoentities("ProfId2", $fromcompany->country_code);
if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
$field = $reg[1];
}
$line3 .= ($line3 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof2);
}
// Line 4 of company infos
// Prof Id 3
if ($fromcompany->idprof3) {
$field = $outputlangs->transcountrynoentities("ProfId3", $fromcompany->country_code);
if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
$field = $reg[1];
}
$line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof3);
}
// Prof Id 4
if ($fromcompany->idprof4) {
$field = $outputlangs->transcountrynoentities("ProfId4", $fromcompany->country_code);
if (preg_match('/\\((.*)\\)/i', $field, $reg)) {
$field = $reg[1];
}
$line4 .= ($line4 ? " - " : "") . $field . ": " . $outputlangs->convToOutputCharset($fromcompany->idprof4);
}
// IntraCommunautary VAT
if ($fromcompany->tva_intra != '') {
$line4 .= ($line4 ? " - " : "") . $outputlangs->transnoentities("VATIntraShort") . ": " . $outputlangs->convToOutputCharset($fromcompany->tva_intra);
}
$pdf->SetFont('', '', 7);
$pdf->SetDrawColor(224, 224, 224);
// The start of the bottom of this page footer is positioned according to # of lines
$freetextheight = 0;
if ($line) {
$width = 20000;
$align = 'L';
// By default, ask a manual break: We use a large value 20000, to not have automatic wrap. This make user understand, he need to add CR on its text.
if (!empty($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT)) {
$width = 200;
$align = 'C';
}
$freetextheight = $pdf->getStringHeight($width, $line);
}
$marginwithfooter = $marge_basse + $freetextheight + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
$posy = $marginwithfooter + 0;
if ($line) {
$pdf->SetXY($dims['lm'], -$posy);
$pdf->MultiCell(0, 3, $line, 0, $align, 0);
$posy -= $freetextheight;
}
$pdf->SetY(-$posy);
$pdf->line($dims['lm'], $dims['hk'] - $posy, $dims['wk'] - $dims['rm'], $dims['hk'] - $posy);
$posy--;
if (!empty($line1)) {
$pdf->SetFont('', 'B', 7);
$pdf->SetXY($dims['lm'], -$posy);
$pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line1, 0, 'C', 0);
$posy -= 3;
$pdf->SetFont('', '', 7);
}
if (!empty($line2)) {
$pdf->SetFont('', 'B', 7);
$pdf->SetXY($dims['lm'], -$posy);
$pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line2, 0, 'C', 0);
$posy -= 3;
$pdf->SetFont('', '', 7);
}
if (!empty($line3)) {
$pdf->SetXY($dims['lm'], -$posy);
$pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line3, 0, 'C', 0);
}
if (!empty($line4)) {
$posy -= 3;
$pdf->SetXY($dims['lm'], -$posy);
$pdf->MultiCell($dims['wk'] - $dims['rm'], 2, $line4, 0, 'C', 0);
}
// Show page nb only on iso languages (so default Helvetica font)
if (strtolower(pdf_getPDFFont($outputlangs)) == 'helvetica') {
$pdf->SetXY(-20, -$posy);
//print 'xxx'.$pdf->PageNo().'-'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
if (empty($conf->global->MAIN_USE_FPDF)) {
$pdf->MultiCell(13, 2, $pdf->PageNo() . '/' . $pdf->getAliasNbPages(), 0, 'R', 0);
} else {
$pdf->MultiCell(13, 2, $pdf->PageNo() . '/{nb}', 0, 'R', 0);
}
}
return $marginwithfooter;
}
示例9: ImprimeCartaDecanatura
private function ImprimeCartaDecanatura()
{
$this->load->library('fpdf/pdf');
$pdf = new PDF();
$pdf->AddPage();
$pdf->Image(base_url('public/images/logo.jpg'), 80, 15, 60, 18);
$Dep = $this->parametros_model->TraeDependencias();
#ENCABEZADO
$pdf->SetFont('Arial', 'b', 10);
$pdf->Text(178, 35, 'GD-026-F');
$pdf->SetFillColor(230, 230, 230);
$pdf->SetXY(25, 38);
$pdf->Cell(170, 5, 'MEMORANDO', 0, 0, 'C', true);
$pdf->Text(25, 48, strtoupper($this->input->post('CONSECUTIVO')));
$pdf->SetFont('Arial', '', 10);
$pdf->Text(25, 58, 'Medellín, ' . MesNombre(date('m')) . ' ' . round(date('d')) . ' de ' . date('Y'));
#PARA
$pdf->SetFont('Arial', 'b', 10);
$pdf->Text(25, 75, 'PARA:');
$pdf->Text(50, 75, ($Dep->DECANATURA_TITULO == 0 ? 'Ingeniera' : 'Ingeniero') . ' ' . $Dep->DECANATURA);
$pdf->SetFont('Arial', '', 10);
$pdf->Text(50, 80, ($Dep->DECANATURA_TITULO == 0 ? 'Decana' : 'Decano') . ' Facultad de ingeniería');
#DE
$pdf->SetFont('Arial', 'b', 10);
$pdf->Text(25, 90, 'DE:');
$pdf->Text(50, 90, $this->input->post('TITULO') . ' ' . $this->session->userdata('NOMBRE_USUARIO'));
$pdf->SetFont('Arial', '', 10);
$pdf->Text(50, 95, 'Docente Asesor de Prácticas');
#ASUNTO
$pdf->SetFont('Arial', 'b', 10);
$pdf->Text(25, 103, 'ASUNTO:');
$pdf->SetFont('Arial', '', 10);
$pdf->SetXY(50, 100);
$pdf->MultiCell(130, 4, $this->input->post('ASUNTO'));
$pdf->Text(25, 130, 'Cordial Saludo,');
$pdf->SetXY(25, 140);
$pdf->MultiCell(165, 4, $this->input->post('CARTA'));
$pdf->Text(25, 20 + $pdf->GetY(), 'Atentamente,');
$pdf->SetFont('Arial', 'b', 10);
$pdf->Text(25, $pdf->GetY() + 40, $this->session->userdata('NOMBRE_USUARIO'));
$pdf->SetFont('Arial', '', 10);
$pdf->Text(25, $pdf->GetY() + 45, 'Docente Asesor de Prácticas');
$pdf->Output();
$pdf->Cell($pdf->PageNo());
}
示例10: BuildPDF
function BuildPDF($report, $delivery_method = 'D')
{
// for forms only - PDF style
global $db, $messageStack, $FieldValues, $posted_currencies;
// Generate a form for each group element
$output = array();
$pdf = new PDF();
foreach ($report->recordID as $formNum => $Fvalue) {
$pdf->StartPageGroup();
// find the single line data from the query for the current form page
$TrailingSQL = " from " . $report->sqlTable . " where " . ($report->sqlCrit ? $report->sqlCrit . " AND " : '') . prefixTables($report->formbreakfield) . " = '" . $Fvalue . "'";
$FieldValues = array();
if ($report->special_class) {
$form_class = $report->special_class;
$special_form = new $form_class();
$FieldValues = $special_form->load_query_results($report->formbreakfield, $Fvalue);
} else {
if (strlen($report->sqlField) > 0) {
//echo 'sql = select ' . $report->sqlField . $TrailingSQL . '<br />'; exit();
$result = $db->Execute("select " . $report->sqlField . $TrailingSQL);
$FieldValues = $result->fields;
}
}
// load the posted currency values
$posted_currencies = array();
if (ENABLE_MULTI_CURRENCY && strpos($report->sqlTable, TABLE_JOURNAL_MAIN) !== false) {
$sql = "select currencies_code, currencies_value " . $TrailingSQL;
$result = $db->Execute($sql);
$posted_currencies = array('currencies_code' => $result->fields['currencies_code'], 'currencies_value' => $result->fields['currencies_value']);
} else {
$posted_currencies = array('currencies_code' => DEFAULT_CURRENCY, 'currencies_value' => 1);
}
foreach ($report->fieldlist as $key => $field) {
// Build the text block strings
if ($field->type == 'TBlk') {
if (!$field->boxfield[0]->fieldname) {
return $messageStack->add(PHREEFORM_EMPTYFIELD . $field->fieldname, 'error');
}
if ($report->special_class) {
$TextField = $special_form->load_text_block_data($field->boxfield);
} else {
$arrTxtBlk = array();
// Build the fieldlist
foreach ($field->boxfield as $idx => $entry) {
$arrTxtBlk[] = prefixTables($entry->fieldname) . ' as r' . $idx;
}
$strTxtBlk = implode(', ', $arrTxtBlk);
$result = $db->Execute("select " . $strTxtBlk . $TrailingSQL);
$TextField = '';
for ($i = 0; $i < sizeof($field->boxfield); $i++) {
$temp = $field->boxfield[$i]->formatting ? ProcessData($result->fields['r' . $i], $field->boxfield[$i]->formatting) : $result->fields['r' . $i];
$TextField .= AddSep($temp, $field->boxfield[$i]->processing);
}
}
$report->fieldlist[$key]->text = $TextField;
}
if ($field->type == 'LtrData') {
// letter template
if (!$field->boxfield) {
return $messageStack->add(PHREEFORM_EMPTYFIELD . $field->description, 'error');
}
$tblField = '';
$data = array();
if ($report->special_class) {
$report->LetterData = $special_form->load_letter_data($field->boxfield);
} else {
$tblField = array();
foreach ($field->boxfield as $key => $TableField) {
$tblField[] = prefixTables($TableField->fieldname) . " as {$TableField->description} ";
}
$tblField = implode(', ', $tblField);
$result = $db->Execute("select {$tblField} {$TrailingSQL} LIMIT 1");
foreach ($field->boxfield as $key => $TableField) {
if ($TableField->processing) {
$result->fields[$TableField->description] = ProcessData($result->fields[$TableField->description], $TableField->processing);
}
}
$report->LetterData = $result->fields;
}
}
// Pre-load all total fields with 'Continued' label for multipage
if ($field->type == 'Ttl') {
$report->fieldlist[$key]->text = TEXT_CONTINUED;
}
}
$pdf->PageCnt = $pdf->PageNo();
// reset the current page numbering for this new form
$pdf->AddPage();
// Send the table
foreach ($report->fieldlist as $TableObject) {
if ($TableObject->type == 'Tbl') {
if (!$TableObject->boxfield) {
return $messageStack->add(PHREEFORM_EMPTYFIELD . $TableObject->description, 'error');
}
// Build the sql
$tblField = '';
$tblHeading = array();
foreach ($TableObject->boxfield as $TableField) {
$tblHeading[] = $TableField->description;
}
//.........这里部分代码省略.........
示例11: render
/**
* PDF Cell renderer
*
* @param PDF $pdf
*
* @return void
*/
function render($pdf)
{
// Set up the text style
if ($pdf->getCurrentStyle() != $this->styleName) {
$pdf->setCurrentStyle($this->styleName);
}
$temptext = str_replace("#PAGENUM#", $pdf->PageNo(), $this->text);
// underline «title» part of Source item
$temptext = str_replace(array('«', '»'), array('<u>', '</u>'), $temptext);
$match = array();
// Indicates if the cell background must be painted (1) or transparent (0)
if ($this->fill == 1) {
if (!empty($this->bgcolor)) {
// HTML color to RGB
if (preg_match("/#?(..)(..)(..)/", $this->bgcolor, $match)) {
$r = hexdec($match[1]);
$g = hexdec($match[2]);
$b = hexdec($match[3]);
$pdf->SetFillColor($r, $g, $b);
}
} else {
$this->fill = 0;
}
}
// Paint the Border color if set
if (!empty($this->bocolor)) {
// HTML color to RGB
if (preg_match("/#?(..)(..)(..)/", $this->bocolor, $match)) {
$r = hexdec($match[1]);
$g = hexdec($match[2]);
$b = hexdec($match[3]);
$pdf->SetDrawColor($r, $g, $b);
}
}
// Paint the text color or they might use inherited colors by the previous function
if (preg_match("/#?(..)(..)(..)/", $this->tcolor, $match)) {
$r = hexdec($match[1]);
$g = hexdec($match[2]);
$b = hexdec($match[3]);
$pdf->SetTextColor($r, $g, $b);
} else {
$pdf->SetTextColor(0, 0, 0);
}
// If current position (left)
if ($this->left == ".") {
$cX = $pdf->GetX();
} else {
$cX = $pdf->addMarginX($this->left);
}
// Check the width if set to page wide OR set by xml to larger then page wide
if ($this->width == 0 || $this->width > $pdf->getRemainingWidthPDF()) {
$this->width = $pdf->getRemainingWidthPDF();
}
// For current position
if ($this->top == ".") {
$this->top = $pdf->GetY();
} else {
$pdf->SetY($this->top);
}
// Check the last cell height and adjust the current cell height if needed
if ($pdf->lastCellHeight > $this->height) {
$this->height = $pdf->lastCellHeight;
}
// Check for pagebreak
if (!empty($temptext)) {
$cHT = $pdf->getNumLines($temptext, $this->width);
$cHT = $cHT * $pdf->getCellHeightRatio() * $pdf->getCurrentStyleHeight();
$cM = $pdf->getMargins();
// Add padding
if (is_array($cM['cell'])) {
$cHT += $cM['padding_bottom'] + $cM['padding_top'];
} else {
$cHT += $cM['cell'] * 2;
}
// Add a new page if needed
if ($pdf->checkPageBreakPDF($cHT)) {
$this->top = $pdf->GetY();
}
$temptext = spanLTRRTL($temptext, "BOTH");
}
// HTML ready - last value is true
$pdf->MultiCell($this->width, $this->height, $temptext, $this->border, $this->align, $this->fill, $this->newline, $cX, $this->top, $this->reseth, $this->stretch, true);
// Reset the last cell height for the next line
if ($this->newline >= 1) {
$pdf->lastCellHeight = 0;
} elseif ($pdf->lastCellHeight < $pdf->getLastH()) {
$pdf->lastCellHeight = $pdf->getLastH();
}
// Set up the url link if exists ontop of the cell
if (!empty($this->url)) {
$pdf->Link($cX, $this->top, $this->width, $this->height, $this->url);
}
// Reset the border and the text color to black or they will be inherited
//.........这里部分代码省略.........
示例12: makeOption
$this->SetY(-15);
$this->SetFont('Arial', 'I', 8);
//$this->Cell(10,10,'Page '.$this->PageNo(),0,0,'C');
}
}
$nmBrg = makeOption($dbname, 'log_5masterbarang', 'kodebarang,namabarang', $whBrg);
$nmKar = makeOption($dbname, 'datakaryawan', 'karyawanid,namakaryawan', $whKar);
$nmOrg = makeOption($dbname, 'organisasi', 'kodeorganisasi,namaorganisasi');
$pdf = new PDF('P', 'mm', 'A4');
/*for($i=1;$i<=4;$i++)
{
$pdf->AddPage();
}
$pdf->Ln();
*/
$halaman = $pdf->PageNo();
for ($halaman = 1; $halaman <= 4; $halaman++) {
$pdf->AddPage();
$iHt = "select * from " . $dbname . ".pmn_faktur where nofaktur='" . $nofaktur . "' ";
$nHt = mysql_query($iHt) or die(mysql_error($conn));
$dHt = mysql_fetch_assoc($nHt);
$noKontrak = $dHt['nokontrak'];
$qStatus = "SELECT b.statusberikat FROM " . $dbname . ".pmn_kontrakjual a\n\t\t\tLEFT JOIN " . $dbname . ".pmn_4customer b ON a.koderekanan=b.kodecustomer\n\t\t\twhere a.nokontrak='" . $noKontrak . "'";
$resStatus = fetchData($qStatus);
$sBerikat = $resStatus[0]['statusberikat'];
$height = 5;
$height2 = 6;
$pdf->SetFont('Arial', '', 6);
$pdf->SetXY(130, 10);
if ($halaman == 1) {
$isiLampiran = "Lembar ke-1 : Untuk Pembelian BKP / Penerimaan JKP sebagai bukti";
示例13: programas
include_once "../../class/programas.php";
$programas = new programas();
include_once "../../class/informeprograma.php";
$informeprograma = new informeprograma();
include_once "../../class/impresora.php";
$impresora = new impresora();
$imp = array_shift($impresora->mostrar($inf['codimpresora']));
$pdf = new PDF("P", "mm", "letter");
$pdf->AliasNbPages();
$pdf->AddPage();
$pdf->CuadroCuerpoPersonalizado(20, " Fecha:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(40, date("d/m/Y", strtotime($inf['fecha'])), 1, "C", 1);
$pdf->CuadroCuerpoPersonalizado(20, " Hora:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(40, date("H:i:s", strtotime($inf['hora'])), 1, "C", 1);
$pdf->CuadroCuerpoPersonalizado(20, " Página:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(40, $pdf->PageNo() . " de {nb}", 1, "C", 1);
$pdf->ln(10);
$pdf->CuadroCuerpoPersonalizado(25, " Solicitante:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(60, $usus1['nombre'] . " " . $usus1['paterno'] . " " . $usus1['materno'], 1, "C", 1);
$pdf->CuadroCuerpoPersonalizado(20, " Cargo:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(40, $usus1['cargo'], 1, "C", 1);
$pdf->ln();
$pdf->CuadroCuerpoPersonalizado(25, " Lugar:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(60, $usus1['lugar'], 1, "C", 1);
$pdf->CuadroCuerpoPersonalizado(20, " Unidad:", 1, 1, 1, "B");
$pdf->CuadroCuerpo(40, $usus1['unidad'], 1, "C", 1);
$pdf->ln(10);
$pdf->CuadroCuerpoPersonalizado(60, " Trabajos a Realizar", 0, 1, 0, "B");
$pdf->Ln(7);
$i = 0;
foreach ($trabajo->mostrarTodos("", "nombre") as $t) {
示例14: process_content
/**
* @param PDF $pdf
* @param $bug_ids
* @param $version_date
* @param $chapter_prefix
* @param $option_show_duration
* @param $detail_flag
*/
function process_content(PDF $pdf, $bug_ids, $version_date, $chapter_prefix, $option_show_duration, $detail_flag)
{
$specmanagement_editor_api = new specmanagement_editor_api();
$bug_counter = 10;
foreach ($bug_ids as $bug_id) {
if (bug_exists($bug_id)) {
$bug_data = $specmanagement_editor_api->calculate_bug_data($bug_id, $version_date);
if ($detail_flag) {
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')');
$pdf->SetFont('Arial', '', 12);
if ($option_show_duration == '1' && !($bug_data[7] == 0 || is_null($bug_data[7]))) {
$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(95, 10, plugin_lang_get('editor_bug_duration') . ': ' . $bug_data[7] . ' ' . plugin_lang_get('editor_duration_unit'), '', 0, 0);
$pdf->SetFont('Arial', '', 12);
}
$pdf->Ln();
$pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[2])), 0, 1);
$pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[3])), 0, 1);
$pdf->MultiCell(0, 10, utf8_decode(trim($bug_data[4])), 0, 1);
if (!empty($bug_data[5])) {
$bug_attachements = file_get_visible_attachments($bug_id);
$bug_attachements_count = count($bug_attachements);
$pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_attachments')) . ' (' . $bug_attachements_count . ')', 0, 1);
foreach ($bug_attachements as $bug_attachement) {
// var_dump( $bug_attachement );
/** TODO: Bilder anzeigen */
if ($bug_attachement['type'] == 'image') {
$file_download_url = config_get_global('path') . $bug_attachement['download_url'];
// $file_download_url = 'https://upload.wikimedia.org/wikipedia/commons/c/c6/Bayerischer_Wald_-_Aufichtenwald_001.jpg';
fopen($file_download_url, 'r');
$contents = file_get_contents($file_download_url);
$savename = '_' . $bug_attachement['id'] . $bug_attachement['display_name'];
$savefile = fopen($savename, 'w');
fwrite($savefile, $contents);
fclose($savefile);
// $pdf->Image( $savename );
}
}
}
if (!is_null($bug_data[6]) && $bug_data[6] != 0) {
$pdf->MultiCell(0, 10, utf8_decode(plugin_lang_get('editor_bug_notes_note')) . ' (' . $bug_data[6] . ')', 0, 1);
}
} else {
$pdf->Cell(95, 10, $chapter_prefix . '.' . $bug_counter . ' ' . utf8_decode(string_display($bug_data[1]) . ' (' . bug_format_id($bug_data[0])) . ')', 0, 0);
$pdf->Cell(95, 10, $pdf->PageNo(), 0, 1, 'R');
}
$bug_counter += 10;
}
}
}
示例15: BuildPDF
//.........这里部分代码省略.........
if ($SingleObject['params']['index'] == 'TBlk') {
if (!$SingleObject['params']['Seq']) {
$messageStack->add(RW_RPT_EMPTYFIELD . $SingleObject['seqnum'], 'error');
return;
}
if ($Prefs['special_report']) {
$TextField = $special_form->load_text_block_data($SingleObject['params']['Seq']);
} else {
$strTxtBlk = '';
// Build the fieldlist
foreach ($SingleObject['params']['Seq'] as $OneField) {
$strTxtBlk .= $OneField['TblField'] . ', ';
}
$strTxtBlk = substr($strTxtBlk, 0, -2);
$sql = "select " . $strTxtBlk . $TrailingSQL;
$sql = GenReplaceTables($sql, $tables);
$result = $db->Execute($sql);
$TxtBlkValues = $result->fields;
$TextField = '';
$t = 0;
foreach ($TxtBlkValues as $Temp) {
$TextField .= AddSep($Temp, $SingleObject['params']['Seq'][$t]['Processing']);
$t++;
// mapping counter to separator directive
}
}
$FieldListings[$key]['params']['TextField'] = $TextField;
}
// Pre-load all total fields with 'Continued' label for multipage
if ($SingleObject['params']['index'] == 'Ttl') {
$FieldListings[$key]['params']['TextField'] = TEXT_CONTINUED;
}
}
$pdf->PageCnt = $pdf->PageNo();
// reset the current page numbering for this new form
$pdf->AddPage();
// Send the table
foreach ($FieldListings as $TableObject) {
if ($TableObject['params']['index'] == 'Tbl') {
if (!$TableObject['params']['Seq']) {
$messageStack->add(RW_RPT_EMPTYFIELD . $TableObject['seqnum'], 'error');
return;
}
// Build the sql
$tblField = '';
$tblHeading = array();
foreach ($TableObject['params']['Seq'] as $TableField) {
$tblHeading[] = $TableField['TblDesc'];
}
if ($Prefs['special_report']) {
$TableObject['params']['Data'] = $special_form->load_table_data($TableObject['params']['Seq']);
} else {
foreach ($TableObject['params']['Seq'] as $TableField) {
$tblField .= $TableField['TblField'] . ', ';
}
$tblField = substr($tblField, 0, -2);
// remove the last two chars (comma and space)
$sql = "select " . $tblField . $TrailingSQL;
$sql = GenReplaceTables($sql, $tables);
$result = $db->Execute($sql);
while (!$result->EOF) {
$TableObject['params']['Data'][] = $result->fields;
$result->MoveNext();
}
}
array_unshift($TableObject['params']['Data'], $tblHeading);