<?php

session_start();
//create handle for new PDF document
$pdf = PDF_new();
//open a file pdf_open_file
PDF_open_file($pdf, "");
//start a new page
PDF_begin_page($pdf, 595, 842);
//get and use a font object
$font = PDF_findfont($pdf, "Times-Roman", "host", 0);
PDF_setfont($pdf, $font, 12);
/*print text*/
// PULLING OF DATA AND OTHER PRINTING INFORMATION------------------------
if ($_SESSION['role'] == 'admin' || $_COOKIE['role'] == 'admin') {
    include 'dbFunctions.php';
    $expenditure_id = $_GET['expenditure_id'];
    $query = "SELECT * FROM expenditure WHERE expenditure_id = {$expenditure_id}";
    $runquery = mysqli_query($connect, $query);
    while ($runrows = mysqli_fetch_array($runquery)) {
        $debit_card = $runrows['debit_card'];
        $amex_card = $runrows['amex_card'];
        $visa_card = $runrows['visa_card'];
        $total_staff_salary = $runrows['total_staff_salary'];
        $phone_bill = $runrows['phone_bill'];
        $rent_bill = $runrows['rent_bill'];
        $electricity_bill = $runrows['electricity_bill'];
        $director_fee = $runrows['director_fee'];
        $date = $runrows['date'];
        $desc = $runrows['desc'];
        $total_amount = $runrows['total_amount'];
Esempio n. 2
0
<?php

$p = PDF_new();
PDF_open_file($p);
PDF_begin_page($p, 595, 842);
$im = pdf_open_jpeg($p, "php-big.jpg");
pdf_place_image($p, $im, 200, 700, 1.0);
pdf_place_image($p, $im, 200, 600, 0.75);
pdf_place_image($p, $im, 200, 535, 0.5);
pdf_place_image($p, $im, 200, 501, 0.25);
pdf_place_image($p, $im, 200, 486, 0.1);
$x = pdf_get_value($p, "imagewidth", $im);
$y = pdf_get_value($p, "imageheight", $im);
pdf_close_image($p, $im);
$font = PDF_findfont($p, "Times-Bold", "host", 0);
PDF_setfont($p, $font, 28.0);
pdf_show_xy($p, "{$x} by {$y}", 25, 800);
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Header("Content-Length:{$len}");
Header("Content-Disposition:inline; filename=coords.pdf");
echo $buf;
PDF_delete($p);
Esempio n. 3
0
<?php

$p = PDF_new();
PDF_open_file($p);
PDF_begin_page($p, 595, 842);
$font = PDF_findfont($p, "Helvetica-Bold", "host", 0);
PDF_setfont($p, $font, 38.0);
PDF_set_parameter($p, "overline", "true");
PDF_show_xy($p, "Overlined Text", 50, 780);
PDF_set_parameter($p, "overline", "false");
PDF_set_parameter($p, "underline", "true");
PDF_continue_text($p, "Underlined Text");
PDF_set_parameter($p, "strikeout", "true");
PDF_continue_text($p, "Underlined strikeout Text");
PDF_set_parameter($p, "underline", "false");
PDF_set_parameter($p, "strikeout", "false");
PDF_setcolor($p, "fill", "rgb", 1.0, 0.1, 0.1);
PDF_continue_text($p, "Red Text");
PDF_setcolor($p, "fill", "rgb", 0, 0, 0);
PDF_set_value($p, "textrendering", 1);
PDF_setcolor($p, "stroke", "rgb", 0, 0.5, 0);
PDF_continue_text($p, "Green Outlined Text");
PDF_set_value($p, "textrendering", 2);
PDF_setcolor($p, "fill", "rgb", 0, 0.2, 0.8);
PDF_setlinewidth($p, 2);
PDF_continue_text($p, "Green Outlined Blue Text");
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Esempio n. 4
0
<?php

//getting new instance
$pdfFile = new_pdf();
PDF_open_file($pdfFile, " ");
//document info
pdf_set_info($pdfFile, "Auther", "Ahmed Elbshry");
pdf_set_info($pdfFile, "Creator", "Ahmed Elbshry");
pdf_set_info($pdfFile, "Title", "PDFlib");
pdf_set_info($pdfFile, "Subject", "Using PDFlib");
//starting our page and define the width and highet of the document
pdf_begin_page($pdfFile, 595, 842);
//check if Arial font is found, or exit
if ($font = PDF_findfont($pdfFile, "Arial", "winansi", 1)) {
    PDF_setfont($pdfFile, $font, 12);
} else {
    echo "Font Not Found!";
    PDF_end_page($pdfFile);
    PDF_close($pdfFile);
    PDF_delete($pdfFile);
    exit;
}
//start writing from the point 50,780
PDF_show_xy($pdfFile, "This Text In Arial Font", 50, 780);
PDF_end_page($pdfFile);
PDF_close($pdfFile);
//store the pdf document in $pdf
$pdf = PDF_get_buffer($pdfFile);
//get  the len to tell the browser about it
$pdflen = strlen($pdfFile);
//telling the browser about the pdf document
 /**
  * Outputs the the via PDF_show_boxed()
  *
  * Outputs the text via PDF_show_boxed() at the
  * specified coordinates, alignment and leading.
  *
  * @param    float   $xpos        The left starting position
  * @param    float   $ypos        The top starting position
  * @param    string  $alignment   "left"/"right"/"center"
  * @param    float   $leading     The text leading
  *
  * @access   public
  */
 function puttext2($xpos, $ypos, $alignment, $leading)
 {
     if (!$this->layoutvalid) {
         $this->getrequiredlinenum();
     }
     $alignment = strtolower($alignment);
     if ($leading == 0) {
         $leading = $this->fontsize;
     }
     $linenum = sizeof($this->lines);
     $height = $linenum * $leading;
     $font = PDF_findfont($this->pdf, $this->fontface, 'host', 0);
     $descender = -PDF_get_value($this->pdf, "descender", $font) * $this->fontsize;
     //PDF_setcolor($this->pdf, "both", "rgb", 0, 0, 1, 0);
     // The passed x/y-coordinates specify the top left corner of the
     // text area whereas PDF_show_boxed() interpretes the coordinates
     // as the x/y-coordinates of the bottom left corner
     $ypos -= $linenum * $leading;
     // PDF_show_boxed() interpretes the coordinates as the text
     // baseline, but we use it for specifying the geometry of the
     // complete  textblock
     $ypos += $descender;
     // PDF_show_boxed() moves the first text line down by "leading"
     // pixels; we want the first line to really appear at the top of
     // the text block
     $ypos += $leading - $this->fontsize;
     // In order to allow output via PDF_show_boxed(),
     // lines consisting only of single word (i.e. lines
     // not containing a space), are supplemented by a LF
     // character
     for ($i = 0; $i < sizeof($this->lines); $i++) {
         $line =& $this->lines[$i];
         if (strpos($line, " ") === false) {
             $line .= "\n";
         }
     }
     $text = implode(" ", $this->lines);
     $text = ereg_replace("\n +", "\n", $text);
     PDF_setfont($this->pdf, $font, $this->fontsize);
     $this->setcolor($this->fontcolor);
     PDF_set_value($this->pdf, "leading", $leading);
     PDF_show_boxed($this->pdf, $text, $xpos, $ypos - 1, $this->width, (int) ($linenum * $leading) + 1, $alignment, "");
     $this->buffer = "";
 }
Esempio n. 6
0
 function SetFont($fonte, $tamanho)
 {
     $f_user = '';
     switch ($fonte) {
         case 'normal':
             $f_user = '******';
             break;
         case 'courier':
             $f_user = '******';
             break;
         case 'courierItalico':
             $f_user = '******';
             break;
         case 'normalItalico':
             $f_user = '******';
             break;
         case 'times':
             $f_user = '******';
             break;
         case 'timesItalico':
             $f_user = '******';
             break;
         case 'symbol':
             $f_user = '******';
             break;
         case 'monospaced':
             $f_user = '******';
             break;
         default:
             $f_user = '******';
     }
     $font = PDF_findfont($this->pdf, $f_user, 'host', 0);
     PDF_setfont($this->pdf, $font, $tamanho);
     if ($this->depurar) {
         echo "<b>PDF:</b> Fonte atual de uso: " . $f_user . "<br>";
     }
 }
Esempio n. 7
0
<?php

$p = PDF_new();
PDF_open_file($p);
PDF_set_info($p, "Creator", "hello.php");
PDF_set_info($p, "Author", "Rasmus Lerdorf");
PDF_set_info($p, "Title", "Hello world (PHP)");
pdf_set_parameter($p, "resourcefile", "/usr/share/fonts/pdflib/pdflib.upr");
PDF_begin_page($p, 595, 842);
PDF_set_text_pos($p, 25, 800);
$fonts = array('Courier' => 0, 'Courier-Bold' => 0, 'Courier-BoldOblique' => 0, 'Courier-Oblique' => 0, 'Helvetica' => 0, 'Helvetica-Bold' => 0, 'Helvetica-BoldOblique' => 0, 'Helvetica-Oblique' => 0, 'Times-Bold' => 0, 'Times-BoldItalic' => 0, 'Times-Italic' => 0, 'Times-Roman' => 0, 'LuciduxSans' => 1, 'Utopia-Regular' => 1, 'URWGothicL-BookObli' => 1, 'URWPalladioL-Roma' => 1, 'NimbusMonL-ReguObli' => 1, 'CANDY' => 1, 'Arial' => 1);
foreach ($fonts as $f => $embed) {
    $font = PDF_findfont($p, $f, "host", $embed);
    PDF_setfont($p, $font, 25.0);
    PDF_continue_text($p, "{$f} (" . chr(128) . " Ç à á â ã ç è é ê)");
}
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Header("Content-Length:{$len}");
Header("Content-Disposition:inline; filename=hello_php.pdf");
echo $buf;
PDF_delete($p);
$pdf = PDF_new();
/* Create a PDF document in memory */
PDF_open_file($pdf, "");
/* Create a DIN A4 page */
PDF_begin_page($pdf, 595, 842);
/* Make an instance of the class */
$barcode = new jh_pdf_barcode(&$pdf);
/* Set the type to 2 of 5 interleaved */
$barcode->settype('25i');
/* Define some test codes */
$code1 = "1231231230";
$code2 = "4564564560";
$code3 = "7897897890";
/* Define a font which will be used to put the plain text
   under the barcode fields */
$font = PDF_findfont($pdf, "Helvetica", 'host', 0);
PDF_setfont($pdf, $font, 12);
/* Set the barcode text and put it onto the PDF document */
$barcode->settext($code1);
$barcode->putcode(30, 812, 100, 50);
/* Put the textual representation under the barcode */
PDF_show_xy($pdf, $code1, 30, 750);
$barcode->settext($code2);
$barcode->putcode(230, 812, 100, 50);
PDF_show_xy($pdf, $code2, 230, 750);
$barcode->settext($code3);
$barcode->putcode(430, 812, 100, 50);
PDF_show_xy($pdf, $code3, 430, 750);
/* Close the last page */
PDF_end_page($pdf);
/* Close the PDF document */
Esempio n. 9
0
<?php

$p = PDF_new();
PDF_open_file($p);
PDF_set_info($p, "Creator", "hello.php");
PDF_set_info($p, "Author", "Rasmus Lerdorf");
PDF_set_info($p, "Title", "Hello world (PHP)");
PDF_begin_page($p, 595, 842);
PDF_set_parameter($p, "FontOutline", "CANDY==/usr/share/fonts/truetype/CANDY.ttf");
$font = PDF_findfont($p, "CANDY", "host", 1);
PDF_setfont($p, $font, 78.0);
PDF_set_value($p, "textrendering", 2);
PDF_setcolor($p, "fill", "rgb", 0.8, 0.8, 0);
PDF_setcolor($p, "stroke", "rgb", 0, 0, 0.5);
PDF_set_text_pos($p, 20, 780);
PDF_continue_text($p, "� � � � � � � � �");
PDF_continue_text($p, "This is a test");
PDF_end_page($p);
PDF_close($p);
$buf = PDF_get_buffer($p);
$len = strlen($buf);
Header("Content-type:application/pdf");
Header("Content-Length:{$len}");
Header("Content-Disposition:inline; filename=candy.pdf");
echo $buf;
PDF_delete($p);