/**
  * Returns the PDF as a string
  * 
  * @param array $options Output options
  * @return string
  */
 function output($options = null)
 {
     // Add page text
     $this->_add_page_text();
     $debug = isset($options["compress"]) && $options["compress"] != 1;
     return $this->_pdf->output($debug);
 }
示例#2
0
 private function getFont($family, $style)
 {
     $map = array("serif" => "Times", "sans-serif" => "Helvetica", "fantasy" => "Symbol", "cursive" => "Times", "monospace" => "Courier", "arial" => "Helvetica", "verdana" => "Helvetica");
     $family = strtolower($family);
     if (isset($map[$family])) {
         $family = $map[$family];
     }
     $this->canvas->selectFont("{$family}.afm");
 }
示例#3
0
 public function measureText($text)
 {
     if (self::DEBUG) {
         echo __FUNCTION__ . "\n";
     }
     $style = $this->getStyle();
     $this->getFont($style->fontFamily, $style->fontStyle);
     return $this->canvas->getTextWidth($this->getStyle()->fontSize, $text);
 }
 /**
  * Returns the PDF as a string
  *
  * @return string
  */
 function output($options = null)
 {
     // Add page text
     $this->_add_page_text();
     if (isset($options["compress"]) && $options["compress"] != 1) {
         $debug = 1;
     } else {
         $debug = 0;
     }
     return $this->_pdf->output($debug);
 }
 function __construct($pageSize = array(0, 0, 612, 792), $isUnicode = false, $fontcache = '', $tmp = '')
 {
     $this->isUnicode = $isUnicode;
     $this->fontcache = $fontcache;
     $this->tmp = $tmp;
     $this->newDocument($pageSize);
     $this->compressionReady = function_exists('gzcompress');
     if (in_array('Windows-1252', mb_list_encodings())) {
         self::$targetEncoding = 'Windows-1252';
     }
     $this->setFontFamily('init');
 }
示例#6
0
 /**
  * Calculates font height
  *
  * @param string $font
  * @param float $size
  * @return float
  */
 static function get_font_height($font, $size)
 {
     return self::$_pdf->get_font_height($font, $size);
 }
