/** * Class constructor * * @param string $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (array_key_exists(strtolower($paper), self::$PAPER_SIZES)) { $size = self::$PAPER_SIZES[$paper]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (strtolower($orientation) == "landscape") { $a = $size[3]; $size[3] = $size[2]; $size[2] = $a; } $this->_pdf = new Cpdf($size); $this->_pdf->addInfo("Creator", "DOMPDF Converter"); $this->_pdf->addInfo("CreationDate", date("Y-m-d")); $this->_width = $size[2]; $this->_height = $size[3]; $this->_pdf->openHere('Fit'); $this->_page_number = $this->_page_count = 1; $this->_page_text = null; }
/** * Class constructor * * @param mixed $paper The size of paper to use in this PDF ({@link CPDF_Adapter::$PAPER_SIZES}) * @param string $orientation The orienation of the document (either 'landscape' or 'portrait') */ function __construct($paper = "letter", $orientation = "portrait") { if (is_array($paper)) { $size = $paper; } else { if (isset(self::$PAPER_SIZES[mb_strtolower($paper)])) { $size = self::$PAPER_SIZES[$paper]; } else { $size = self::$PAPER_SIZES["letter"]; } } if (mb_strtolower($orientation) == "landscape") { $a = $size[3]; $size[3] = $size[2]; $size[2] = $a; } $this->_pdf = new Cpdf($size); $this->_pdf->addInfo("Creator", "DOMPDF Converter"); // Silence pedantic warnings about missing TZ settings if (function_exists("date_default_timezone_get")) { $tz = @date_default_timezone_get(); date_default_timezone_set("UTC"); $this->_pdf->addInfo("CreationDate", date("Y-m-d")); date_default_timezone_set($tz); } else { $this->_pdf->addInfo("CreationDate", date("Y-m-d")); } $this->_width = $size[2] - $size[0]; $this->_height = $size[3] - $size[1]; $this->_pdf->openHere('Fit'); $this->_page_number = $this->_page_count = 1; $this->_page_text = array(); $this->_pages = array($this->_pdf->getFirstPageId()); $this->_image_cache = array(); }
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. /* END Brought from class.pdf.php constructor */
$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 */
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; // Javier: needs check.
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', 'KwaMoja http://www.kwamoja.org'); $pdf->addInfo('Author', 'KwaMoja ' . $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(); // $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 $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; $line_height = 16;
if (isset($_POST['PrintPDF']) and isset($_POST['FromCriteria']) and mb_strlen($_POST['FromCriteria']) >= 1 and isset($_POST['ToCriteria']) and mb_strlen($_POST['ToCriteria']) >= 1) { 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', 'KwaMoja http://www.kwamoja.org'); $pdf->addInfo('Author', 'KwaMoja ' . $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. /* END Brought from class.pdf.php constructor */
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) or isset($_GET['PrintPDF']) and $PrintPDF and isset($FromTransNo) and isset($InvOrCredit) and $FromTransNo != '') { 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', 'KwaMoja http://www.kwamoja.com'); $pdf->addInfo('Author', 'KwaMoja ' . $_SESSION['VersionNumber']); 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 */ $FirstPage = true;
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. /* END Brought from class.pdf.php constructor */
$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 */
$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 */
} /* 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', 'KwaMoja http://www.kwamoja.com'); $pdf->addInfo('Author', 'KwaMoja ' . $_SESSION['VersionNumber']); // $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(); // $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.
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(); // $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.
$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.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->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 */
/** * Add meta information to the PDF * * @param string $label label of the value (Creator, Producer, etc.) * @param string $value the text to set */ function add_info($label, $value) { $this->_pdf->addInfo($label, $value); }
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', 'KwaMoja ' . $_SESSION['VersionNumber']); $pdf->addInfo('Creator', 'KwaMoja http://www.kwamoja.com'); $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; // Javier: needs check.