本文整理匯總了PHP中pdf_getPDFFont函數的典型用法代碼示例。如果您正苦於以下問題:PHP pdf_getPDFFont函數的具體用法?PHP pdf_getPDFFont怎麽用?PHP pdf_getPDFFont使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了pdf_getPDFFont函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: write_file
//.........這裏部分代碼省略.........
}
}
if (count($realpatharray) == 0) {
$this->posxpicture = $this->posxqtyordered;
}
if ($conf->expedition->dir_output) {
// Definition de $dir et $file
if ($object->specimen) {
$dir = $conf->expedition->dir_output . "/sending";
$file = $dir . "/SPECIMEN.pdf";
} else {
$expref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output . "/sending/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
// Add pdfgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$heightforinfotot = 0;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
if (method_exists($pdf, 'AliasNbPages')) {
$pdf->AliasNbPages();
}
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Shipment"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Shipment"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
示例2: write_file
/**
* \brief Fonction generant le document sur le disque
* \param object Objet expedition a generer (ou id si ancienne methode)
* \param outputlangs Lang output object
* \return int 1=ok, 0=ko
*/
function write_file(&$object, $outputlangs)
{
global $user,$conf,$langs;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");
if ($conf->expedition->dir_output)
{
// Definition de $dir et $file
if ($object->specimen)
{
$dir = $conf->expedition->dir_output."/sending";
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$expref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output."/sending/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
}
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->AliasNbPages();
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($fac->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 3, ''); // Set interline to 3
$pdf->SetTextColor(0,0,0);
$tab_top = 90;
$tab_height = 170;
if (! empty($object->note_public) || ! empty($object->tracking_number))
{
$tab_top = 88;
// Tracking number
if (! empty($object->tracking_number))
{
$object->GetUrlTrackingStatus($object->tracking_number);
if (! empty($object->tracking_url))
{
if ($object->expedition_method_id > 0)
{
//.........這裏部分代碼省略.........
示例3: write_file
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$nblignes = count($object->lines);
// Loop on each lines to detect if there is at least one image to show
$realpatharray = array();
if (!empty($conf->global->MAIN_GENERATE_INVOICES_WITH_PICTURE)) {
for ($i = 0; $i < $nblignes; $i++) {
if (empty($object->lines[$i]->fk_product)) {
continue;
}
$objphoto = new Product($this->db);
$objphoto->fetch($object->lines[$i]->fk_product);
$pdir = get_exdir($object->lines[$i]->fk_product, 2, 0, 0, $objphoto, 'product') . $object->lines[$i]->fk_product . "/photos/";
$dir = $conf->product->dir_output . '/' . $pdir;
$realpath = '';
foreach ($objphoto->liste_photos($dir, 1) as $key => $obj) {
$filename = $obj['photo'];
//if ($obj['photo_vignette']) $filename='thumbs/'.$obj['photo_vignette'];
$realpath = $dir . $filename;
break;
}
if ($realpath) {
$realpatharray[$i] = $realpath;
}
}
}
if (count($realpatharray) == 0) {
$this->posxpicture = $this->posxtva;
}
if ($conf->facture->dir_output) {
$object->fetch_thirdparty();
$deja_regle = $object->getSommePaiement();
$amount_credit_notes_included = $object->getSumCreditNotesUsed();
$amount_deposits_included = $object->getSumDepositsUsed();
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->facture->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->facture->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
// Add pdfgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
// Set nblignes with the new facture lines content after hook
$nblignes = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
//.........這裏部分代碼省略.........
示例4: write_file
/**
* Function to build pdf onto disk
*
* @param Object $object Object to generate
* @param Translate $outputlangs Lang output object
* @param string $srctemplatepath Full path of source filename for generator using a template file
* @param int $hidedetails Do not show line details
* @param int $hidedesc Do not show desc
* @param int $hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object, $outputlangs, $srctemplatepath = '', $hidedetails = 0, $hidedesc = 0, $hideref = 0)
{
global $user, $langs, $conf, $mysoc, $db, $hookmanager;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("interventions");
if ($conf->ficheinter->dir_output) {
$object->fetch_thirdparty();
// Definition of $dir and $file
if ($object->specimen) {
$dir = $conf->ficheinter->dir_output;
$file = $dir . "/SPECIMEN.pdf";
} else {
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->ficheinter->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
// Add pdfgeneration hook
if (!is_object($hookmanager)) {
include_once DOL_DOCUMENT_ROOT . '/core/class/hookmanager.class.php';
$hookmanager = new HookManager($this->db);
}
$hookmanager->initHooks(array('pdfgeneration'));
$parameters = array('file' => $file, 'object' => $object, 'outputlangs' => $outputlangs);
global $action;
$reshook = $hookmanager->executeHooks('beforePDFCreation', $parameters, $object, $action);
// Note that $action and $object may have been modified by some hooks
$nblignes = count($object->lines);
// Create pdf instance
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$pdf->SetAutoPageBreak(1, 0);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("InterventionCard"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("InterventionCard"));
if (!empty($conf->global->MAIN_DISABLE_PDF_COMPRESSION)) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->SetTextColor(0, 0, 0);
$tab_top = 90;
$tab_top_newpage = empty($conf->global->MAIN_PDF_DONOTREPEAT_HEAD) ? 42 : 10;
$tab_height = 130;
//.........這裏部分代碼省略.........
示例5: GETPOST
$newlang = GETPOST('lang_id');
}
if ($conf->global->MAIN_MULTILANGS && empty($newlang)) {
$newlang = $object->client->default_lang;
}
if (!empty($newlang)) {
$outputlangs = new Translate("", $conf);
$outputlangs->setDefaultLang($newlang);
}
// Create empty PDF
$pdf = pdf_getInstance();
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
$pdf->SetCompression(false);
}
// Add all others
foreach ($files as $file) {
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++) {
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Create output dir if not exists
示例6: pdf_pagefoot
//.........這裏部分代碼省略.........
}
// 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) {
//$line="eee<br>\nfd<strong>sf</strong>sdf<br>\nghfghg<br>";
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
$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);
} else {
$freetextheight = pdfGetHeightForHtmlContent($pdf, dol_htmlentitiesbr($line, 1, 'UTF-8', 0));
// New method (works for HTML content)
//print '<br>'.$freetextheight;exit;
}
}
$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);
if (empty($conf->global->PDF_ALLOW_HTML_FOR_FREE_TEXT)) {
$pdf->MultiCell(0, 3, $line, 0, $align, 0);
} else {
$pdf->writeHTMLCell($pdf->page_largeur - $pdf->margin_left - $pdf->margin_right, $freetextheight, $dims['lm'], $dims['hk'] - $marginwithfooter, dol_htmlentitiesbr($line, 1, 'UTF-8', 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;
}
示例7: _pagefoot
/**
* 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
* @return void
*/
function _pagefoot(&$pdf, $object, $outputlangs)
{
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);
}
}
示例8: write_file
/**
* Fonction generant la rapport sur le disque
*
* @param string $_dir repertoire
* @param int $month mois du rapport
* @param int $year annee du rapport
* @param string $outputlangs Lang output object
* @return int <0 if KO, >0 if OK
*/
function write_file($_dir, $month, $year, $outputlangs)
{
include_once DOL_DOCUMENT_ROOT . '/core/lib/date.lib.php';
global $user, $langs, $conf;
$socid = 0;
if ($user->societe_id) {
$socid = $user->societe_id;
}
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$this->month = $month;
$this->year = $year;
$dir = $_dir . '/' . $year;
if (!is_dir($dir)) {
$result = dol_mkdir($dir);
if ($result < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return -1;
}
}
$month = sprintf("%02d", $month);
$year = sprintf("%04d", $year);
$file = $dir . "/payments-" . $year . "-" . $month . ".pdf";
$pdf = pdf_getInstance($this->format);
$default_font_size = pdf_getPDFFontSize($outputlangs);
// Must be after pdf_getInstance
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$num = 0;
$lines = array();
$sql = "SELECT p.datep as dp, f.facnumber";
//$sql .= ", c.libelle as paiement_type, p.num_paiement";
$sql .= ", c.code as paiement_code, p.num_paiement";
$sql .= ", p.amount as paiement_amount, f.total_ttc as facture_amount ";
$sql .= ", pf.amount as pf_amount ";
$sql .= ", p.rowid as prowid";
$sql .= " FROM " . MAIN_DB_PREFIX . "paiement as p, " . MAIN_DB_PREFIX . "facture as f,";
$sql .= " " . MAIN_DB_PREFIX . "c_paiement as c, " . MAIN_DB_PREFIX . "paiement_facture as pf,";
$sql .= " " . MAIN_DB_PREFIX . "societe as s";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= ", " . MAIN_DB_PREFIX . "societe_commerciaux as sc";
}
$sql .= " WHERE f.fk_soc = s.rowid AND pf.fk_facture = f.rowid AND pf.fk_paiement = p.rowid";
$sql .= " AND f.entity = " . $conf->entity;
$sql .= " AND p.fk_paiement = c.id ";
$sql .= " AND p.datep BETWEEN '" . $this->db->idate(dol_get_first_day($year, $month)) . "' AND '" . $this->db->idate(dol_get_last_day($year, $month)) . "'";
if (!$user->rights->societe->client->voir && !$socid) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = " . $user->id;
}
if (!empty($socid)) {
$sql .= " AND s.rowid = " . $socid;
}
$sql .= " ORDER BY p.datep ASC, pf.fk_paiement ASC";
dol_syslog(get_class($this) . "::write_file sql=" . $sql);
$result = $this->db->query($sql);
if ($result) {
$num = $this->db->num_rows($result);
$i = 0;
$var = True;
while ($i < $num) {
$objp = $this->db->fetch_object($result);
$var = !$var;
$lines[$i][0] = $objp->facnumber;
$lines[$i][1] = dol_print_date($this->db->jdate($objp->dp), "day", false, $outputlangs, true);
$lines[$i][2] = $langs->transnoentities("PaymentTypeShort" . $objp->paiement_code);
$lines[$i][3] = $objp->num_paiement;
$lines[$i][4] = price($objp->paiement_amount);
$lines[$i][5] = price($objp->facture_amount);
$lines[$i][6] = price($objp->pf_amount);
$lines[$i][7] = $objp->prowid;
$i++;
}
} else {
dol_print_error($this->db);
}
$pages = intval($num / $this->line_per_page);
if ($lines % $this->line_per_page > 0) {
$pages++;
}
if ($pages == 0) {
// force to build at least one page if report has no line
$pages = 1;
}
//.........這裏部分代碼省略.........
示例9: write_file
/**
* Function to build pdf onto disk
* @param object Id of object to generate
* @param outputlangs Lang output object
* @param srctemplatepath Full path of source filename for generator using a template file
* @param hidedetails Do not show line details
* @param hidedesc Do not show desc
* @param hideref Do not show ref
* @return int 1=OK, 0=KO
*/
function write_file($object,$outputlangs,$srctemplatepath='',$hidedetails=0,$hidedesc=0,$hideref=0)
{
global $user,$langs,$conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
$sav_charset_output=$outputlangs->charset_output;
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("propal");
$outputlangs->load("products");
if ($conf->propale->dir_output)
{
$object->fetch_thirdparty();
$deja_regle = "";
// Definition de $dir et $file
if ($object->specimen)
{
$dir = $conf->propale->dir_output;
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->propale->dir_output . "/" . $objectref;
$file = $dir . "/" . $objectref . ".pdf";
}
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$langs->trans("ErrorCanNotCreateDir",$dir);
return 0;
}
}
if (file_exists($dir))
{
$nblignes = sizeof($object->lines);
// Create pdf instance
$pdf=pdf_getInstance($this->format);
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("CommercialProposal"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("CommercialProposal"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite); // Left, Top, Right
$pdf->SetAutoPageBreak(1,0);
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
{
if ($object->lines[$i]->remise_percent)
{
$this->atleastonediscount++;
}
}
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('','', $default_font_size - 1);
$pdf->MultiCell(0, 4, ''); // Set interline to 4
$pdf->SetTextColor(0,0,0);
//.........這裏部分代碼省略.........
示例10: _showLCR
function _showLCR($pdf, $object, $outputlangs, &$TtoGenerate)
{
global $db, $conf;
//Gestion LCR /////////////////////////////////////////////////////////////////////
$pdf->AddPage();
$posy = 50;
$pdf->SetDrawColor(0, 0, 0);
$default_font_size = pdf_getPDFFontSize($outputlangs);
$nb_facture = count($TtoGenerate);
foreach ($TtoGenerate as $ii => $ref_piece) {
$f = new Facture($db);
$f->fetch('', $ref_piece);
$f->fetch_thirdparty();
$object =& $f;
if (!empty($conf->global->LCR_USE_REST_TO_PAY)) {
$deja_regle = $object->getSommePaiement();
$creditnoteamount = $object->getSumCreditNotesUsed();
$depositsamount = $object->getSumDepositsUsed();
$resteapayer = price2num($object->total_ttc - $deja_regle - $creditnoteamount - $depositsamount, 'MT');
} else {
$resteapayer = price2num($object->total_ttc);
}
// ENTETE
if (!empty($conf->global->LCR_GENERATE_ONE_PER_PAGE_WiTH_ADDRESS)) {
$this->_pagehead($pdf, $object, 1, $outputlangs);
$curx = $this->marge_gauche;
$heightforinfotot = 50;
// Height reserved to output the info and total part
$heightforfreetext = isset($conf->global->MAIN_PDF_FREETEXT_HEIGHT) ? $conf->global->MAIN_PDF_FREETEXT_HEIGHT : 5;
// Height reserved to output the free text on last page
$heightforfooter = $this->marge_basse + 8;
// Height reserved to output the footer (value include bottom margin)
$bottomlasttab = $this->page_hauteur - $heightforinfotot - $heightforfreetext - $heightforfooter + 10;
$cury = $bottomlasttab;
$pdf->SetLineStyle(array('dash' => '1,1', 'color' => array(200, 200, 200)));
$pdf->Line($curx, $cury - 11, $this->page_largeur - $this->marge_droite, $cury - 11);
$pdf->SetLineStyle(array('dash' => 0, 'color' => array(0, 0, 0)));
} else {
$curx = $this->marge_gauche;
$cury = $posy - 30;
}
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(53, 20, 10, $cury - 8, $outputlangs->convToOutputCharset('MERCI DE NOUS RETOURNER LA PRESENTE TRAITE SOUS 8 JOURS.'), 0, 1, false, true, 'J', true);
$pdf->SetFont('', '', $default_font_size - 3);
$pdf->writeHTMLCell(40, 20, 70, $cury - 8, $outputlangs->convToOutputCharset('Contre cette LETTRE DE CHANGE STIPULEE SANS FRAIS'), 0, 1, false, true, 'J', true);
$pdf->writeHTMLCell(40, 20, 70, $cury - 3, $outputlangs->convToOutputCharset('Veuillez payer la somme indiquée ci_dessous à l\'ordre de'), 0, 1, false, true, 'J', true);
$pdf->SetFont('', '', $default_font_size - 2);
$pdf->writeHTMLCell(20, 20, 115, $cury - 8, $outputlangs->convToOutputCharset($conf->global->MAIN_INFO_SOCIETE_NOM), 0, 1, false, true, 'J', true);
$pdf->writeHTMLCell(40, 20, 115, $cury - 5, $outputlangs->convToOutputCharset($conf->global->MAIN_INFO_SOCIETE_ADDRESS), 0, 1, false, true, 'J', true);
$pdf->writeHTMLCell(40, 20, 115, $cury + 1, $outputlangs->convToOutputCharset($conf->global->MAIN_INFO_SOCIETE_ZIP . ' ' . $conf->global->MAIN_INFO_SOCIETE_TOWN), 0, 1, false, true, 'J', true);
//Affichage code monnaie
$pdf->SetXY(180, $cury + 1);
$pdf->SetFont(pdf_getPDFFont($outputlangs), '', 7);
$pdf->Cell(18, 0, "Code Monnaie", 0, 1, C);
$pdf->SetXY(180, $cury + 5);
$pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 14);
$pdf->Cell(18, 0, $outputlangs->trans($conf->currency), 0, 0, C);
//Affichage lieu / date
//$town = !empty($this->emetteur->town) ? $this->emetteur->town : $this->emetteur->ville;
$town = $conf->global->MAIN_INFO_SOCIETE_TOWN;
$cury += 5;
$pdf->SetXY(30, $cury);
$pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 8);
$pdf->Cell(15, 0, "A " . $outputlangs->convToOutputCharset($town) . ", le", 0, 1, 'R');
// jolie fleche ...
$curx = 43;
$cury += 2;
$largeur_cadre = 5;
$pdf->Line($curx + $largeur_cadre, $cury, $curx + $largeur_cadre + 5, $cury);
$pdf->Line($curx + $largeur_cadre + 5, $cury, $curx + $largeur_cadre + 5, $cury + 2);
$pdf->Line($curx + $largeur_cadre + 4, $cury + 2, $curx + $largeur_cadre + 6, $cury + 2);
$pdf->Line($curx + $largeur_cadre + 4, $cury + 2, $curx + $largeur_cadre + 5, $cury + 3);
$pdf->Line($curx + $largeur_cadre + 6, $cury + 2, $curx + $largeur_cadre + 5, $cury + 3);
// fin jolie fleche
//Affichage toute la ligne qui commence par "montant pour controle" ...
$curx = $this->marge_gauche;
$cury += 5;
$hauteur_cadre = 8;
$largeur_cadre = 27;
$pdf->SetXY($curx, $cury);
$pdf->SetFont(pdf_getPDFFont($outputlangs), '', 7);
$pdf->Cell($largeur_cadre, 0, "Montant pour contrôle", 0, 0, C);
$pdf->Line($curx, $cury, $curx, $cury + $hauteur_cadre);
$pdf->Line($curx, $cury + $hauteur_cadre, $curx + $largeur_cadre, $cury + $hauteur_cadre);
$pdf->Line($curx + $largeur_cadre, $cury, $curx + $largeur_cadre, $cury + $hauteur_cadre);
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 8);
$pdf->Cell($largeur_cadre, 0, price($resteapayer), 0, 0, C);
$curx = $curx + $largeur_cadre + 5;
$hauteur_cadre = 8;
$largeur_cadre = 25;
$pdf->SetXY($curx, $cury);
$pdf->SetFont(pdf_getPDFFont($outputlangs), '', 7);
$pdf->Cell($largeur_cadre, 0, "Date de création", 0, 0, C);
$pdf->Line($curx, $cury, $curx, $cury + $hauteur_cadre);
$pdf->Line($curx, $cury + $hauteur_cadre, $curx + $largeur_cadre, $cury + $hauteur_cadre);
$pdf->Line($curx + $largeur_cadre, $cury, $curx + $largeur_cadre, $cury + $hauteur_cadre);
$pdf->SetXY($curx, $cury + 4);
$pdf->SetFont(pdf_getPDFFont($outputlangs), 'B', 8);
$pdf->Cell($largeur_cadre, 0, dol_print_date($object->date, "day", false, $outpulangs), 0, 0, C);
//.........這裏部分代碼省略.........
示例11: rebuild_merge_pdf
//.........這裏部分代碼省略.........
if ($usestdout) {
print "PDF for invoice " . $obj->facnumber . " already exists\n";
}
}
// Add file into files array
$files[] = $filename;
}
if ($result <= 0) {
$error++;
if ($usestdout) {
print "Error: Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid) . "\n";
} else {
dol_syslog("Failed to build PDF for invoice " . ($fac->ref ? $fac->ref : ' id ' . $obj->rowid), LOG_ERR);
}
}
$cpt++;
}
// Define format of output PDF
$formatarray = pdf_getFormat($langs);
$page_largeur = $formatarray['width'];
$page_hauteur = $formatarray['height'];
$format = array($page_largeur, $page_hauteur);
if ($usestdout) {
print "Using output PDF format " . join('x', $format) . "\n";
} else {
dol_syslog("Using output PDF format " . join('x', $format), LOG_ERR);
}
// Now, build a merged files with all files in $files array
//---------------------------------------------------------
// Create empty PDF
$pdf = pdf_getInstance($format);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($langs));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
$pdf->SetCompression(false);
}
//$pdf->SetCompression(false);
// Add all others
foreach ($files as $file) {
if ($usestdout) {
print "Merge PDF file for invoice " . $file . "\n";
} else {
dol_syslog("Merge PDF file for invoice " . $file);
}
// Charge un document PDF depuis un fichier.
$pagecount = $pdf->setSourceFile($file);
for ($i = 1; $i <= $pagecount; $i++) {
$tplidx = $pdf->importPage($i);
$s = $pdf->getTemplatesize($tplidx);
$pdf->AddPage($s['h'] > $s['w'] ? 'P' : 'L');
$pdf->useTemplate($tplidx);
}
}
// Create output dir if not exists
dol_mkdir($diroutputpdf);
// Save merged file
$filename = $fileprefix;
if (empty($filename)) {
$filename = 'mergedpdf';
}
if (!empty($filesuffix)) {
$filename .= '_' . $filesuffix;
}
$file = $diroutputpdf . '/' . $filename . '.pdf';
if (!$error && $pagecount) {
$pdf->Output($file, 'F');
if (!empty($conf->global->MAIN_UMASK)) {
@chmod($file, octdec($conf->global->MAIN_UMASK));
}
}
if ($usestdout) {
if (!$error) {
print "Merged PDF has been built in " . $file . "\n";
} else {
print "Can't build PDF " . $file . "\n";
}
}
$result = 1;
} else {
if ($usestdout) {
print "No invoices found for criteria.\n";
} else {
dol_syslog("No invoices found for criteria");
}
$result = 0;
}
} else {
dol_print_error($db);
dol_syslog("scripts/invoices/rebuild_merge.php: Error");
$error++;
}
if ($error) {
return -1;
} else {
return $result;
}
}
示例12: write_file
/**
* \brief Fonction generant le document sur le disque
* \param object Objet expedition a generer (ou id si ancienne methode)
* \param outputlangs Lang output object
* \return int 1=ok, 0=ko
*/
function write_file(&$object, $outputlangs)
{
global $user,$conf,$langs,$mysoc;
$default_font_size = pdf_getPDFFontSize($outputlangs);
$object->fetch_thirdparty();
if (! is_object($outputlangs)) $outputlangs=$langs;
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!class_exists('TCPDF')) $outputlangs->charset_output='ISO-8859-1';
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("propal");
$outputlangs->load("sendings");
$outputlangs->load("deliveries");
//Generation de la fiche
$this->expe = $object;
//Verification de la configuration
if ($conf->expedition->dir_output)
{
$object->fetch_thirdparty();
$origin = $object->origin;
//Creation de l expediteur
$this->expediteur = $mysoc;
//Creation du destinataire
$idcontact = $object->$origin->getIdContact('external','SHIPPING');
$this->destinataire = new Contact($this->db);
if ($idcontact[0]) $this->destinataire->fetch($idcontact[0]);
//Creation du livreur
$idcontact = $object->$origin->getIdContact('internal','LIVREUR');
$this->livreur = new User($this->db);
if ($idcontact[0]) $this->livreur->fetch($idcontact[0]);
// Definition de $dir et $file
if ($object->specimen)
{
$dir = $conf->expedition->dir_output."/sending";
$file = $dir . "/SPECIMEN.pdf";
}
else
{
$expref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output . "/sending/" . $expref;
$file = $dir . "/" . $expref . ".pdf";
}
if (! file_exists($dir))
{
if (create_exdir($dir) < 0)
{
$this->error=$outputlangs->transnoentities("ErrorCanNotCreateDir",$dir);
return 0;
}
}
//Si le dossier existe
if (file_exists($dir))
{
$pdf=pdf_getInstance($this->format,'mm','l');
if (class_exists('TCPDF'))
{
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
$pdf->Open();
$pagenb=0;
$pdf->SetDrawColor(128,128,128);
//Generation de l entete du fichier
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Sending"));
$pdf->SetCreator("Dolibarr ".DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref)." ".$outputlangs->transnoentities("Sending"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) $pdf->SetCompression(false);
$pdf->SetMargins(10, 10, 10);
$pdf->SetAutoPageBreak(1,0);
$pdf->SetFont('','', $default_font_size - 3);
//.........這裏部分代碼省略.........
示例13: pdf_pagefoot
//.........這裏部分代碼省略.........
$line3 = "";
// Juridical status
if ($fromcompany->forme_juridique_code) {
$line3 .= ($line3 ? " - " : "") . $outputlangs->convToOutputCharset(getFormeJuridiqueLabel($fromcompany->forme_juridique_code));
}
// Capital
if ($fromcompany->capital) {
$line3 .= ($line3 ? " - " : "") . $outputlangs->transnoentities("CapitalOf", $fromcompany->capital) . " " . $outputlangs->transnoentities("Currency" . $conf->currency);
}
// 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
$line4 = "";
// 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);
// 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 'nbofline='.$nbofline; exit;
//print 'e'.$line.'t'.dol_nboflines($line);exit;
$posy = $marge_basse + $nbofline * 3 + (!empty($line1) ? 3 : 0) + (!empty($line2) ? 3 : 0) + (!empty($line3) ? 3 : 0) + (!empty($line4) ? 3 : 0);
if ($line) {
$pdf->SetXY($marge_gauche, -$posy);
$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 ($conf->global->MAIN_USE_AUTOWRAP_ON_FREETEXT) {
$width = 200;
$align = 'C';
}
$pdf->MultiCell($width, 3, $line, 0, $align, 0);
$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 (!empty($line1)) {
$pdf->SetFont('', 'B', 7);
$pdf->SetXY($marge_gauche, -$posy);
$pdf->MultiCell(200, 2, $line1, 0, 'C', 0);
$posy -= 3;
$pdf->SetFont('', '', 7);
}
if (!empty($line2)) {
$pdf->SetFont('', 'B', 7);
$pdf->SetXY($marge_gauche, -$posy);
$pdf->MultiCell(200, 2, $line2, 0, 'C', 0);
$posy -= 3;
$pdf->SetFont('', '', 7);
}
if (!empty($line3)) {
$pdf->SetXY($marge_gauche, -$posy);
$pdf->MultiCell(200, 2, $line3, 0, 'C', 0);
}
if (!empty($line4)) {
$posy -= 3;
$pdf->SetXY($marge_gauche, -$posy);
$pdf->MultiCell(200, 2, $line4, 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);
//print 'xxx'.$pdf->getAliasNbPages().'-'.$pdf->getAliasNumPage();exit;
}
}
示例14: write_file
/**
* Fonction generant le projet sur le disque
*
* @param Project $object Object project a generer
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object, $outputlangs)
{
global $user, $langs, $conf;
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("projects");
if ($conf->projet->dir_output) {
$nblignes = count($object->lines);
$default_font_size = pdf_getPDFFontsize($outputlangs);
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->projet->dir_output;
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/" . $objectref;
}
$file = $dir . "/" . $objectref . ".pdf";
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
$pdf = pdf_getInstance($this->format);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Complete object by loading several other informations
$task = new Task($this->db);
$tasksarray = $task->getTasksArray(0, 0, $object->id);
$object->lines = $tasksarray;
$nblignes = count($object->lines);
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("Project"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("Project"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
$pdf->SetAutoPageBreak(1, 0);
// New page
$pdf->AddPage();
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, '');
// Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$tab_top = 50;
$tab_height = 200;
$tab_top_newpage = 40;
$tab_height_newpage = 210;
// Affiche notes
if (!empty($object->note_public)) {
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->writeHTMLCell(190, 3, $this->posxref - 1, $tab_top - 2, dol_htmlentitiesbr($object->note_public), 0, 1);
$nexY = $pdf->GetY();
$height_note = $nexY - ($tab_top - 2);
// Rect prend une longueur en 3eme param
$pdf->SetDrawColor(192, 192, 192);
$pdf->Rect($this->marge_gauche, $tab_top - 3, $this->page_largeur - $this->marge_gauche - $this->marge_droite, $height_note + 1);
$tab_height = $tab_height - $height_note;
$tab_top = $nexY + 6;
} else {
$height_note = 0;
}
$iniY = $tab_top + 7;
$curY = $tab_top + 7;
$nexY = $tab_top + 7;
// Boucle sur les lignes
for ($i = 0; $i < $nblignes; $i++) {
$curY = $nexY;
// Description of ligne
$ref = $object->lines[$i]->ref;
$libelleline = $object->lines[$i]->label;
$progress = $object->lines[$i]->progress . '%';
$datestart = dol_print_date($object->lines[$i]->date_start, 'day');
$dateend = dol_print_date($object->lines[$i]->date_end, 'day');
//.........這裏部分代碼省略.........
示例15: write_file
/**
* Fonction generant le bon de livraison sur le disque
*
* @param Object $object Object livraison a generer
* @param Translate $outputlangs Lang output object
* @return int 1 if OK, <=0 if KO
*/
function write_file($object, $outputlangs)
{
global $user, $langs, $conf;
$default_font_size = pdf_getPDFFontSize($outputlangs);
if (!is_object($outputlangs)) {
$outputlangs = $langs;
}
// For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO
if (!empty($conf->global->MAIN_USE_FPDF)) {
$outputlangs->charset_output = 'ISO-8859-1';
}
$outputlangs->load("main");
$outputlangs->load("dict");
$outputlangs->load("companies");
$outputlangs->load("bills");
$outputlangs->load("products");
$outputlangs->load("deliveries");
$outputlangs->load("sendings");
if ($conf->expedition->dir_output . "/receipt") {
$object->fetch_thirdparty();
$nblines = count($object->lines);
$objectref = dol_sanitizeFileName($object->ref);
$dir = $conf->expedition->dir_output . "/receipt";
if (!preg_match('/specimen/i', $objectref)) {
$dir .= "/" . $objectref;
}
$file = $dir . "/" . $objectref . ".pdf";
if (!file_exists($dir)) {
if (dol_mkdir($dir) < 0) {
$this->error = $langs->transnoentities("ErrorCanNotCreateDir", $dir);
return 0;
}
}
if (file_exists($dir)) {
$pdf = pdf_getInstance($this->format);
if (class_exists('TCPDF')) {
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
}
$pdf->SetFont(pdf_getPDFFont($outputlangs));
// Set path to the background PDF File
if (empty($conf->global->MAIN_DISABLE_FPDI) && !empty($conf->global->MAIN_ADD_PDF_BACKGROUND)) {
$pagecount = $pdf->setSourceFile($conf->mycompany->dir_output . '/' . $conf->global->MAIN_ADD_PDF_BACKGROUND);
$tplidx = $pdf->importPage(1);
}
// Complete object by loading several other informations
$expedition = new Expedition($this->db);
$result = $expedition->fetch($object->expedition_id);
$commande = new Commande($this->db);
if ($expedition->origin == 'commande') {
$commande->fetch($expedition->origin_id);
}
$object->commande = $commande;
$pdf->Open();
$pagenb = 0;
$pdf->SetDrawColor(128, 128, 128);
$pdf->SetTitle($outputlangs->convToOutputCharset($object->ref));
$pdf->SetSubject($outputlangs->transnoentities("DeliveryOrder"));
$pdf->SetCreator("Dolibarr " . DOL_VERSION);
$pdf->SetAuthor($outputlangs->convToOutputCharset($user->getFullName($outputlangs)));
$pdf->SetKeyWords($outputlangs->convToOutputCharset($object->ref) . " " . $outputlangs->transnoentities("DeliveryOrder"));
if ($conf->global->MAIN_DISABLE_PDF_COMPRESSION) {
$pdf->SetCompression(false);
}
$pdf->SetMargins($this->marge_gauche, $this->marge_haute, $this->marge_droite);
// Left, Top, Right
$pdf->SetAutoPageBreak(1, 0);
/*
// Positionne $this->atleastonediscount si on a au moins une remise
for ($i = 0 ; $i < $nblignes ; $i++)
{
if ($object->lines[$i]->remise_percent)
{
$this->atleastonediscount++;
}
}
*/
// New page
$pdf->AddPage();
if (!empty($tplidx)) {
$pdf->useTemplate($tplidx);
}
$pagenb++;
$this->_pagehead($pdf, $object, 1, $outputlangs);
$pdf->SetFont('', '', $default_font_size - 1);
$pdf->MultiCell(0, 3, '');
// Set interline to 3
$pdf->SetTextColor(0, 0, 0);
$tab_top = 90;
$tab_top_newpage = 50;
$tab_height = 110;
$tab_height_newpage = 150;
// Affiche notes
//.........這裏部分代碼省略.........