include 'includes/session.inc';
if (isset($_POST['PrintPDF'])) {
    include 'includes/class.pdf.php';
    /* A4_Landscape */
    $Page_Width = 842;
    $Page_Height = 595;
    $Top_Margin = 20;
    $Bottom_Margin = 20;
    $Left_Margin = 25;
    $Right_Margin = 22;
    // Javier: now I use the native constructor
    //	$PageSize = array(0,0,$Page_Width,$Page_Height);
    /* Standard PDF file creation header stuff */
    // Javier: better to not use references
    //	$pdf = & new Cpdf($PageSize);
    $pdf = new Cpdf('L', 'pt', 'A4');
    $pdf->addInfo('Author', 'webERP ' . $Version);
    $pdf->addInfo('Creator', 'webERP http://www.weberp.org');
    $pdf->addInfo('Title', _('Inventory Planning Based On Lead Time Of Preferred Supplier') . ' ' . Date($_SESSION['DefaultDateFormat']));
    //	$PageNumber = 0;
    $pdf->addInfo('Subject', _('Inventory Planning Based On Lead Time Of Preferred Supplier'));
    /* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
    	I corrected it to match TCPDF, but it still needs check, after which,
    	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
    $pdf->setAutoPageBreak(0);
    // Javier: needs check.
    $pdf->setPrintHeader(false);
    // Javier: I added this must be called before Add Page
    $pdf->AddPage();
    //	$this->SetLineWidth(1); 	   Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
    $pdf->cMargin = 0;
    $PrintPDF = $_POST['PrintPDF'];
}
if (!isset($_POST['ToTransNo']) or trim($_POST['ToTransNo']) == '' or filter_number_format($_POST['ToTransNo']) < $FromTransNo) {
    $_POST['ToTransNo'] = $FromTransNo;
}
$FirstTrans = $FromTransNo;
/* Need to start a new page only on subsequent transactions */
if (isset($PrintPDF) and $PrintPDF != '' and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') {
    include 'includes/class.pdf.php';
    $Page_Width = 595;
    $Page_Height = 842;
    $Top_Margin = 30;
    $Bottom_Margin = 30;
    $Left_Margin = 40;
    $Right_Margin = 30;
    $pdf = new Cpdf('P', 'pt', 'A4');
    $pdf->addInfo('Author', 'webERP ' . $Version);
    $pdf->addInfo('Creator', 'webERP http://www.weberp.org');
    if ($InvOrCredit == 'Invoice') {
        $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' to ' . $_POST['ToTransNo']);
        $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
    } else {
        $pdf->addInfo('Title', _('Sales Credit Note'));
        $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
    }
    $pdf->setAutoPageBreak(0);
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->AddPage();
    $pdf->cMargin = 0;
    $FirstPage = true;
//| Author: Michael Botsko                                               |
//+----------------------------------------------------------------------+
//
// $Id: notepaper.php,v 1.1 2007-01-08 19:12:54 botskonet Exp $
//+----------------------------------------------------------------------+
//| ABSOLUTELY DO NOT CHANGE THE FOLLOWING LINES                         |
//+----------------------------------------------------------------------+
if (file_exists("class.pdf.php")) {
    include "class.pdf.php";
} else {
    print "I can't work without the PDF class.";
}
//+----------------------------------------------------------------------+
//| BEGIN THE GENERATOR
//+----------------------------------------------------------------------+
$pdf = new Cpdf(array(0, 0, 598, 842));
$pdf->selectFont('fonts/' . $_GET['my_font']);
//+----------------------------------------------------------------------+
//| SET DEFAULT MARGINS
//+----------------------------------------------------------------------+
$page_length = 792;
// Length of page
$page_width = 612;
// Length of page
$bottom_margin = 30;
$left_margin = 20;
$right_margin = 20;
$line_height = strip_tags($_GET['line_height']);
// line height
//+----------------------------------------------------------------------+
//| CREATE PUNCH HOLES AND ADJUST LEFT MARGIN
示例#10
0
        $Page_Height = 612;
        // 72 * 8.5 inch
        $Top_Margin = 50;
        // Half inch = 72/2
        $Bottom_Margin = 40;
        // Half inch = 72/2
        $Left_Margin = 30;
        // Half inch = 72/2
        $Right_Margin = 25;
        // Half inch = 72/2
        break;
    default:
        $DocumentOrientation = 'L';
        break;
}
// Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-)
//	$PageSize = array(0,0,$Page_Width,$Page_Height);
//	$pdf = new Cpdf($PageSize);
$pdf = new Cpdf($DocumentOrientation, 'pt', $DocumentPaper);
$pdf->addInfo('Creator', 'KwaMoja http://www.kwamoja.com');
$pdf->addInfo('Author', 'KwaMoja ' . $_SESSION['VersionNumber']);
/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
I corrected it to match TCPDF, but it still needs check, after which,
I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
$pdf->SetPrintHeader(false);
// Javier: I added this must be called before Add Page
$pdf->setAutoPageBreak(0);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->cMargin = 0;
/* END Brought from class.pdf.php constructor */
 /**
  *   $type        : { 'none' | 'color' | 'colour' | 'image' }
  *   $options     : if type == 'color' or 'colour':
  *                    $options[0] = red-component   of backgroundcolour ( 0 <= r <= 1)
  *                    $options[1] = green-component of backgroundcolour ( 0 <= g <= 1)
  *                    $options[2] = blue-component  of backgroundcolour ( 0 <= b <= 1)
  *                   if type == 'image':
  *                    $options['img']     = location of image file; URI's are allowed if allow_url_open is enabled in php.ini
  *                    $options['width']   = width of background image; default is width of page
  *                    $options['height']  = height of background image; default is height of page
  *                    $options['xpos']    = horizontal position of background image; default is 0
  *                    $options['ypos']    = vertical position of background image; default is 0
  *           *new*    $options['repeat']  = repeat image horizontally (1), repeat image vertically (2) or full in both directions (3); default is 0
  *                                          highly recommend to set this->hashed to true when using repeat function
  *
  * Assuming that people don't want to specify the paper size using the absolute coordinates
  * allow a couple of options:
  * orientation can be 'portrait' or 'landscape'
  * or, to actually set the coordinates, then pass an array in as the first parameter.
  * the defaults are as shown.
  *
  * 2002-07-24 - Nicola Asuni (info@tecnick.com):
  * Added new page formats (45 standard ISO paper formats and 4 american common formats)
  * paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
  *
  * Now you may also pass a 2 values array containing the page width and height in centimeters
  *
  * @param $paper
  * @param $orientation
  * @param $type
  * @param $options
  * @return unknown_type
  */
 public function __construct($paper = 'a4', $orientation = 'portrait', $type = 'none', $options = array())
 {
     if (!is_array($paper)) {
         switch (strtoupper($paper)) {
             case '4A0':
                 $size = array(0, 0, 4767.87, 6740.79);
                 break;
             case '2A0':
                 $size = array(0, 0, 3370.39, 4767.87);
                 break;
             case 'A0':
                 $size = array(0, 0, 2383.94, 3370.39);
                 break;
             case 'A1':
                 $size = array(0, 0, 1683.78, 2383.94);
                 break;
             case 'A2':
                 $size = array(0, 0, 1190.55, 1683.78);
                 break;
             case 'A3':
                 $size = array(0, 0, 841.89, 1190.55);
                 break;
             case 'A4':
             default:
                 $size = array(0, 0, 595.28, 841.89);
                 break;
             case 'A5':
                 $size = array(0, 0, 419.53, 595.28);
                 break;
             case 'A6':
                 $size = array(0, 0, 297.64, 419.53);
                 break;
             case 'A7':
                 $size = array(0, 0, 209.76, 297.64);
                 break;
             case 'A8':
                 $size = array(0, 0, 147.4, 209.76);
                 break;
             case 'A9':
                 $size = array(0, 0, 104.88, 147.4);
                 break;
             case 'A10':
                 $size = array(0, 0, 73.7, 104.88);
                 break;
             case 'B0':
                 $size = array(0, 0, 2834.65, 4008.19);
                 break;
             case 'B1':
                 $size = array(0, 0, 2004.09, 2834.65);
                 break;
             case 'B2':
                 $size = array(0, 0, 1417.32, 2004.09);
                 break;
             case 'B3':
                 $size = array(0, 0, 1000.63, 1417.32);
                 break;
             case 'B4':
                 $size = array(0, 0, 708.66, 1000.63);
                 break;
             case 'B5':
                 $size = array(0, 0, 498.9, 708.66);
                 break;
             case 'B6':
                 $size = array(0, 0, 354.33, 498.9);
                 break;
             case 'B7':
                 $size = array(0, 0, 249.45, 354.33);
                 break;
             case 'B8':
                 $size = array(0, 0, 175.75, 249.45);
                 break;
             case 'B9':
                 $size = array(0, 0, 124.72, 175.75);
                 break;
             case 'B10':
                 $size = array(0, 0, 87.87, 124.72);
                 break;
             case 'C0':
                 $size = array(0, 0, 2599.37, 3676.54);
                 break;
             case 'C1':
                 $size = array(0, 0, 1836.85, 2599.37);
                 break;
             case 'C2':
                 $size = array(0, 0, 1298.27, 1836.85);
                 break;
             case 'C3':
                 $size = array(0, 0, 918.4299999999999, 1298.27);
                 break;
             case 'C4':
                 $size = array(0, 0, 649.13, 918.4299999999999);
                 break;
             case 'C5':
                 $size = array(0, 0, 459.21, 649.13);
                 break;
             case 'C6':
                 $size = array(0, 0, 323.15, 459.21);
                 break;
             case 'C7':
                 $size = array(0, 0, 229.61, 323.15);
                 break;
             case 'C8':
                 $size = array(0, 0, 161.57, 229.61);
                 break;
             case 'C9':
                 $size = array(0, 0, 113.39, 161.57);
                 break;
             case 'C10':
                 $size = array(0, 0, 79.37, 113.39);
                 break;
             case 'RA0':
                 $size = array(0, 0, 2437.8, 3458.27);
                 break;
             case 'RA1':
                 $size = array(0, 0, 1729.13, 2437.8);
                 break;
             case 'RA2':
                 $size = array(0, 0, 1218.9, 1729.13);
                 break;
             case 'RA3':
                 $size = array(0, 0, 864.5700000000001, 1218.9);
                 break;
             case 'RA4':
                 $size = array(0, 0, 609.45, 864.5700000000001);
                 break;
             case 'SRA0':
                 $size = array(0, 0, 2551.18, 3628.35);
                 break;
             case 'SRA1':
                 $size = array(0, 0, 1814.17, 2551.18);
                 break;
             case 'SRA2':
                 $size = array(0, 0, 1275.59, 1814.17);
                 break;
             case 'SRA3':
                 $size = array(0, 0, 907.09, 1275.59);
                 break;
             case 'SRA4':
                 $size = array(0, 0, 637.8, 907.09);
                 break;
             case 'LETTER':
                 $size = array(0, 0, 612.0, 792.0);
                 break;
             case 'LEGAL':
                 $size = array(0, 0, 612.0, 1008.0);
                 break;
             case 'EXECUTIVE':
                 $size = array(0, 0, 521.86, 756.0);
                 break;
             case 'FOLIO':
                 $size = array(0, 0, 612.0, 936.0);
                 break;
         }
         switch (strtolower($orientation)) {
             case 'landscape':
                 $a = $size[3];
                 $size[3] = $size[2];
                 $size[2] = $a;
                 break;
         }
     } else {
         if (count($paper) > 2) {
             // then an array was sent it to set the size
             $size = $paper;
         } else {
             //size in centimeters has been passed
             $size[0] = 0;
             $size[1] = 0;
             $size[2] = $paper[0] / 2.54 * 72;
             $size[3] = $paper[1] / 2.54 * 72;
         }
     }
     parent::__construct($size);
     $this->ez['pageWidth'] = $size[2];
     $this->ez['pageHeight'] = $size[3];
     // also set the margins to some reasonable defaults
     $this->ez['topMargin'] = 30;
     $this->ez['bottomMargin'] = 30;
     $this->ez['leftMargin'] = 30;
     $this->ez['rightMargin'] = 30;
     // set the current writing position to the top of the first page
     $this->y = $this->ez['pageHeight'] - $this->ez['topMargin'];
     // and get the ID of the page that was created during the instancing process.
     $this->ezPages[1] = $this->getFirstPageId();
     $this->ezPageCount = 1;
     switch ($type) {
         case 'color':
         case 'colour':
             $this->ezBackground['type'] = 'color';
             $this->ezBackground['color'] = $options;
             break;
         case 'image':
             if (!isset($options['img'])) {
                 $errormsg = "Background Image not set.";
                 break;
             }
             if (!file_exists($options['img'])) {
                 $errormsg = "Background Image does not exists: '" . $options['img'] . "'";
                 break;
             }
             $im = getimagesize($options['img']);
             if ($im === false) {
                 $errormsg = "Background Image is invalid: '" . $options['img'] . "'";
                 break;
             }
             $this->ezBackground['type'] = 'image';
             $this->ezBackground['image'] = $options['img'];
             $this->ezBackground['format'] = $im[2];
             $this->ezBackground['repeat'] = $options['repeat'];
             if (isset($options['width']) && is_numeric($options['width'])) {
                 $this->ezBackground['width'] = $options['width'];
             } else {
                 $this->ezBackground['width'] = $this->ez['pageWidth'];
             }
             if (isset($options['height']) && is_numeric($options['height'])) {
                 $this->ezBackground['height'] = $options['height'];
             } else {
                 $this->ezBackground['height'] = $this->ez['pageHeight'];
             }
             if (isset($options['xpos']) && is_numeric($options['xpos'])) {
                 $this->ezBackground['xpos'] = $options['xpos'];
             } else {
                 $this->ezBackground['xpos'] = 0;
             }
             if (isset($options['ypos']) && is_numeric($options['ypos'])) {
                 $this->ezBackground['ypos'] = $options['ypos'];
             } else {
                 $this->ezBackground['ypos'] = 0;
             }
             break;
         case 'none':
         default:
             $this->ezBackground['type'] = 'none';
             break;
     }
     $this->setBackground();
 }
