Esempio n. 1
0
 function drawText($text, $left, $right, $height, $style)
 {
     $h = $height;
     // Creating duplicate (temp)
     $this->_convertPosition($left, $height);
     $this->_convertPosition($right, $h);
     pdf_setcolor($this->pdf, 'fill', $style['fill'][0], $style['fill'][1], $style['fill'][2], $style['fill'][3], $style['fill'][4]);
     pdf_setfont($this->pdf, $this->font, $style['font']);
     pdf_show_boxed($this->pdf, $text, $left, $height - $style['font'], $right - $left, $style['font'], $style['align'], '');
 }
Esempio n. 2
0
 function _cell(&$cell)
 {
     static $row_text = array();
     $row_text[] = $cell->text;
     if (!$cell->end_row) {
         return;
     }
     $this->pdf_cy = pdf_get_value($this->pdf, "texty", null);
     pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
     $height = 10;
     $txt = strip_markups($row_text[0]);
     while (pdf_show_boxed($this->pdf, $txt, 60, $this->pdf_cy, $this->pdf_x - 120, $height, 'left', 'blind')) {
         $height += 10;
     }
     if ($this->pdf_cy + $height > $this->pdf_y - 40) {
         $this->my_pdf_page_number($this->pdf, $this->pdf_x, $this->pdf_y);
         $this->my_new_pdf_end_page($this->pdf);
         $this->my_new_pdf_page($this->pdf, $this->pdf_x, $this->pdf_y, true);
         $this->pdf_cx = 40;
         $this->pdf_cy = 60;
     }
     pdf_set_font($this->pdf, $this->pdf_font, -12, 'winansi');
     if (!empty($cell->bold) && $cell->bold) {
         pdf_set_font($this->pdf, $this->pdf_font_bold, -12, 'winansi');
     } else {
         if (!empty($obj->bold) && $obj->bold) {
             pdf_set_font($this->pdf, $this->pdf_font_bold, -12, 'winansi');
         }
     }
     $off = 0;
     foreach ($row_text as $t) {
         pdf_show_boxed($this->pdf, strip_markups($t), 60 + $off, $this->pdf_cy - $height, 60 + $off + $cell->offset, $height, 'left', null);
         $off += $cell->offset;
     }
     $this->pdf_cy += $height;
     pdf_set_text_pos($this->pdf, $this->pdf_cx, $this->pdf_cy);
     pdf_continue_text($this->pdf, "");
     $row_text = array();
 }
Esempio n. 3
0
 $previous_disc = 1;
 $query = mysql_query('SELECT title, artist, disc FROM track WHERE album_id = "' . mysql_real_escape_string($album_id) . '" ORDER BY relative_file');
 while ($track = mysql_fetch_assoc($query)) {
     if ($previous_disc != $track['disc']) {
         $text .= "\n";
     }
     if ($same_artist) {
         $text .= $track['title'] . "\n";
     } else {
         $text .= $track['artist'] . ' - ' . $track['title'] . "\n";
     }
     $previous_disc = $track['disc'];
 }
 // $text = iconv(NJB_DEFAULT_CHARSET, 'UTF-8', $text);
 pdf_setfont($pdf, $font, 3);
 pdf_show_boxed($pdf, $text, 6.5, 0, 138, 108, 'center', '');
 $query = mysql_query('SELECT artist, album FROM album WHERE album_id = "' . mysql_real_escape_string($album_id) . '"');
 $album = mysql_fetch_assoc($query);
 if (in_array(strtolower($album['artist']), $cfg['no_album_artist'])) {
     $title = $album['album'];
 } else {
     $title = $album['artist'] . ' - ' . $album['album'];
 }
 // $title = iconv(NJB_DEFAULT_CHARSET, 'UTF-8', $title);
 pdf_setfont($pdf, $font, 4);
 pdf_save($pdf);
 pdf_rotate($pdf, 90);
 pdf_set_text_pos($pdf, 2, -4.5);
 // y, -x
 pdf_show($pdf, $title);
 pdf_restore($pdf);
Esempio n. 4
0
}
pdf_setcolor($pdf, 'fill', 'gray', 0, 0, 0, 0);
pdf_setcolor($pdf, 'stroke', 'gray', 0, 0, 0, 0);
pdf_moveto($pdf, 20, $y - 160);
pdf_lineto($pdf, $x - 20, $y - 160);
pdf_stroke($pdf);
pdf_moveto($pdf, $x - 140, $y - 160);
pdf_lineto($pdf, $x - 140, 80);
pdf_stroke($pdf);
pdf_set_font($pdf, "Times-Bold", 18, winansi);
pdf_show_xy($pdf, "Articulo", 30, $y - 150);
pdf_show_xy($pdf, "Precio", $x - 100, $y - 150);
pdf_set_font($pdf, "Times-Italic", 15, winansi);
$offset = 177;
foreach ($items as $item) {
    pdf_show_xy($pdf, $item[0], 30, $y - $offset);
    pdf_show_boxed($pdf, '$' . number_format($item[1], 2), $x - 55, $y - $offset, 0, 0, 'right');
    $offset += 24;
    $total += $item[1];
}
pdf_set_font($pdf, "Times-Bold", 17, winansi);
$offset += 24;
pdf_show_xy($pdf, 'Total', 30, $y - $offset);
pdf_show_boxed($pdf, '$' . number_format($total, 2), $x - 55, $y - $offset, 0, 0, 'right');
pdf_end_page($pdf);
pdf_close($pdf);
$data = pdf_get_buffer($pdf);
header('Content-type: application/pdf');
header("Content-disposition: inline; filename=invoice.pdf");
header("Content-length: " . strlen($data));
echo $data;
Esempio n. 5
0
 pdf_lineto($pdf, -1, 118);
 pdf_moveto($pdf, 152, 0);
 pdf_lineto($pdf, 162, 0);
 pdf_moveto($pdf, 152, 118);
 pdf_lineto($pdf, 162, 118);
 pdf_stroke($pdf);
 $temp = '';
 // Now let's get the tracks for this album
 $tracks = $node->getSubNodes("tracks", -1);
 foreach ($tracks as $track) {
     $meta = $track->getMeta();
     $temp .= "         " . $meta['number'] . " - " . $track->getName() . "\n";
 }
 $font = pdf_findfont($pdf, 'Helvetica', 'winansi', 0);
 pdf_setfont($pdf, $font, 3);
 pdf_show_boxed($pdf, $temp, 6.5, 0, 138, 108, 'left', '');
 pdf_setfont($pdf, $font, 4);
 pdf_set_text_pos($pdf, 2, -4.5);
 //y,-x
 pdf_rotate($pdf, 90);
 pdf_show($pdf, $artist . ' - ' . $album);
 pdf_rotate($pdf, -90);
 pdf_setfont($pdf, $font, 4);
 pdf_set_text_pos($pdf, -116, 151 - 4.5);
 //-y,x
 pdf_rotate($pdf, -90);
 pdf_show($pdf, $artist . ' - ' . $album);
 pdf_rotate($pdf, 90);
 //  +---------------------------------------------------------------------------+
 //  | PDF Front Cover                                                           |
 //  +---------------------------------------------------------------------------+