示例#12
0
        $Right_Margin = 25;
        break;
    case 'legal_landscape':
        $DocumentPaper = 'LEGAL';
        $DocumentOrientation = 'L';
        $Page_Width = 1008;
        $Page_Height = 612;
        $Top_Margin = 50;
        $Bottom_Margin = 40;
        $Left_Margin = 30;
        $Right_Margin = 25;
        break;
}
// Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-)
//	$PageSize = array(0,0,$Page_Width,$Page_Height);
//	$pdf = new Cpdf($PageSize);
$pdf = new Cpdf($DocumentOrientation, 'pt', $DocumentPaper);
$pdf->addInfo('Creator', 'WebERP http://www.web-erp.org');
$pdf->addInfo('Author', 'WebERP ' . $_SESSION['VersionNumber']);
/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
	I corrected it to match TCPDF, but it still needs check, after which,
	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
$pdf->SetAutoPageBreak(true, 0);
// Javier: needs check.
$pdf->SetPrintHeader(false);
// Javier: I added this must be called before Add Page
$pdf->AddPage();
//	$this->SetLineWidth(1); 	   Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
$pdf->cMargin = 0;
// Javier: needs check.
/* END Brought from class.pdf.php constructor */
示例#13
0
 /**
  * class constructor
  * this will start a new document
  * @var array $pageSize Array of 4 numbers, defining the bottom left and upper right corner of the page. first two are normally zero.
  * @var boolean $isUnicode Whether text will be treated as Unicode or not.
  * @var string $fontcache The font cache folder
  * @var string $tmp The temporary folder
  */
 function __construct($pageSize = array(0, 0, 612, 792), $isUnicode = false, $fontcache = '', $tmp = '')
 {
     $this->isUnicode = $isUnicode;
     $this->fontcache = $fontcache;
     $this->tmp = $tmp;
     $this->newDocument($pageSize);
     $this->compressionReady = function_exists('gzcompress');
     if (in_array('Windows-1252', mb_list_encodings())) {
         self::$targetEncoding = 'Windows-1252';
     }
     // also initialize the font families that are known about already
     $this->setFontFamily('init');
     //  $this->fileIdentifier = md5('xxxxxxxx'.time());
 }
 function __construct($paper = 'a4', $orientation = 'portrait')
 {
     // Assuming that people don't want to specify the paper size using the absolute coordinates
     // allow a couple of options:
     // orientation can be 'portrait' or 'landscape'
     // or, to actually set the coordinates, then pass an array in as the first parameter.
     // the defaults are as shown.
     //
     // -------------------------
     // 2002-07-24 - Nicola Asuni (info@tecnick.com):
     // Added new page formats (45 standard ISO paper formats and 4 american common formats)
     // paper cordinates are calculated in this way: (inches * 72) where 1 inch = 2.54 cm
     //
     // Now you may also pass a 2 values array containing the page width and height in centimeters
     // -------------------------
     if (!is_array($paper)) {
         switch (strtoupper($paper)) {
             case '4A0':
                 $size = array(0, 0, 4767.87, 6740.79);
                 break;
             case '2A0':
                 $size = array(0, 0, 3370.39, 4767.87);
                 break;
             case 'A0':
                 $size = array(0, 0, 2383.94, 3370.39);
                 break;
             case 'A1':
                 $size = array(0, 0, 1683.78, 2383.94);
                 break;
             case 'A2':
                 $size = array(0, 0, 1190.55, 1683.78);
                 break;
             case 'A3':
                 $size = array(0, 0, 841.89, 1190.55);
                 break;
             case 'A4':
             default:
                 $size = array(0, 0, 595.28, 841.89);
                 break;
             case 'A5':
                 $size = array(0, 0, 419.53, 595.28);
                 break;
             case 'A6':
                 $size = array(0, 0, 297.64, 419.53);
                 break;
             case 'A7':
                 $size = array(0, 0, 209.76, 297.64);
                 break;
             case 'A8':
                 $size = array(0, 0, 147.4, 209.76);
                 break;
             case 'A9':
                 $size = array(0, 0, 104.88, 147.4);
                 break;
             case 'A10':
                 $size = array(0, 0, 73.7, 104.88);
                 break;
             case 'B0':
                 $size = array(0, 0, 2834.65, 4008.19);
                 break;
             case 'B1':
                 $size = array(0, 0, 2004.09, 2834.65);
                 break;
             case 'B2':
                 $size = array(0, 0, 1417.32, 2004.09);
                 break;
             case 'B3':
                 $size = array(0, 0, 1000.63, 1417.32);
                 break;
             case 'B4':
                 $size = array(0, 0, 708.66, 1000.63);
                 break;
             case 'B5':
                 $size = array(0, 0, 498.9, 708.66);
                 break;
             case 'B6':
                 $size = array(0, 0, 354.33, 498.9);
                 break;
             case 'B7':
                 $size = array(0, 0, 249.45, 354.33);
                 break;
             case 'B8':
                 $size = array(0, 0, 175.75, 249.45);
                 break;
             case 'B9':
                 $size = array(0, 0, 124.72, 175.75);
                 break;
             case 'B10':
                 $size = array(0, 0, 87.87, 124.72);
                 break;
             case 'C0':
                 $size = array(0, 0, 2599.37, 3676.54);
                 break;
             case 'C1':
                 $size = array(0, 0, 1836.85, 2599.37);
                 break;
             case 'C2':
                 $size = array(0, 0, 1298.27, 1836.85);
                 break;
             case 'C3':
                 $size = array(0, 0, 918.4299999999999, 1298.27);
                 break;
             case 'C4':
                 $size = array(0, 0, 649.13, 918.4299999999999);
                 break;
             case 'C5':
                 $size = array(0, 0, 459.21, 649.13);
                 break;
             case 'C6':
                 $size = array(0, 0, 323.15, 459.21);
                 break;
             case 'C7':
                 $size = array(0, 0, 229.61, 323.15);
                 break;
             case 'C8':
                 $size = array(0, 0, 161.57, 229.61);
                 break;
             case 'C9':
                 $size = array(0, 0, 113.39, 161.57);
                 break;
             case 'C10':
                 $size = array(0, 0, 79.37, 113.39);
                 break;
             case 'RA0':
                 $size = array(0, 0, 2437.8, 3458.27);
                 break;
             case 'RA1':
                 $size = array(0, 0, 1729.13, 2437.8);
                 break;
             case 'RA2':
                 $size = array(0, 0, 1218.9, 1729.13);
                 break;
             case 'RA3':
                 $size = array(0, 0, 864.5700000000001, 1218.9);
                 break;
             case 'RA4':
                 $size = array(0, 0, 609.45, 864.5700000000001);
                 break;
             case 'SRA0':
                 $size = array(0, 0, 2551.18, 3628.35);
                 break;
             case 'SRA1':
                 $size = array(0, 0, 1814.17, 2551.18);
                 break;
             case 'SRA2':
                 $size = array(0, 0, 1275.59, 1814.17);
                 break;
             case 'SRA3':
                 $size = array(0, 0, 907.09, 1275.59);
                 break;
             case 'SRA4':
                 $size = array(0, 0, 637.8, 907.09);
                 break;
             case 'LETTER':
                 $size = array(0, 0, 612.0, 792.0);
                 break;
             case 'LEGAL':
                 $size = array(0, 0, 612.0, 1008.0);
                 break;
             case 'EXECUTIVE':
                 $size = array(0, 0, 521.86, 756.0);
                 break;
             case 'FOLIO':
                 $size = array(0, 0, 612.0, 936.0);
                 break;
         }
         switch (strtolower($orientation)) {
             case 'landscape':
                 $a = $size[3];
                 $size[3] = $size[2];
                 $size[2] = $a;
                 break;
         }
     } else {
         if (count($paper) > 2) {
             // then an array was sent it to set the size
             $size = $paper;
         } else {
             //size in centimeters has been passed
             $size[0] = 0;
             $size[1] = 0;
             $size[2] = $paper[0] / 2.54 * 72;
             $size[3] = $paper[1] / 2.54 * 72;
         }
     }
     parent::__construct($size);
     $this->ez['pageWidth'] = $size[2];
     $this->ez['pageHeight'] = $size[3];
     // also set the margins to some reasonable defaults
     $config = eZINI::instance('pdf.ini');
     $this->ez['topMargin'] = $config->variable('PDFGeneral', 'TopMargin');
     $this->ez['bottomMargin'] = $config->variable('PDFGeneral', 'BottomMargin');
     $this->ez['leftMargin'] = $config->variable('PDFGeneral', 'LeftMargin');
     $this->ez['rightMargin'] = $config->variable('PDFGeneral', 'RightMargin');
     // set the current writing position to the top of the first page
     $this->y = $this->ez['pageHeight'] - $this->ez['topMargin'];
     $this->ez['xOffset'] = 0;
     // set current text justification
     $this->ez['justification'] = 'left';
     $this->ez['lineSpace'] = 1;
     // and get the ID of the page that was created during the instancing process.
     $this->ezPages[1] = $this->getFirstPageId();
     $this->ezPageCount = 1;
 }
示例#15
0
        break;
    case 'A6_Landscape':
        $DocumentPaper = 'A6';
        $DocumentOrientation = 'L';
        $Page_Width = 417;
        $Page_Height = 295;
        $Top_Margin = 10;
        $Bottom_Margin = 10;
        $Left_Margin = 10;
        $Right_Margin = 10;
        break;
    default:
        $DocumentOrientation = 'L';
        break;
}
// Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-)
//	$PageSize = array(0,0,$Page_Width,$Page_Height);
//	$pdf = new Cpdf($PageSize);
$pdf = new Cpdf($DocumentOrientation, 'pt', $DocumentPaper);
$pdf->addInfo('Creator', 'webERP http://www.weberp.org');
$pdf->addInfo('Author', 'WebERP ' . $Version);
/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
	I corrected it to match TCPDF, but it still needs check, after which,
	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
$pdf->SetPrintHeader(false);
// Javier: I added this must be called before Add Page
$pdf->setAutoPageBreak(0);
$pdf->setPrintFooter(false);
$pdf->AddPage();
$pdf->cMargin = 0;
/* END Brought from class.pdf.php constructor */
示例#16
0
        $DocumentPaper = 'LEGAL';
        $DocumentOrientation = 'L';
        $Page_Width = 1008;
        $Page_Height = 612;
        $Top_Margin = 50;
        $Bottom_Margin = 40;
        $Left_Margin = 30;
        $Right_Margin = 25;
        break;
    default:
        $DocumentOrientation = 'L';
        break;
}
// Javier: I correct the call to the constructor to match TCPDF (and FPDF ;-)
//	$PageSize = array(0,0,$Page_Width,$Page_Height);
//	$pdf = new Cpdf($PageSize);
$pdf = new Cpdf($DocumentOrientation, 'pt', $DocumentPaper);
$pdf->addInfo('Creator', 'KwaMoja http://www.kwamoja.org');
$pdf->addInfo('Author', 'KwaMoja ' . $Version);
/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
	I corrected it to match TCPDF, but it still needs check, after which,
	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
$pdf->SetAutoPageBreak(true, 0);
// Javier: needs check.
$pdf->SetPrintHeader(false);
// Javier: I added this must be called before Add Page
$pdf->AddPage();
//	$this->SetLineWidth(1); 	   Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
$pdf->cMargin = 0;
// Javier: needs check.
/* END Brought from class.pdf.php constructor */
示例#17
0
        $Left_Margin = 30;
        $Right_Margin = 25;
        break;
    case 'legal':
        $Page_Width = 612;
        $Page_Height = 1008;
        $Top_Margin = 50;
        $Bottom_Margin = 40;
        $Left_Margin = 30;
        $Right_Margin = 25;
        break;
    case 'legal_landscape':
        $Page_Width = 1008;
        $Page_Height = 612;
        $Top_Margin = 50;
        $Bottom_Margin = 40;
        $Left_Margin = 30;
        $Right_Margin = 25;
        break;
}
$PageSize = array(0, 0, $Page_Width, $Page_Height);
$pdf = new Cpdf($PageSize);
$pdf->addinfo('Author', 'webERP ' . $Version);
$pdf->addinfo('Creator', 'webERP http://www.weberp.org');
/*depending on the language this font is modified see includes/class.pdf.php
	selectFont method interprets the text helvetica to be:
	for Chinese - BIg5
	for Japanese - SJIS
	for Korean - UHC
*/
$pdf->selectFont('helvetica');
示例#18
0
<?php

session_start();
//echo "HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH";
include_once 'include/config.inc.php';
include_once 'include/util.inc.php';
//echo "KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKDDDDDDD";
include_once 'pdfClass/class.pdf.php';
$util = new Util();
//echo "JJJJJJJJJJJJJJJJJJJJ";
//$util->securAdmin($_SESSION);
//echo "KKKKKKKKKKKKKK";
//exit;
//$pdf = new Cpdf(array(0,0,684,297));
$pdf = new Cpdf(array(0, 0, 684, 297));
$pdf->selectFont('pdfClass/fonts/Helvetica');
for ($i = 1; $i <= $_POST[total]; $i++) {
    $login = $util->createPassword();
    //$pass=$util->createPassword();
    $sql = "insert into tbcard values('cardId','{$login}',NOW(),'{$balance}','1','none','')";
    mysql_query($sql);
    //$util->insertAccount($login,$pass,$_POST[balance]);
    //echo "HHHH";
    if ($i != 1) {
        $pdf->newPage();
    }
    $pdf->addText(60, 235, 14, '<b>PREPAID CARD</b>');
    $pdf->addText(60, 200, 12, '<b>Balance</b>: ' . number_format($_POST[balance], 2));
    $pdf->addText(60, 160, 12, '<b>Code</b>: ' . $login);
    //$pdf->addText(40,190,12,'<b>Password</b>: '.$pass);
}
 /*Set specifically for the stationery being used -needs to be modified for clients own
 	packing slip 2 part stationery is recommended so storeman can note differences on and
 	a copy retained */
 //Javier
 //	$Page_Width=807;
 $Page_Width = 792;
 $Page_Height = 612;
 $Top_Margin = 34;
 $Bottom_Margin = 20;
 $Left_Margin = 15;
 $Right_Margin = 10;
 // Javier: now I use the native constructor
 // Javier: better to not use references
 //	$PageSize = array(0,0,$Page_Width,$Page_Height);
 //	$pdf = & new Cpdf($PageSize);
 $pdf = new Cpdf('L', 'pt', 'LETTER');
 $pdf->addInfo('Creator', 'webERP http://www.web-erp.org');
 $pdf->addInfo('Author', 'webERP ' . $Version);
 $pdf->addInfo('Title', _('Customer Packing Slip'));
 $pdf->addInfo('Subject', _('Packing slip for order') . ' ' . $_GET['TransNo']);
 /* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
 	I corrected it to match TCPDF, but it still needs check, after which,
 	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
 $pdf->setAutoPageBreak(0);
 // Javier: needs check.
 $pdf->setPrintHeader(false);
 // Javier: I added this must be called before Add Page
 $pdf->AddPage();
 //	$this->SetLineWidth(1); 	   Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
 $pdf->cMargin = 0;
 // Javier: needs check.
$text .= "Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren.\n\n";
$text .= "Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.\n\n";
$text .= "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen Sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht ? ein geradezu unorthographisches Leben.\n\n";
$text .= "Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.\n\n";
$text .= "Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rethorische Frage über die Wange, dann setzte es seinen Weg fort.\n\n";
$text .= "Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren.\n\n";
$text .= "Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.\n\n";
$text .= "Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen Sie in Buchstabhausen an der Küste des Semantik, eines großen Sprachozeans. Ein kleines Bächlein namens Duden fließt durch ihren Ort und versorgt sie mit den nötigen Regelialien. Es ist ein paradiesmatisches Land, in dem einem gebratene Satzteile in den Mund fliegen. Nicht einmal von der allmächtigen Interpunktion werden die Blindtexte beherrscht ? ein geradezu unorthographisches Leben.\n\n";
$text .= "Eines Tages aber beschloß eine kleine Zeile Blindtext, ihr Name war Lorem Ipsum, hinaus zu gehen in die weite Grammatik. Der große Oxmox riet ihr davon ab, da es dort wimmele von bösen Kommata, wilden Fragezeichen und hinterhältigen Semikoli, doch das Blindtextchen ließ sich nicht beirren. Es packte seine sieben Versalien, schob sich sein Initial in den Gürtel und machte sich auf den Weg.\n\n";
$text .= "Als es die ersten Hügel des Kursivgebirges erklommen hatte, warf es einen letzten Blick zurück auf die Skyline seiner Heimatstadt Buchstabhausen, die Headline von Alphabetdorf und die Subline seiner eigenen Straße, der Zeilengasse. Wehmütig lief ihm eine rethorische Frage über die Wange, dann setzte es seinen Weg fort.\n\n";
$text .= "Unterwegs traf es eine Copy. Die Copy warnte das Blindtextchen, da, wo sie herkäme wäre sie zigmal umgeschrieben worden und alles, was von ihrem Ursprung noch übrig wäre, sei das Wort \"und\" und das Blindtextchen solle umkehren und wieder in sein eigenes, sicheres Land zurückkehren.\n\n";
$text .= "Doch alles Gutzureden konnte es nicht überzeugen und so dauerte es nicht lange, bis ihm ein paar heimtückische Werbetexter auflauerten, es mit Longe und Parole betrunken machten und es dann in ihre Agentur schleppten, wo sie es für ihre Projekte wieder und wieder mißbrauchten. Und wenn es nicht umgeschrieben wurde, dann benutzen Sie es immernoch.\n\n";
$pdf = 0;
if ($pdf == 1) {
    include_once $pathvars["libraries"] . "xtra.pdf.php";
    $pdf = new Cpdf(array(0, 0, 595.28, 841.89));
    $pdf->selectFont('./fonts/Helvetica.afm');
    $pdf->openHere("Fit");
    #$pdf->setPreferences( "HideToolbar", true);
    #$pdf->setPreferences( "HideMenubar", true);
    #$pdf->setPreferences( "HideWindowUI", true);
    #$pdf->setPreferences( "FitWindow", true);
    #$pdf->setPreferences( "CenterWindow",true);
    #$pdf->setPreferences( "NonFullScreenPageMode",True); // UseNone, UseOutlines, UseThumbs
    $unten = 50;
    $links = 20;
    $oben = 820;
    $pdf->addText($links, $oben, 11, 'links oben');
    $pdf->addText($links, $unten, 11, 'links unten');
    $pdf->addText(500, $oben, 11, 'rechts oben');
    $pdf->addText(500, $unten, 11, 'rechts unten');
示例#21
0
include 'includes/SQL_CommonFunctions.inc';
if (isset($_POST['PrintPDF'])) {
    include 'includes/class.pdf.php';
    /* A4_Landscape */
    $Page_Width = 842;
    $Page_Height = 595;
    $Top_Margin = 20;
    $Bottom_Margin = 20;
    $Left_Margin = 25;
    $Right_Margin = 22;
    // Javier: now I use the native constructor
    //	$PageSize = array(0,0,$Page_Width,$Page_Height);
    /* Standard PDF file creation header stuff */
    // Javier: better to not use references
    //	$pdf = & new Cpdf($PageSize);
    $pdf = new Cpdf('L', 'pt', 'A4');
    $pdf->addInfo('Creator', 'webERP http://www.weberp.org');
    $pdf->addInfo('Author', 'webERP ' . $Version);
    $pdf->addInfo('Title', _('Inventory Planning Report') . ' ' . Date($_SESSION['DefaultDateFormat']));
    $pdf->addInfo('Subject', _('Inventory Planning'));
    /* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
    	I corrected it to match TCPDF, but it still needs some check, after which,
    	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
    $pdf->setAutoPageBreak(0);
    // Javier: needs check.
    $pdf->setPrintHeader(false);
    // Javier: I added this must be called before Add Page
    $pdf->AddPage();
    //	$this->SetLineWidth(1); 	   Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
    $pdf->cMargin = 0;
    // Javier: needs check.
}
if (!isset($_POST['ToTransNo']) or trim($_POST['ToTransNo']) == '' or filter_number_format($_POST['ToTransNo']) < $FromTransNo) {
    $_POST['ToTransNo'] = $FromTransNo;
}
$FirstTrans = $FromTransNo;
/* Need to start a new page only on subsequent transactions */
if (isset($PrintPDF) and isset($FromTransNo) and isset($InvOrCredit)) {
    include 'includes/class.pdf.php';
    /* This invoice is hard coded for A4 Landscape invoices or credit notes so can't use PDFStarter.inc */
    $Page_Width = 842;
    $Page_Height = 595;
    $Top_Margin = 30;
    $Bottom_Margin = 30;
    $Left_Margin = 40;
    $Right_Margin = 30;
    $pdf = new Cpdf('L', 'pt', 'A4');
    $pdf->addInfo('Creator', 'webERP http://www.weberp.org');
    $pdf->addInfo('Author', 'webERP ' . $Version);
    if ($InvOrCredit == 'Invoice') {
        $pdf->addInfo('Title', _('Sales Invoice') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
        $pdf->addInfo('Subject', _('Invoices from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
    } else {
        $pdf->addInfo('Title', _('Sales Credit Note'));
        $pdf->addInfo('Subject', _('Credit Notes from') . ' ' . $FromTransNo . ' ' . _('to') . ' ' . $_POST['ToTransNo']);
    }
    $pdf->setAutoPageBreak(0);
    $pdf->setPrintHeader(false);
    $pdf->setPrintFooter(false);
    $pdf->AddPage();
    $pdf->cMargin = 0;
    /* END Brought from class.pdf.php constructor */
$_POST['Location'] = $Location;
/* so PDFInventoryValnPageHeader.inc works too */
include 'includes/session.inc';
include 'includes/class.pdf.php';
/* A4_Portrait */
$Page_Width = 595;
$Page_Height = 842;
$Top_Margin = 30;
$Bottom_Margin = 30;
$Left_Margin = 40;
$Right_Margin = 30;
// Javier: now I use the native constructor
// Javier: better to not use references
// $PageSize = array(0,0,$Page_Width,$Page_Height);
// $pdf = & new Cpdf($PageSize);
$pdf = new Cpdf('P', 'pt', 'A4');
// $PageNumber = 0;
/* Standard PDF file creation header stuff */
$pdf->addInfo('Creator', 'WebERP http://www.web-erp.org');
$pdf->addInfo('Author', 'WebERP ' . $Version);
// $FontSize=10;
$pdf->addInfo('Title', _('Inventory Valuation Report'));
$pdf->addInfo('Subject', _('Inventory Valuation'));
/* Javier: I have brought this piece from the pdf class constructor to get it closer to the admin/user,
	I corrected it to match TCPDF, but it still needs check, after which,
	I think it should be moved to each report to provide flexible Document Header and Margins in a per-report basis. */
$pdf->setAutoPageBreak(0);
// Javier: needs check.
$pdf->setPrintHeader(false);
// Javier: I added this must be called before Add Page
$pdf->AddPage();
 /**
  * Returns the PDF as a string
  *
  * @return string
  */
 function output()
 {
     //return $this->_pdf->ezOutput(1);
     return $this->_pdf->output(1);
 }