Revize 1e8c793d
Přidáno uživatelem Michal Kliment před více než 9 roky(ů)
application/vendors/mpdf/mpdf.php | ||
---|---|---|
|
||
// ******************************************************************************
|
||
// Software: mPDF, Unicode-HTML Free PDF generator *
|
||
// Version: 5.6 based on *
|
||
// Version: 5.7.4 based on *
|
||
// FPDF by Olivier PLATHEY *
|
||
// HTML2FPDF by Renato Coelho *
|
||
// Date: 2013-01-20 *
|
||
// Date: 2014-08-23 *
|
||
// Author: Ian Back <ianb@bpm1.com> *
|
||
// License: GPL *
|
||
// *
|
||
... | ... | |
// ******************************************************************************
|
||
|
||
|
||
define('mPDF_VERSION','5.6');
|
||
define('mPDF_VERSION','5.7.4');
|
||
|
||
//Scale factor
|
||
define('_MPDFK', (72/25.4));
|
||
... | ... | |
// EXTERNAL (PUBLIC) VARIABLES
|
||
// Define these in config.php
|
||
///////////////////////////////
|
||
var $CJKforceend; // mPDF 5.6.40
|
||
// mPDF 5.6.34
|
||
var $h2bookmarks;
|
||
var $h2toc;
|
||
var $decimal_align; // mPDF 5.6.13
|
||
var $margBuffer; // mPDF 5.4.04
|
||
var $splitTableBorderWidth; // mPDF 5.4.16
|
||
|
||
... | ... | |
var $incrementFPR3;
|
||
var $incrementFPR4;
|
||
|
||
var $hyphenate;
|
||
var $hyphenateTables;
|
||
var $SHYlang;
|
||
var $SHYleftmin;
|
||
var $SHYrightmin;
|
||
... | ... | |
var $jSmaxCharLast;
|
||
var $jSmaxWordLast;
|
||
|
||
var $orphansAllowed;
|
||
var $max_colH_correction;
|
||
|
||
|
||
... | ... | |
//////////////////////
|
||
// CLASS OBJECTS
|
||
//////////////////////
|
||
var $cssmgr;
|
||
var $grad;
|
||
var $bmp;
|
||
var $wmf;
|
||
... | ... | |
//////////////////////
|
||
// INTERNAL VARIABLES
|
||
//////////////////////
|
||
var $uniqstr; // mPDF 5.7.2
|
||
var $writingToC; // mPDF 5.6.38
|
||
// mPDF 5.6.01
|
||
var $layers;
|
||
var $current_layer;
|
||
var $open_layer_pane;
|
||
var $decimal_offset; // mPDF 5.6.13
|
||
var $inMeter; // mPDF 5.5.09
|
||
|
||
var $CJKleading;
|
||
... | ... | |
var $noImageFile;
|
||
var $lastblockbottommargin;
|
||
var $baselineC;
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
var $baselineSup;
|
||
var $baselineSub;
|
||
var $baselineS;
|
||
var $subPos;
|
||
var $subArrMB;
|
||
var $ReqFontStyle;
|
||
... | ... | |
var $cell_border_dominance_R;
|
||
var $cell_border_dominance_T;
|
||
var $cell_border_dominance_B;
|
||
var $tbCSSlvl;
|
||
var $listCSSlvl;
|
||
var $table_keep_together;
|
||
var $plainCell_properties;
|
||
var $inherit_lineheight;
|
||
... | ... | |
var $blockContext;
|
||
var $floatDivs;
|
||
|
||
var $tablecascadeCSS;
|
||
var $listcascadeCSS;
|
||
|
||
var $patterns;
|
||
var $pageBackgrounds;
|
||
... | ... | |
// List of ALL available CJK fonts (incl. styles) (Adobe add-ons) hw removed
|
||
var $available_CJK_fonts;
|
||
|
||
var $cascadeCSS;
|
||
|
||
var $HTMLHeader;
|
||
var $HTMLFooter;
|
||
var $HTMLHeaderE;
|
||
... | ... | |
var $divrevert;
|
||
var $spanbgcolor;
|
||
|
||
var $spanlvl;
|
||
var $listlvl;
|
||
var $listnum;
|
||
var $listtype;
|
||
... | ... | |
var $dotted_on;
|
||
var $strike;
|
||
|
||
var $CSS;
|
||
var $textbuffer;
|
||
var $currentfontstyle;
|
||
var $currentfontfamily;
|
||
... | ... | |
|
||
var $lineheight;
|
||
var $basepath;
|
||
var $outlineparam;
|
||
var $outline_on;
|
||
var $textparam;
|
||
|
||
var $specialcontent;
|
||
var $selectoption;
|
||
... | ... | |
|
||
//Private properties FROM FPDF
|
||
var $DisplayPreferences;
|
||
var $outlines;
|
||
var $flowingBlockAttr;
|
||
var $page; //current page number
|
||
var $n; //current object number
|
||
... | ... | |
$this->useOddEven =& $this->mirrorMargins;
|
||
$this->useSubstitutionsMB =& $this->useSubstitutions;
|
||
|
||
$this->writingToC = false; // mPDF 5.6.38
|
||
$this->uniqstr = '20110230'; // mPDF 5.7.2
|
||
// mPDF 5.6.01
|
||
$this->layers = array();
|
||
$this->current_layer = 0;
|
||
$this->open_layer_pane = false;
|
||
|
||
$this->visibility='visible';
|
||
|
||
//Initialization of properties
|
||
... | ... | |
$this->smCapsStretch = 100;
|
||
$this->margBuffer = 0; // mPDF 5.4.04
|
||
$this->inMeter = false; // mPDF 5.5.09
|
||
$this->decimal_offset = 0;
|
||
|
||
$this->defTextColor = $this->TextColor = $this->SetTColor($this->ConvertColor(0),true);
|
||
$this->defDrawColor = $this->DrawColor = $this->SetDColor($this->ConvertColor(0),true);
|
||
... | ... | |
$this->floatDivs = array();
|
||
$this->DisplayPreferences='';
|
||
|
||
$this->tablecascadeCSS = array();
|
||
$this->listcascadeCSS = array();
|
||
|
||
$this->patterns = array(); // Tiling patterns used for backgrounds
|
||
$this->pageBackgrounds = array();
|
||
$this->writingHTMLheader = false; // internal flag - used both for writing HTMLHeaders/Footers and FixedPos block
|
||
... | ... | |
|
||
|
||
$this->baselineC = 0.35; // Baseline for text
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
$this->baselineSup = 0.5; // Sets default change in baseline for <sup> text bas factor of preceeding fontsize
|
||
$this->baselineSub = -0.2; // Sets default change in baseline for <sub> text bas factor of preceeding fontsize
|
||
$this->baselineS = 0.3; // Sets default height for <strike> text as factor of fontsize
|
||
|
||
$this->noImageFile = str_replace("\\","/",dirname(__FILE__)) . '/includes/no_image.jpg';
|
||
$this->subPos = 0;
|
||
$this->forceExactLineheight = false;
|
||
... | ... | |
$this->useRC128encryption = false;
|
||
$this->uniqid = '';
|
||
|
||
$this->cascadeCSS = array();
|
||
$this->bufferoutput = false;
|
||
$this->encrypted=false; //whether document is protected
|
||
$this->BMoutlines=array();
|
||
... | ... | |
$this->usingCoreFont = false;
|
||
$this->charspacing=0;
|
||
|
||
$this->outlines=array();
|
||
$this->autoPageBreak = true;
|
||
|
||
require(_MPDF_PATH.'config.php'); // config data
|
||
... | ... | |
$optcore = false;
|
||
$onlyCoreFonts = false;
|
||
if (preg_match('/([\-+])aCJK/i',$mode, $m)) {
|
||
preg_replace('/([\-+])aCJK/i','',$mode);
|
||
$mode = preg_replace('/([\-+])aCJK/i','',$mode);
|
||
if ($m[1]=='+') { $this->useAdobeCJK = true; }
|
||
else { $this->useAdobeCJK = false; }
|
||
}
|
||
... | ... | |
else { $this->useSubstitutions = false; }
|
||
|
||
/*-- HTML-CSS --*/
|
||
|
||
if (!class_exists('cssmgr', false)) { include(_MPDF_PATH .'classes/cssmgr.php'); }
|
||
$this->cssmgr = new cssmgr($this);
|
||
if (file_exists(_MPDF_PATH.'mpdf.css')) {
|
||
$css = file_get_contents(_MPDF_PATH.'mpdf.css');
|
||
$css2 = $this->ReadDefaultCSS($css);
|
||
$this->defaultCSS = $this->array_merge_recursive_unique($this->defaultCSS,$css2);
|
||
$css2 = $this->cssmgr->ReadDefaultCSS($css);
|
||
$this->defaultCSS = $this->cssmgr->array_merge_recursive_unique($this->defaultCSS,$css2);
|
||
}
|
||
/*-- END HTML-CSS --*/
|
||
|
||
... | ... | |
$this->colorarray=array();
|
||
$this->spanbgcolorarray=array();
|
||
$this->textbuffer=array();
|
||
$this->CSS=array();
|
||
$this->internallink=array();
|
||
$this->basepath = "";
|
||
|
||
$this->SetBasePath('');
|
||
|
||
$this->outlineparam = array();
|
||
$this->outline_on = false;
|
||
$this->textparam = array();
|
||
|
||
$this->specialcontent = '';
|
||
$this->selectoption = array();
|
||
... | ... | |
case 'A1': {$format = array(1683.78,2383.94); break;}
|
||
case 'A2': {$format = array(1190.55,1683.78); break;}
|
||
case 'A3': {$format = array(841.89,1190.55); break;}
|
||
case 'A4': default: {$format = array(595.28,841.89); break;}
|
||
case 'A4': {$format = array(595.28,841.89); break;} // mPDF 5.7.4
|
||
case 'A5': {$format = array(419.53,595.28); break;}
|
||
case 'A6': {$format = array(297.64,419.53); break;}
|
||
case 'A7': {$format = array(209.76,297.64); break;}
|
||
... | ... | |
case 'A': {$format=array(314.65,504.57 ); break;} // 'A' format paperback size 111x178mm
|
||
case 'DEMY': {$format=array(382.68,612.28 ); break;} // 'Demy' format paperback size 135x216mm
|
||
case 'ROYAL': {$format=array(433.70,663.30 ); break;} // 'Royal' format paperback size 153x234mm
|
||
default: $format = false;
|
||
default: {$format = array(595.28,841.89); break;} // mPDF 5.7.4
|
||
}
|
||
return $format;
|
||
}
|
||
... | ... | |
$alpha = 1;
|
||
}
|
||
$a = array('BM'=>'/'.$bm);
|
||
if ($mode=='F' || $mode='B') $a['ca'] = $alpha;
|
||
if ($mode=='S' || $mode='B') $a['CA'] = $alpha;
|
||
if ($mode=='F' || $mode=='B') $a['ca'] = $alpha; // mPDF 5.7.2
|
||
if ($mode=='S' || $mode=='B') $a['CA'] = $alpha; // mPDF 5.7.2
|
||
$gs = $this->AddExtGState($a);
|
||
if ($return) { return sprintf('/GS%d gs', $gs); }
|
||
else { $this->_out(sprintf('/GS%d gs', $gs)); }
|
||
... | ... | |
$this->pdf_version='1.5';
|
||
if($this->visibility!='visible') {
|
||
$this->_out('EMC');
|
||
$this->hasOC = true;
|
||
$this->hasOC=intval($this->hasOC ); // mPDF 5.6.01
|
||
}
|
||
if($v=='printonly')
|
||
if($v=='printonly') {
|
||
$this->_out('/OC /OC1 BDC');
|
||
elseif($v=='screenonly')
|
||
$this->hasOC=($this->hasOC | 1); // mPDF 5.6.01
|
||
}
|
||
elseif($v=='screenonly') {
|
||
$this->_out('/OC /OC2 BDC');
|
||
elseif($v=='hidden')
|
||
$this->hasOC=($this->hasOC | 2); // mPDF 5.6.01
|
||
}
|
||
elseif($v=='hidden') {
|
||
$this->_out('/OC /OC3 BDC');
|
||
$this->hasOC=($this->hasOC | 4); // mPDF 5.6.01
|
||
}
|
||
elseif($v!='visible')
|
||
$this->Error('Incorrect visibility: '.$v);
|
||
$this->visibility=$v;
|
||
... | ... | |
$s .= $this->PrintBodyBackgrounds();
|
||
|
||
$s .= $this->PrintPageBackgrounds();
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$s."\n".'\\1', $this->pages[$this->page]);
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.$this->uniqstr.')/', "\n".$s."\n".'\\1', $this->pages[$this->page]);
|
||
$this->pageBackgrounds = array();
|
||
|
||
if($this->visibility!='visible')
|
||
$this->SetVisibility('visible');
|
||
// mPDF 5.6.01 - LAYERS
|
||
$this->EndLayer();
|
||
|
||
if (!$this->tocontents || !$this->tocontents->TOCmark) { //Page footer
|
||
$this->InFooter=true;
|
||
... | ... | |
}
|
||
|
||
/*-- BACKGROUNDS --*/
|
||
function _resizeBackgroundImage($imw, $imh, $cw, $ch, $resize=0, $repx, $repy) {
|
||
function _resizeBackgroundImage($imw, $imh, $cw, $ch, $resize=0, $repx, $repy, $pba=array(), $size=array()) { // mPDF 5.6.10
|
||
// pba is background positioning area (from CSS background-origin) may not always be set [x,y,w,h]
|
||
// size is from CSS3 background-size - takes precendence over old resize
|
||
// $w - absolute length or % or auto or cover | contain
|
||
// $h - absolute length or % or auto or cover | contain
|
||
// mPDF 5.6.10
|
||
if (isset($pba['w'])) $cw = $pba['w'];
|
||
if (isset($pba['h'])) $ch = $pba['h'];
|
||
|
||
$cw = $cw*_MPDFK;
|
||
$ch = $ch*_MPDFK;
|
||
if (!$resize) { return array($imw, $imh, $repx, $repy); }
|
||
if ($resize==1 && $imw > $cw) {
|
||
if (empty($size) && !$resize) { return array($imw, $imh, $repx, $repy); }
|
||
|
||
// mPDF 5.6.10
|
||
if (isset($size['w']) && $size['w']) {
|
||
if ($size['w']=='contain') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
|
||
// Same as resize==3
|
||
$h = $imh * $cw/$imw;
|
||
$w = $cw;
|
||
if ($h > $ch) {
|
||
$w = $w * $ch/$h;
|
||
$h = $ch;
|
||
}
|
||
}
|
||
else if ($size['w']=='cover') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
|
||
$h = $imh * $cw/$imw;
|
||
$w = $cw;
|
||
if ($h < $ch) {
|
||
$w = $w * $h/$ch;
|
||
$h = $ch;
|
||
}
|
||
}
|
||
else {
|
||
if (stristr($size['w'] ,'%')) {
|
||
$size['w'] += 0;
|
||
$size['w'] /= 100;
|
||
$size['w'] = ($cw * $size['w']);
|
||
}
|
||
if (stristr($size['h'] ,'%')) {
|
||
$size['h'] += 0;
|
||
$size['h'] /= 100;
|
||
$size['h'] = ($ch * $size['h']);
|
||
}
|
||
if ($size['w']=='auto' && $size['h']=='auto') {
|
||
$w = $imw;
|
||
$h = $imh;
|
||
}
|
||
else if ($size['w']=='auto' && $size['h']!='auto') {
|
||
$w = $imw * $size['h']/$imh;
|
||
$h = $size['h'];
|
||
}
|
||
else if ($size['w']!='auto' && $size['h']=='auto') {
|
||
$h = $imh * $size['w']/$imw;
|
||
$w = $size['w'];
|
||
}
|
||
else {
|
||
$w = $size['w'];
|
||
$h = $size['h'];
|
||
}
|
||
}
|
||
return array($w, $h, $repx, $repy);
|
||
}
|
||
else if ($resize==1 && $imw > $cw) {
|
||
$h = $imh * $cw/$imw;
|
||
$repx = false;
|
||
return array($cw, $h, $repx, $repy);
|
||
}
|
||
else if ($resize==2 && $imh > $ch) {
|
||
$w = $imw * $ch/$imh;
|
||
$repy = false;
|
||
return array($w, $ch, $repx, $repy);
|
||
}
|
||
else if ($resize==3) {
|
||
$w = $imw;
|
||
$h = $imh;
|
||
$saverepx = $repx;
|
||
if ($w > $cw) {
|
||
$h = $h * $cw/$w;
|
||
$w = $cw;
|
||
$repx = false;
|
||
}
|
||
if ($h > $ch) {
|
||
$w = $w * $ch/$h;
|
||
$h = $ch;
|
||
$repy = false;
|
||
$repx = $saverepx;
|
||
}
|
||
return array($w, $h, $repx, $repy);
|
||
}
|
||
else if ($resize==4) {
|
||
$h = $imh * $cw/$imw;
|
||
$repx = false;
|
||
return array($cw, $h, $repx, $repy);
|
||
}
|
||
else if ($resize==5) {
|
||
$w = $imw * $ch/$imh;
|
||
$repy = false;
|
||
return array($w, $ch, $repx, $repy);
|
||
}
|
||
else if ($resize==6) {
|
||
$repx = false;
|
||
$repy = false;
|
||
return array($cw, $ch, $repx, $repy);
|
||
}
|
||
return array($imw, $imh, $repx, $repy);
|
||
... | ... | |
|
||
|
||
function SetBackground(&$properties, &$maxwidth) {
|
||
// mPDF 5.6.10 5.6.11
|
||
if (isset($properties['BACKGROUND-ORIGIN']) && ($properties['BACKGROUND-ORIGIN']=='border-box' || $properties['BACKGROUND-ORIGIN']== 'content-box')) { $origin = $properties['BACKGROUND-ORIGIN']; }
|
||
else { $origin = 'padding-box'; }
|
||
// mPDF 5.6.10
|
||
if (isset($properties['BACKGROUND-SIZE'])) {
|
||
if (stristr($properties['BACKGROUND-SIZE'] ,'contain') ) { $bsw = $bsh = 'contain'; }
|
||
else if (stristr($properties['BACKGROUND-SIZE'] ,'cover') ) { $bsw = $bsh = 'cover'; }
|
||
else {
|
||
$bsw = $bsh = 'auto';
|
||
$sz = preg_split('/\s+/',trim($properties['BACKGROUND-SIZE']));
|
||
if (count($sz)==2) { $bsw = $sz[0]; $bsh = $sz[1]; }
|
||
else { $bsw = $sz[0]; }
|
||
if (!stristr($bsw ,'%') && !stristr($bsw ,'auto') ) { $bsw = $this->ConvertSize($bsw ,$maxwidth,$this->FontSize); }
|
||
if (!stristr($bsh ,'%') && !stristr($bsh ,'auto') ) { $bsh = $this->ConvertSize($bsh ,$maxwidth,$this->FontSize); }
|
||
}
|
||
$size = array('w'=>$bsw, 'h'=>$bsh);
|
||
}
|
||
if (preg_match('/(-moz-)*(repeating-)*(linear|radial)-gradient/',$properties['BACKGROUND-IMAGE'])) {
|
||
return array('gradient'=>$properties['BACKGROUND-IMAGE']);
|
||
return array('gradient'=>$properties['BACKGROUND-IMAGE'], 'origin'=>$origin, 'size'=>$size ); // mPDF 5.6.10
|
||
}
|
||
else {
|
||
$file = $properties['BACKGROUND-IMAGE'];
|
||
... | ... | |
else { $resize = 0; }
|
||
if (isset($properties['BACKGROUND-IMAGE-OPACITY'])) { $opacity = $properties['BACKGROUND-IMAGE-OPACITY']; }
|
||
else { $opacity = 1; }
|
||
return array('image_id'=>$image_id, 'orig_w'=>$orig_w, 'orig_h'=>$orig_h, 'x_pos'=>$x_pos, 'y_pos'=>$y_pos, 'x_repeat'=>$x_repeat, 'y_repeat'=>$y_repeat, 'resize'=>$resize, 'opacity'=>$opacity, 'itype'=>$sizesarray['itype']);
|
||
return array('image_id'=>$image_id, 'orig_w'=>$orig_w, 'orig_h'=>$orig_h, 'x_pos'=>$x_pos, 'y_pos'=>$y_pos, 'x_repeat'=>$x_repeat, 'y_repeat'=>$y_repeat, 'resize'=>$resize, 'opacity'=>$opacity, 'itype'=>$sizesarray['itype'], 'origin'=>$origin, 'size'=>$size );
|
||
}
|
||
}
|
||
return false;
|
||
... | ... | |
foreach($this->pageBackgrounds AS $bl=>$pbs) {
|
||
foreach ($pbs AS $pb) {
|
||
if ((!isset($pb['image_id']) && !isset($pb['gradient'])) || isset($pb['shadowonly'])) { // Background colour or boxshadow
|
||
// mPDF 5.6.01 - LAYERS
|
||
if($pb['z-index']>0) {
|
||
$this->current_layer = $pb['z-index'];
|
||
$s .= "\n".'/OCBZ-index /ZI'.$pb['z-index'].' BDC'."\n";
|
||
}
|
||
|
||
if($pb['visibility']!='visible') {
|
||
if($pb['visibility']=='printonly')
|
||
$s .= '/OC /OC1 BDC'."\n";
|
||
... | ... | |
if (isset($pb['clippath']) && $pb['clippath']) { $s .= 'Q'."\n"; }
|
||
if($pb['visibility']!='visible')
|
||
$s .= 'EMC'."\n";
|
||
|
||
// mPDF 5.6.01 - LAYERS
|
||
if($pb['z-index']>0) {
|
||
$s .= "\n".'EMCBZ-index'."\n";
|
||
$this->current_layer = 0;
|
||
}
|
||
}
|
||
}
|
||
/*-- BACKGROUNDS --*/
|
||
foreach ($pbs AS $pb) {
|
||
if($pb['visibility']!='visible') {
|
||
// mPDF 5.6.01 - LAYERS
|
||
if ((isset($pb['gradient']) && $pb['gradient']) || (isset($pb['image_id']) && $pb['image_id'])) {
|
||
if($pb['z-index']>0) {
|
||
$this->current_layer = $pb['z-index'];
|
||
$s .= "\n".'/OCGZ-index /ZI'.$pb['z-index'].' BDC'."\n";
|
||
}
|
||
if($pb['visibility']!='visible') {
|
||
if($pb['visibility']=='printonly')
|
||
$s .= '/OC /OC1 BDC'."\n";
|
||
else if($pb['visibility']=='screenonly')
|
||
$s .= '/OC /OC2 BDC'."\n";
|
||
else if($pb['visibility']=='hidden')
|
||
$s .= '/OC /OC3 BDC'."\n";
|
||
}
|
||
if (isset($pb['gradient']) && $pb['gradient']) {
|
||
}
|
||
}
|
||
if (isset($pb['gradient']) && $pb['gradient']) {
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= $pb['clippath']."\n"; }
|
||
$s .= $this->grad->Gradient($pb['x'], $pb['y'], $pb['w'], $pb['h'], $pb['gradtype'], $pb['stops'], $pb['colorspace'], $pb['coords'], $pb['extend'], true);
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= 'Q'."\n"; }
|
||
}
|
||
else if (isset($pb['image_id']) && $pb['image_id']) { // Background pattern
|
||
else if (isset($pb['image_id']) && $pb['image_id']) { // Background Image
|
||
$pb['y'] -= $adjustmenty;
|
||
$pb['h'] += $adjustmenty;
|
||
$n = count($this->patterns)+1;
|
||
list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb['orig_w'], $pb['orig_h'], $pb['w'], $pb['h'], $pb['resize'], $pb['x_repeat'], $pb['y_repeat']);
|
||
$this->patterns[$n] = array('x'=>$pb['x'], 'y'=>$pb['y'], 'w'=>$pb['w'], 'h'=>$pb['h'], 'pgh'=>$this->h, 'image_id'=>$pb['image_id'], 'orig_w'=>$orig_w, 'orig_h'=>$orig_h, 'x_pos'=>$pb['x_pos'], 'y_pos'=>$pb['y_pos'], 'x_repeat'=>$x_repeat, 'y_repeat'=>$y_repeat, 'itype'=>$pb['itype']);
|
||
list($orig_w, $orig_h, $x_repeat, $y_repeat) = $this->_resizeBackgroundImage($pb['orig_w'], $pb['orig_h'], $pb['w'], $pb['h'], $pb['resize'], $pb['x_repeat'], $pb['y_repeat'], $pb['bpa'], $pb['size']); // mPDF 5.6.10
|
||
$this->patterns[$n] = array('x'=>$pb['x'], 'y'=>$pb['y'], 'w'=>$pb['w'], 'h'=>$pb['h'], 'pgh'=>$this->h, 'image_id'=>$pb['image_id'], 'orig_w'=>$orig_w, 'orig_h'=>$orig_h, 'x_pos'=>$pb['x_pos'], 'y_pos'=>$pb['y_pos'], 'x_repeat'=>$x_repeat, 'y_repeat'=>$y_repeat, 'itype'=>$pb['itype'], 'bpa'=>$pb['bpa']); // mPDF 5.6.10
|
||
$x = $pb['x']*_MPDFK;
|
||
$y = ($this->h - $pb['y'])*_MPDFK;
|
||
$w = $pb['w']*_MPDFK;
|
||
$h = -$pb['h']*_MPDFK;
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= $pb['clippath']."\n"; }
|
||
if ($this->writingHTMLfooter || $this->writingHTMLheader) {
|
||
if ($this->writingHTMLfooter || $this->writingHTMLheader) { // Write each (tiles) image rather than use as a pattern
|
||
$iw = $pb['orig_w']/_MPDFK;
|
||
$ih = $pb['orig_h']/_MPDFK;
|
||
|
||
$w = $pb['w'];
|
||
$h = $pb['h'];
|
||
$x0 = $pb['x'];
|
||
$y0 = $pb['y'];
|
||
|
||
// mPDF 5.6.11
|
||
if (isset($pb['bpa']) && $pb['bpa']) {
|
||
$w = $pb['bpa']['w'];
|
||
$h = $pb['bpa']['h'];
|
||
$x0 = $pb['bpa']['x'];
|
||
$y0 = $pb['bpa']['y'];
|
||
}
|
||
|
||
// mPDF 5.6.11
|
||
if (isset($pb['size']['w']) && $pb['size']['w']) {
|
||
$size = $pb['size'];
|
||
|
||
if ($size['w']=='contain') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
|
||
// Same as resize==3
|
||
$ih = $ih * $pb['bpa']['w']/$iw;
|
||
$iw = $pb['bpa']['w'];
|
||
if ($ih > $pb['bpa']['h']) {
|
||
$iw = $iw * $pb['bpa']['h']/$ih;
|
||
$ih = $pb['bpa']['h'];
|
||
}
|
||
}
|
||
else if ($size['w']=='cover') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
|
||
$ih = $ih * $pb['bpa']['w']/$iw;
|
||
$iw = $pb['bpa']['w'];
|
||
if ($ih < $pb['bpa']['h']) {
|
||
$iw = $iw * $ih/$pb['bpa']['h'];
|
||
$ih = $pb['bpa']['h'];
|
||
}
|
||
}
|
||
else {
|
||
if (stristr($size['w'] ,'%')) {
|
||
$size['w'] += 0;
|
||
$size['w'] /= 100;
|
||
$size['w'] = ($pb['bpa']['w'] * $size['w']);
|
||
}
|
||
if (stristr($size['h'] ,'%')) {
|
||
$size['h'] += 0;
|
||
$size['h'] /= 100;
|
||
$size['h'] = ($pb['bpa']['h'] * $size['h']);
|
||
}
|
||
if ($size['w']=='auto' && $size['h']=='auto') {
|
||
$iw = $iw;
|
||
$ih = $ih;
|
||
}
|
||
else if ($size['w']=='auto' && $size['h']!='auto') {
|
||
$iw = $iw * $size['h']/$ih;
|
||
$ih = $size['h'];
|
||
}
|
||
else if ($size['w']!='auto' && $size['h']=='auto') {
|
||
$ih = $ih * $size['w']/$iw;
|
||
$iw = $size['w'];
|
||
}
|
||
else {
|
||
$iw = $size['w'];
|
||
$ih = $size['h'];
|
||
}
|
||
}
|
||
}
|
||
|
||
// Number to repeat
|
||
if ($pb['x_repeat']) { $nx = ceil($w/$iw); }
|
||
if ($pb['x_repeat']) { $nx = ceil($pb['w']/$iw)+1; } // mPDF 5.6.11
|
||
else { $nx = 1; }
|
||
if ($pb['y_repeat']) { $ny = ceil($h/$ih); }
|
||
if ($pb['y_repeat']) { $ny = ceil($pb['h']/$ih)+1; } // mPDF 5.6.11
|
||
else { $ny = 1; }
|
||
|
||
$x_pos = $pb['x_pos'];
|
||
if (stristr($x_pos ,'%') ) {
|
||
$x_pos += 0;
|
||
$x_pos /= 100;
|
||
$x_pos = ($w * $x_pos) - ($iw * $x_pos);
|
||
$x_pos = ($pb['bpa']['w'] * $x_pos) - ($iw * $x_pos); // mPDF 5.6.11
|
||
}
|
||
$y_pos = $pb['y_pos'];
|
||
if (stristr($y_pos ,'%') ) {
|
||
$y_pos += 0;
|
||
$y_pos /= 100;
|
||
$y_pos = ($h * $y_pos) - ($ih * $y_pos);
|
||
$y_pos = ($pb['bpa']['h'] * $y_pos) - ($ih * $y_pos); // mPDF 5.6.11
|
||
}
|
||
if ($nx>1) {
|
||
while($x_pos>0) { $x_pos -= $iw; }
|
||
while($x_pos>($pb['x']-$pb['bpa']['x'])) { $x_pos -= $iw; } // mPDF 5.6.11
|
||
}
|
||
if ($ny>1) {
|
||
while($y_pos>0) { $y_pos -= $ih; }
|
||
while($y_pos>($pb['y']-$pb['bpa']['y'])) { $y_pos -= $ih; } // mPDF 5.6.11
|
||
}
|
||
for($xi=0;$xi<$nx;$xi++) {
|
||
for($yi=0;$yi<$ny;$yi++) {
|
||
... | ... | |
}
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= 'Q'."\n"; }
|
||
}
|
||
if($pb['visibility']!='visible')
|
||
$s .= 'EMC'."\n";
|
||
if ((isset($pb['gradient']) && $pb['gradient']) || (isset($pb['image_id']) && $pb['image_id'])) {
|
||
if($pb['visibility']!='visible')
|
||
$s .= 'EMC'."\n";
|
||
|
||
// mPDF 5.6.01 - LAYERS
|
||
if($pb['z-index']>0) {
|
||
$s .= "\n".'EMCGZ-index'."\n";
|
||
$this->current_layer = 0;
|
||
}
|
||
}
|
||
|
||
}
|
||
/*-- END BACKGROUNDS --*/
|
||
... | ... | |
$w = $pb['w']*_MPDFK;
|
||
$h = -$pb['h']*_MPDFK;
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= $pb['clippath']."\n"; }
|
||
if ($pb['opacity']>0 && $pb['opacity']<1) { $opac = $this->SetAlpha($pb['opacity'],'Normal',true); }
|
||
else { $opac = ''; }
|
||
$s .= sprintf('q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $x, $y, $w, $h) ."\n";
|
||
|
||
// mPDF 5.7.3
|
||
if (($this->writingHTMLfooter || $this->writingHTMLheader) && (!isset($pb['clippath']) || $pb['clippath']=='') ) {
|
||
// Set clipping path
|
||
$pb['clippath'] = sprintf(' q 0 w %.3F %.3F m %.3F %.3F l %.3F %.3F l %.3F %.3F l %.3F %.3F l W n ', $x, $y, $x, $y+$h, $x+$w, $y+$h, $x+$w, $y, $x, $y);
|
||
}
|
||
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= $pb['clippath']."\n"; }
|
||
|
||
// mPDF 5.7.3
|
||
if ($this->writingHTMLfooter || $this->writingHTMLheader) { // Write each (tiles) image rather than use as a pattern
|
||
$iw = $pb['orig_w']/_MPDFK;
|
||
$ih = $pb['orig_h']/_MPDFK;
|
||
|
||
$w = $pb['w'];
|
||
$h = $pb['h'];
|
||
$x0 = $pb['x'];
|
||
$y0 = $pb['y'];
|
||
|
||
if (isset($pb['bpa']) && $pb['bpa']) {
|
||
$w = $pb['bpa']['w'];
|
||
$h = $pb['bpa']['h'];
|
||
$x0 = $pb['bpa']['x'];
|
||
$y0 = $pb['bpa']['y'];
|
||
}
|
||
|
||
if (isset($pb['size']['w']) && $pb['size']['w']) {
|
||
$size = $pb['size'];
|
||
|
||
if ($size['w']=='contain') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.
|
||
// Same as resize==3
|
||
$ih = $ih * $pb['bpa']['w']/$iw;
|
||
$iw = $pb['bpa']['w'];
|
||
if ($ih > $pb['bpa']['h']) {
|
||
$iw = $iw * $pb['bpa']['h']/$ih;
|
||
$ih = $pb['bpa']['h'];
|
||
}
|
||
}
|
||
else if ($size['w']=='cover') {
|
||
// Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.
|
||
$ih = $ih * $pb['bpa']['w']/$iw;
|
||
$iw = $pb['bpa']['w'];
|
||
if ($ih < $pb['bpa']['h']) {
|
||
$iw = $iw * $ih/$pb['bpa']['h'];
|
||
$ih = $pb['bpa']['h'];
|
||
}
|
||
}
|
||
else {
|
||
if (stristr($size['w'] ,'%')) {
|
||
$size['w'] += 0;
|
||
$size['w'] /= 100;
|
||
$size['w'] = ($pb['bpa']['w'] * $size['w']);
|
||
}
|
||
if (stristr($size['h'] ,'%')) {
|
||
$size['h'] += 0;
|
||
$size['h'] /= 100;
|
||
$size['h'] = ($pb['bpa']['h'] * $size['h']);
|
||
}
|
||
if ($size['w']=='auto' && $size['h']=='auto') {
|
||
$iw = $iw;
|
||
$ih = $ih;
|
||
}
|
||
else if ($size['w']=='auto' && $size['h']!='auto') {
|
||
$iw = $iw * $size['h']/$ih;
|
||
$ih = $size['h'];
|
||
}
|
||
else if ($size['w']!='auto' && $size['h']=='auto') {
|
||
$ih = $ih * $size['w']/$iw;
|
||
$iw = $size['w'];
|
||
}
|
||
else {
|
||
$iw = $size['w'];
|
||
$ih = $size['h'];
|
||
}
|
||
}
|
||
}
|
||
|
||
// Number to repeat
|
||
if ($pb['x_repeat']) { $nx = ceil($pb['w']/$iw)+1; }
|
||
else { $nx = 1; }
|
||
if ($pb['y_repeat']) { $ny = ceil($pb['h']/$ih)+1; }
|
||
else { $ny = 1; }
|
||
|
||
$x_pos = $pb['x_pos'];
|
||
if (stristr($x_pos ,'%') ) {
|
||
$x_pos += 0;
|
||
$x_pos /= 100;
|
||
$x_pos = ($pb['bpa']['w'] * $x_pos) - ($iw * $x_pos);
|
||
}
|
||
$y_pos = $pb['y_pos'];
|
||
if (stristr($y_pos ,'%') ) {
|
||
$y_pos += 0;
|
||
$y_pos /= 100;
|
||
$y_pos = ($pb['bpa']['h'] * $y_pos) - ($ih * $y_pos);
|
||
}
|
||
if ($nx>1) {
|
||
while($x_pos>($pb['x']-$pb['bpa']['x'])) { $x_pos -= $iw; }
|
||
}
|
||
if ($ny>1) {
|
||
while($y_pos>($pb['y']-$pb['bpa']['y'])) { $y_pos -= $ih; }
|
||
}
|
||
for($xi=0;$xi<$nx;$xi++) {
|
||
for($yi=0;$yi<$ny;$yi++) {
|
||
$x = $x0 + $x_pos + ($iw*$xi);
|
||
$y = $y0 + $y_pos + ($ih*$yi);
|
||
if ($pb['opacity']>0 && $pb['opacity']<1) { $opac = $this->SetAlpha($pb['opacity'],'Normal',true); }
|
||
else { $opac = ''; }
|
||
$s .= sprintf("q %s %.3F 0 0 %.3F %.3F %.3F cm /I%d Do Q", $opac,$iw*_MPDFK,$ih*_MPDFK,$x*_MPDFK,($this->h-($y+$ih))*_MPDFK,$pb['image_id']) ."\n";
|
||
}
|
||
}
|
||
}
|
||
else {
|
||
if (($pb['opacity']>0 || $pb['opacity']==='0') && $pb['opacity']<1) { $opac = $this->SetAlpha($pb['opacity'],'Normal',true); }
|
||
else { $opac = ''; }
|
||
$s .= sprintf('q /Pattern cs /P%d scn %s %.3F %.3F %.3F %.3F re f Q', $n, $opac, $x, $y, $w, $h) ."\n";
|
||
}
|
||
|
||
if (isset($pb['clippath']) && $pb['clippath']) { $s .= 'Q'."\n"; }
|
||
}
|
||
}
|
||
... | ... | |
return $s;
|
||
}
|
||
|
||
// mPDF 5.6.01 - LAYERS
|
||
function BeginLayer($id) {
|
||
if($this->current_layer>0) $this->EndLayer();
|
||
if ($id < 1) { return false; }
|
||
if (!isset($this->layers[$id])) {
|
||
$this->layers[$id] = array('name'=>'Layer '.($id) );
|
||
if (($this->PDFA || $this->PDFX)) { $this->PDFAXwarnings[] = "Cannot use layers when using PDFA or PDFX"; return ''; }
|
||
else if (!$this->PDFA && !$this->PDFX) { $this->pdf_version='1.5'; }
|
||
}
|
||
$this->current_layer = $id;
|
||
$this->_out('/OCZ-index /ZI'.$id.' BDC');
|
||
|
||
$this->pageoutput[$this->page] = array();
|
||
}
|
||
|
||
function EndLayer() {
|
||
if($this->current_layer>0) {
|
||
$this->_out('EMCZ-index');
|
||
$this->current_layer = 0;
|
||
}
|
||
}
|
||
|
||
|
||
|
||
// Depracated - can use AddPage for all
|
||
function AddPages($orientation='',$condition='', $resetpagenum='', $pagenumstyle='', $suppress='',$mgl='',$mgr='',$mgt='',$mgb='',$mgh='',$mgf='',$ohname='',$ehname='',$ofname='',$efname='',$ohvalue=0,$ehvalue=0,$ofvalue=0,$efvalue=0,$pagesel='',$newformat='')
|
||
... | ... | |
}
|
||
|
||
|
||
|
||
|
||
function AddPage($orientation='',$condition='', $resetpagenum='', $pagenumstyle='', $suppress='',$mgl='',$mgr='',$mgt='',$mgb='',$mgh='',$mgf='',$ohname='',$ehname='',$ofname='',$efname='',$ohvalue=0,$ehvalue=0,$ofvalue=0,$efvalue=0,$pagesel='',$newformat='')
|
||
{
|
||
/*-- CSS-FLOAT --*/
|
||
... | ... | |
$s = $this->PrintPageBackgrounds();
|
||
|
||
// Writes after the marker so not overwritten later by page background etc.
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||
$this->pageBackgrounds = array();
|
||
$family=$this->FontFamily;
|
||
$style=$this->FontStyle.($this->U ? 'U' : '').($this->S ? 'S' : '');
|
||
... | ... | |
$this->table_rotate = 0; // *TABLES*
|
||
$save_kwt = $this->kwt;
|
||
$this->kwt = 0;
|
||
// mPDF 5.6.01 - LAYERS
|
||
$save_layer = $this->current_layer;
|
||
$save_vis = $this->visibility;
|
||
|
||
if($this->visibility!='visible')
|
||
$this->SetVisibility('visible');
|
||
// mPDF 5.6.01 - LAYERS
|
||
$this->EndLayer();
|
||
|
||
// Paint Div Border if necessary
|
||
//PAINTS BACKGROUND COLOUR OR BORDERS for DIV - DISABLED FOR COLUMNS (cf. AcceptPageBreak) AT PRESENT in ->PaintDivBB
|
||
... | ... | |
else { $toplvl = $this->blklvl-1; }
|
||
$sy = $this->y;
|
||
for ($bl=1;$bl<=$toplvl;$bl++) {
|
||
|
||
// mPDF 5.6.01 - LAYERS
|
||
if ($this->blk[$bl]['z-index']>0) {
|
||
$this->BeginLayer($this->blk[$bl]['z-index']);
|
||
}
|
||
if (isset($this->blk[$bl]['visibility']) && $this->blk[$bl]['visibility'] && $this->blk[$bl]['visibility']!='visible') {
|
||
$this->SetVisibility($this->blk[$bl]['visibility']);
|
||
}
|
||
|
||
$this->PaintDivBB('pagebottom',0,$bl);
|
||
}
|
||
$this->y = $sy;
|
||
// RESET block y0 and x0 - see below
|
||
}
|
||
|
||
if($this->visibility!='visible')
|
||
$this->SetVisibility('visible');
|
||
// mPDF 5.6.01 - LAYERS
|
||
$this->EndLayer();
|
||
|
||
// BODY Backgrounds
|
||
if ($this->page > 0) {
|
||
$s = '';
|
||
$s .= $this->PrintBodyBackgrounds();
|
||
|
||
$s .= $this->PrintPageBackgrounds();
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$s."\n".'\\1', $this->pages[$this->page]);
|
||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.$this->uniqstr.')/', "\n".$s."\n".'\\1', $this->pages[$this->page]);
|
||
$this->pageBackgrounds = array();
|
||
}
|
||
|
||
... | ... | |
}
|
||
/*-- END COLUMNS --*/
|
||
|
||
$save_vis = $this->visibility;
|
||
if($this->visibility!='visible')
|
||
$this->SetVisibility('visible');
|
||
|
||
$family=$this->FontFamily;
|
||
$style=$this->FontStyle.($this->U ? 'U' : '').($this->S ? 'S' : '');
|
||
... | ... | |
}
|
||
|
||
// Tiling Patterns
|
||
$this->_out('___PAGE___START'.date('jY'));
|
||
$this->_out('___BACKGROUND___PATTERNS'.date('jY'));
|
||
$this->_out('___HEADER___MARKER'.date('jY'));
|
||
$this->_out('___PAGE___START'.$this->uniqstr);
|
||
$this->_out('___BACKGROUND___PATTERNS'.$this->uniqstr);
|
||
$this->_out('___HEADER___MARKER'.$this->uniqstr);
|
||
$this->pageBackgrounds = array();
|
||
|
||
//Set line cap style to square
|
||
... | ... | |
$this->ColorFlag=$cf;
|
||
$this->InFooter=false;
|
||
|
||
// mPDF 5.6.01 - LAYERS
|
||
if ($save_layer>0)
|
||
$this->BeginLayer($save_layer);
|
||
|
||
if($save_vis!='visible')
|
||
$this->SetVisibility($save_vis);
|
||
|
||
... | ... | |
$oldcolumn = $this->CurrCol;
|
||
// Automatic page break
|
||
// Allows PAGE-BREAK-AFTER = avoid to work
|
||
|
||
if (!$this->tableLevel && (($this->y+$this->divheight>$this->PageBreakTrigger) || ($this->y+$h>$this->PageBreakTrigger) ||
|
||
($this->y+($h*2)>$this->PageBreakTrigger && $this->blk[$this->blklvl]['page_break_after_avoid'])) and !$this->InFooter and $this->AcceptPageBreak()) {
|
||
($this->y+($h*2)+$this->blk[$this->blklvl]['padding_bottom']+$this->blk[$this->blklvl]['margin_bottom']>$this->PageBreakTrigger && $this->blk[$this->blklvl]['page_break_after_avoid'])) and !$this->InFooter and $this->AcceptPageBreak()) { // mPDF 5.7.2
|
||
$x=$this->x;//Current X position
|
||
|
||
|
||
... | ... | |
//Calculate baseline Superscript and Subscript Y coordinate adjustment
|
||
$bfx = $this->baselineC;
|
||
$baseline = $bfx*$bfs;
|
||
if($this->SUP) { $baseline += ($bfx-1.05)*$this->FontSize; }
|
||
else if($this->SUB) { $baseline += ($bfx + 0.04)*$this->FontSize; }
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
if($this->SUP) { $baseline -= $this->textparam['text-baseline']; } // mPDF 5.7.1
|
||
else if($this->SUB) { $baseline -= $this->textparam['text-baseline']; } // mPDF 5.7.1
|
||
else if($this->bullet) { $baseline += ($bfx-0.7)*$this->FontSize; }
|
||
|
||
// Vertical align (for Images)
|
||
... | ... | |
if($this->ColorFlag) $s .='q '.$this->TextColor.' ';
|
||
|
||
// OUTLINE
|
||
if($this->outline_on && !$this->S) {
|
||
if($this->textparam['outline-s'] && !$this->S) { // mPDF 5.6.07
|
||
$s .=' '.sprintf('%.3F w',$this->LineWidth*_MPDFK).' ';
|
||
$s .=" $this->DrawColor ";
|
||
$s .=" 2 Tr ";
|
||
... | ... | |
$tc = strtoupper($this->TextColor); // change 0 0 0 rg to 0 0 0 RG
|
||
if($this->FillColor!=$tc) { $s .= ' '.$tc.' '; } // stroke (outline) = same colour as text(fill)
|
||
}
|
||
else { $s .=" 0 Tr "; } // mPDF 5.6.07
|
||
|
||
if (strpos($this->ReqFontStyle,"I") !== false && strpos($this->FontStyle,"I") === false) { // Artificial italic
|
||
$aix = '1 0 0.261799 1 %.3F %.3F Tm ';
|
||
... | ... | |
}
|
||
// UNDERLINE
|
||
if($this->U) {
|
||
$c = strtoupper($this->TextColor); // change 0 0 0 rg to 0 0 0 RG
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
$c = $this->textparam['u-decoration']['color'];
|
||
if($this->FillColor!=$c) { $sub .= ' '.$c.' '; }
|
||
if (isset($this->CurrentFont['up'])) { $up=$this->CurrentFont['up']; }
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
$decorationfontkey = $this->textparam['u-decoration']['fontkey'];
|
||
$decorationfontsize = $this->textparam['u-decoration']['fontsize'];
|
||
if (isset($this->fonts[$decorationfontkey]['up'])) { $up=$this->fonts[$decorationfontkey]['up']; }
|
||
else { $up = -100; }
|
||
$adjusty = (-$up/1000* $this->FontSize);
|
||
if (isset($this->CurrentFont['ut'])) { $ut=$this->CurrentFont['ut']/1000* $this->FontSize; }
|
||
else { $ut = 60/1000* $this->FontSize; }
|
||
$adjusty = (-$up/1000* $decorationfontsize);
|
||
if (isset($this->fonts[$decorationfontkey]['ut'])) { $ut=$this->fonts[$decorationfontkey]['ut']/1000* $decorationfontsize; }
|
||
else { $ut = 60/1000* $decorationfontsize; }
|
||
$ubaseline = $this->baselineC*$bfs - $this->textparam['u-decoration']['baseline'];
|
||
$olw = $this->LineWidth;
|
||
$sub .=' '.(sprintf(' %.3F w 0 j 0 J ',$ut*_MPDFK));
|
||
$sub .=' '.$this->_dounderline($this->x+$dx,$this->y+$baseline+$va+$adjusty,$txt);
|
||
$sub .=' '.$this->_dounderline($this->x+$dx,$this->y+$ubaseline+$va+$adjusty,$txt,$OTLdata,$textvar);
|
||
$sub .=' '.(sprintf(' %.3F w 2 j 2 J ',$olw*_MPDFK));
|
||
if($this->FillColor!=$c) { $sub .= ' '.$this->FillColor.' '; }
|
||
}
|
||
|
||
// STRIKETHROUGH
|
||
if($this->strike) {
|
||
$c = strtoupper($this->TextColor); // change 0 0 0 rg to 0 0 0 RG
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
$c = $this->textparam['s-decoration']['color'];
|
||
if($this->FillColor!=$c) { $sub .= ' '.$c.' '; }
|
||
//Superscript and Subscript Y coordinate adjustment (now for striked-through texts)
|
||
if (isset($this->CurrentFont['desc']['CapHeight'])) { $ch=$this->CurrentFont['desc']['CapHeight']; }
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
$decorationfontkey = $this->textparam['s-decoration']['fontkey'];
|
||
$decorationfontsize = $this->textparam['s-decoration']['fontsize'];
|
||
//Superscript and Subscript Y coordinate adjustment (now for striked-through texts)
|
||
if (isset($this->fonts[$decorationfontkey]['desc']['CapHeight'])) { $ch=$this->fonts[$decorationfontkey]['desc']['CapHeight']; }
|
||
else { $ch = 700; }
|
||
$adjusty = (-$ch/1000* $this->FontSize) * 0.35;
|
||
if (isset($this->CurrentFont['ut'])) { $ut=$this->CurrentFont['ut']/1000* $this->FontSize; }
|
||
else { $ut = 60/1000* $this->FontSize; }
|
||
$adjusty = (-$ch/1000* $decorationfontsize) * $this->baselineS;
|
||
if (isset($this->fonts[$decorationfontkey]['ut'])) { $ut=$this->fonts[$decorationfontkey]['ut']/1000* $decorationfontsize; }
|
||
else { $ut = 60/1000* $decorationfontsize; }
|
||
$sbaseline = $this->baselineC*$bfs - $this->textparam['s-decoration']['baseline'];
|
||
$olw = $this->LineWidth;
|
||
$sub .=' '.(sprintf(' %.3F w 0 j 0 J ',$ut*_MPDFK));
|
||
$sub .=' '.$this->_dounderline($this->x+$dx,$this->y+$baseline+$va+$adjusty,$txt);
|
||
$sub .=' '.$this->_dounderline($this->x+$dx,$this->y+$sbaseline+$va+$adjusty,$txt,$OTLdata,$textvar);
|
||
$sub .=' '.(sprintf(' %.3F w 2 j 2 J ',$olw*_MPDFK));
|
||
if($this->FillColor!=$c) { $sub .= ' '.$this->FillColor.' '; }
|
||
}
|
||
... | ... | |
|
||
if (!$this->usingCoreFont) {
|
||
$checkCursive=false;
|
||
if ($this->biDirectional) { $checkCursive=true; } // *RTL*
|
||
if ($this->biDirectional) { $checkCursive=true; }
|
||
else if (isset($this->CurrentFont['indic']) && $this->CurrentFont['indic']) { $checkCursive=true; } // *INDIC*
|
||
while($i<$nb) {
|
||
//Get next character
|
||
... | ... | |
$saved[ 'SUB' ] = $this->SUB;
|
||
$saved[ 'linewidth' ] = $this->LineWidth;
|
||
$saved[ 'drawcolor' ] = $this->DrawColor;
|
||
$saved[ 'is_outline' ] = $this->outline_on;
|
||
$saved[ 'outlineparam' ] = $this->outlineparam;
|
||
$saved[ 'textparam' ] = $this->textparam;
|
||
$saved[ 'toupper' ] = $this->toupper;
|
||
$saved[ 'tolower' ] = $this->tolower;
|
||
$saved[ 'capitalize' ] = $this->capitalize;
|
||
... | ... | |
$saved[ 'border' ] = $this->spanborddet;
|
||
$saved[ 'color' ] = $this->TextColor;
|
||
$saved[ 'bgcolor' ] = $this->FillColor;
|
||
$saved['lang'] = $this->currentLang;
|
||
$saved['display_off'] = $this->inlineDisplayOff;
|
||
$saved[ 'lang' ] = $this->currentLang;
|
||
$saved[ 'display_off' ] = $this->inlineDisplayOff;
|
||
|
||
return $saved;
|
||
}
|
||
... | ... | |
$this->SUB = $saved[ 'SUB' ];
|
||
$this->LineWidth = $saved[ 'linewidth' ];
|
||
$this->DrawColor = $saved[ 'drawcolor' ];
|
||
$this->outline_on = $saved[ 'is_outline' ];
|
||
$this->outlineparam = $saved[ 'outlineparam' ];
|
||
$this->textparam = $saved[ 'textparam' ];
|
||
$this->inlineDisplayOff = $saved['display_off'];
|
||
|
||
$this->toupper = $saved[ 'toupper' ];
|
||
... | ... | |
$saved[ 'SUB' ] = $this->SUB;
|
||
$saved[ 'linewidth' ] = $this->LineWidth;
|
||
$saved[ 'drawcolor' ] = $this->DrawColor;
|
||
$saved[ 'is_outline' ] = $this->outline_on;
|
||
$saved[ 'outlineparam' ] = $this->outlineparam;
|
||
$saved[ 'textparam' ] = $this->textparam;
|
||
$saved[ 'ReqFontStyle' ] = $this->ReqFontStyle;
|
||
$saved[ 'fontkerning' ] = $this->kerning;
|
||
$saved[ 'fixedlSpacing' ] = $this->fixedlSpacing;
|
||
... | ... | |
$this->SUB = $saved[ 'SUB' ];
|
||
$this->LineWidth = $saved[ 'linewidth' ];
|
||
$this->DrawColor = $saved[ 'drawcolor' ];
|
||
$this->outline_on = $saved[ 'is_outline' ];
|
||
$this->outlineparam = $saved[ 'outlineparam' ];
|
||
$this->textparam = $saved[ 'textparam' ];
|
||
if ($write) {
|
||
$this->SetFont($saved[ 'family' ],$saved[ 'style' ].($this->U ? 'U' : '').($this->S ? 'S' : ''),$saved[ 'sizePt' ],true,true); // force output
|
||
$fontout = (sprintf('BT /F%d %.3F Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
|
||
... | ... | |
$fill = 0;
|
||
}
|
||
|
||
$hanger = ''; // mPDF 5.6.40
|
||
|
||
// Always right trim!
|
||
// Right trim content and adjust width if need to justify (later)
|
||
if (isset($content[count($content)-1]) && preg_match('/[ ]+$/',$content[count($content)-1], $m)) {
|
||
... | ... | |
$mba = max($mba, $oh);
|
||
}
|
||
}
|
||
// mPDF 5.7.3 inline text-decoration parameters
|
||
else if (!$is_table && isset($font[$k]['textparam']['text-baseline'])) {
|
||
if ($font[$k]['textparam']['text-baseline'] > 0) { // superscript
|
||
$nh = ($maxfontsize * $this->baselineC) + $font[$k]['textparam']['text-baseline'] + ($font[$k]['size'] * (1-$this->baselineC));
|
||
if ($lhfixed && $nh > $def_fontsize) { $this->forceExactLineheight = false; }
|
||
$af = max($af, ($nh-$maxfontsize));
|
||
}
|
||
else if ($font[$k]['textparam']['text-baseline'] < 0) { // subscript
|
||
$nh = ($maxfontsize * (1-$this->baselineC)) - $font[$k]['textparam']['text-baseline'] + ($font[$k]['size'] * $this->baselineC);
|
||
if ($lhfixed && $nh > $def_fontsize) { $this->forceExactLineheight = false; }
|
||
$bf = max($bf, ($nh-$maxfontsize));
|
||
}
|
||
}
|
||
}
|
||
if ((!$lhfixed || !$this->forceExactLineheight) && ($af > (($maxlineHeight - $maxfontsize)/2) || $bf > (($maxlineHeight - $maxfontsize)/2))) {
|
||
$maxlineHeight = $maxfontsize + $af + $bf;
|
||
... | ... | |
if ($newblock && ($blockstate==1 || $blockstate==3) && $lineCount == 0 && !$is_table && !$is_list) {
|
||
$this->blk[$this->blklvl]['y0'] = $this->y;
|
||
$this->blk[$this->blklvl]['startpage'] = $this->page;
|
||
if ($this->blk[$this->blklvl]['float']) { $this->blk[$this->blklvl]['float_start_y'] = $this->y; } // mPDF 5.6.63
|
||
if ($this->ColActive) { $this->breakpoints[$this->CurrCol][] = $this->y; } // *COLUMNS*
|
||
}
|
||
|
||
// ADDED for Paragraph_indent
|
||
// Paragraph INDENT
|
||
$WidthCorrection = 0;
|
||
if (($newblock) && ($blockstate==1 || $blockstate==3) && isset($this->blk[$this->blklvl]['text_indent']) && ($lineCount == 0) && (!$is_table) && (!$is_list) && ($align != 'C')) {
|
||
$ti = $this->ConvertSize($this->blk[$this->blklvl]['text_indent'],$this->blk[$this->blklvl]['inner_width'],$this->FontSize,false);
|
||
$ti = $this->ConvertSize($this->blk[$this->blklvl]['text_indent'],$this->blk[$this->blklvl]['inner_width'],$this->blk[$this->blklvl]['InlineProperties']['size'],false);
|
||
$WidthCorrection = ($ti*_MPDFK);
|
||
}
|
||
|
||
... | ... | |
if ($content) {
|
||
|
||
// In FinishFlowing Block no lines are justified as it is always last line
|
||
// but if orphansAllowed have allowed content width to go over max width, use J charspacing to compress line
|
||
// but if CJKorphan has allowed content width to go over max width, use J charspacing to compress line
|
||
// JUSTIFICATION J - NOT!
|
||
$nb_carac = 0;
|
||
$nb_spaces = 0;
|
||
$jcharspacing = 0;
|
||
$jws = 0;
|
||
$inclCursive=false;
|
||
$dottab = false; // mPDF 5.6.19
|
||
foreach ( $content as $k => $chunk ) {
|
||
if (!isset($this->objectbuffer[$k]) || (isset($this->objectbuffer[$k]) && !$this->objectbuffer[$k])) {
|
||
if ($this->usingCoreFont) {
|
||
... | ... | |
if (preg_match("/([".$this->pregHIchars.$this->pregBNchars.$this->pregPAchars."])/u", $chunk)) { $inclCursive = true; } // *INDIC*
|
||
}
|
||
}
|
||
else if ($this->objectbuffer[$k]['type']=='dottab') { $dottab = $this->objectbuffer[$k]['outdent']; } // mPDF 5.6.19
|
||
}
|
||
// if it's justified, we need to find the char/word spacing (or if orphans have allowed length of line to go over the maxwidth)
|
||
// If "orphans" in fact is just a final space - ignore this
|
||
if (((($contentWidth + $lastitalic) > $maxWidth) && ($content[count($content)-1] != ' ') ) ||
|
||
(!$endofblock && $align=='J' && ($next=='image' || $next=='select' || $next=='input' || $next=='textarea' || ($next=='br' && $this->justifyB4br)))
|
||
) {
|
||
// mPDF 5.6.40
|
||
$lastchar = mb_substr($content[(count($content)-1)],mb_strlen($content[(count($content)-1)], $this->mb_enc)-1, 1, $this->mb_enc);
|
||
if (preg_match("/[".$this->CJKoverflow."]/u", $lastchar)) { $CJKoverflow = true; }
|
||
else {$CJKoverflow = false; }
|
||
if ((((($contentWidth + $lastitalic) > $maxWidth) && ($content[count($content)-1] != ' ') ) ||
|
||
(!$endofblock && $align=='J' && ($next=='image' || $next=='select' || $next=='input' || $next=='textarea' || ($next=='br' && $this->justifyB4br)))) && !($CJKoverflow && $this->allowCJKoverflow) ) { // mPDF 5.6.40
|
||
// WORD SPACING
|
||
list($jcharspacing,$jws) = $this->GetJspacing($nb_carac,$nb_spaces,($maxWidth-$lastitalic-$contentWidth-$WidthCorrection-(($this->cMarginL+$this->cMarginR)*_MPDFK)-($paddingL+$paddingR +(($fpaddingL + $fpaddingR) * _MPDFK) )),$inclCursive);
|
||
}
|
||
/*-- CJK-FONTS --*/
|
||
// mPDF 5.6.40
|
||
else if ($this->checkCJK && $align=='J' && $CJKoverflow && $this->allowCJKoverflow && $this->CJKforceend) {
|
||
// force-end overhang
|
||
$hanger = mb_substr($content[count($content)-1],mb_strlen($content[count($content)-1],$this->mb_enc)-1,1,$this->mb_enc );
|
||
if (preg_match("/[".$this->CJKoverflow."]/u", $hanger)) {
|
||
$content[count($content)-1] = mb_substr($content[count($content)-1],0,mb_strlen($content[count($content)-1],$this->mb_enc)-1,$this->mb_enc );
|
||
$this->restoreFont( $font[ count($content)-1 ],false );
|
||
$contentWidth -= $this->GetStringWidth($hanger) * _MPDFK;
|
||
$nb_carac -= 1;
|
||
list($jcharspacing,$jws) = $this->GetJspacing($nb_carac,$nb_spaces,($maxWidth-$lastitalic-$contentWidth-$WidthCorrection-(($this->cMarginL+$this->cMarginR)*_MPDFK)-($paddingL+$paddingR +(($fpaddingL + $fpaddingR) * _MPDFK) )),$inclCursive);
|
||
}
|
||
}
|
||
/*-- END CJK-FONTS --*/
|
||
|
||
// Check if will fit at word/char spacing of previous line - if so continue it
|
||
// but only allow a maximum of $this->jSmaxWordLast and $this->jSmaxCharLast
|
||
else if ($contentWidth < ($maxWidth - $lastitalic-$WidthCorrection - (($this->cMarginL+$this->cMarginR)* _MPDFK) - ($paddingL+$paddingR +(($fpaddingL + $fpaddingR) * _MPDFK))) && !$this->fixedlSpacing) {
|
||
... | ... | |
/*-- END RTL --*/
|
||
|
||
$this->x = $currentx + $this->cMarginL + $ipaddingL + $fpaddingL;
|
||
if ($align == 'R') { $this->x += $empty; }
|
||
if ($dottab !== false && $blockdir=='rtl') { $this->x -= $dottab; } // mPDF 5.6.19
|
||
else if ($align == 'R') { $this->x += $empty; }
|
||
else if ($align == 'J' && $blockdir == 'rtl') { $this->x += $empty; }
|
||
else if ($align == 'C') { $this->x += ($empty / 2); }
|
||
|
||
|
||
// Paragraph INDENT
|
||
$WidthCorrection = 0;
|
||
if (($newblock) && ($blockstate==1 || $blockstate==3) && isset($this->blk[$this->blklvl]['text_indent']) && ($lineCount == 0) && (!$is_table) && (!$is_list) && ($align !='C')) {
|
||
$ti = $this->ConvertSize($this->blk[$this->blklvl]['text_indent'],$this->blk[$this->blklvl]['inner_width'],$this->FontSize,false);
|
||
$ti = $this->ConvertSize($this->blk[$this->blklvl]['text_indent'],$this->blk[$this->blklvl]['inner_width'],$this->blk[$this->blklvl]['InlineProperties']['size'],false);
|
||
$this->x += $ti;
|
||
}
|
||
|
||
... | ... | |
}
|
||
|
||
|
||
|
||
// DIRECTIONALITY RTL
|
||
if ((($blockdir == 'rtl') && ($contains_rtl )) || $all_rtl ) { $this->restoreFont( $font[ $arraysize-1 - $k ] ); }
|
||
else { $this->restoreFont( $font[ $k ] ); }
|
||
|
||
// mPDF 5.6.13 Decimal alignment - set in _tableWrite
|
||
if ($is_table && substr($align,0,1)=='D' && $k==0 ) {
|
||
$dp = $this->decimal_align[substr($align,0,2)];
|
||
$s = preg_split('/'.preg_quote($dp,'/').'/', $content[0], 2); // ? needs to be /u if not core
|
||
$s0 = $this->GetStringWidth($s[0], false);
|
||
$this->x += ($this->decimal_offset - $s0);
|
||
}
|
||
|
||
$this->SetSpacing(($this->fixedlSpacing*_MPDFK)+$jcharspacing,($this->fixedlSpacing+$this->minwSpacing)*_MPDFK+$jws);
|
||
$this->fixedlSpacing = false;
|
||
$this->minwSpacing = 0;
|
||
|
||
// mPDF 5.6.26
|
||
$save_vis = $this->visibility;
|
||
if (isset($this->textparam['visibility']) && $this->textparam['visibility'] && $this->textparam['visibility'] != $this->visibility) {
|
||
$this->SetVisibility($this->textparam['visibility']);
|
||
}
|
||
|
||
// *********** SPAN BACKGROUND COLOR ***************** //
|
||
if (isset($this->spanbgcolor) && $this->spanbgcolor) {
|
||
$cor = $this->spanbgcolorarray;
|
||
... | ... | |
if (isset($this->objectbuffer[$dirk])) {
|
||
if ($this->objectbuffer[$dirk]['type']=='dottab') {
|
||
$this->objectbuffer[$dirk]['OUTER-WIDTH'] +=$empty;
|
||
$this->objectbuffer[$dirk]['OUTER-WIDTH'] +=$this->objectbuffer[$dirk]['outdent']; // mPDF 5.6.19
|
||
}
|
||
$stringWidth = $this->objectbuffer[$dirk]['OUTER-WIDTH'];
|
||
}
|
||
|
||
if ($stringWidth==0) { $stringWidth = 0.000001; }
|
||
if ($k == $arraysize-1) $this->Cell( $stringWidth, $lineHeight, $chunk, '', 1, '', $fill, $this->HREF , $currentx,0,0,'M', $fill, $af, $bf, true ); //mono-style line or last part (skips line)
|
||
if ($k == $arraysize-1) {
|
||
// mPDF 5.6.40
|
||
if ($this->checkCJK && $CJKoverflow && $align=='J' && $this->allowCJKoverflow && $hanger && $this->CJKforceend) {
|
||
// force-end overhang
|
||
$this->Cell( $stringWidth, $lineHeight, $chunk, '', 0, '', $fill, $this->HREF, $currentx,0,0,'M', $fill, $af, $bf, true );
|
||
$this->Cell( $this->GetStringWidth($hanger), $lineHeight, $hanger, '', 1, '', $fill, $this->HREF, $currentx,0,0,'M', $fill, $af, $bf, true );
|
||
}
|
||
else {
|
||
$this->Cell( $stringWidth, $lineHeight, $chunk, '', 1, '', $fill, $this->HREF, $currentx,0,0,'M', $fill, $af, $bf, true );
|
||
}
|
||
}
|
||
else $this->Cell( $stringWidth, $lineHeight, $chunk, '', 0, '', $fill, $this->HREF, 0, 0,0,'M', $fill, $af, $bf, true );//first or middle part
|
||
|
||
|
||
if (!empty($this->spanborddet)) {
|
||
if (strpos($contentB[$k],'R')!==false && $k != $arraysize-1) $this->x += $this->spanborddet['R']['w'];
|
||
}
|
||
... | ... | |
$fill = $save_fill; $spanfill = 0;
|
||
if ($fill) { $this->SetFColor($bcor); }
|
||
}
|
||
// mPDF 5.6.26
|
||
if (isset($this->textparam['visibility']) && $this->textparam['visibility'] && $this->visibility != $save_vis) {
|
||
$this->SetVisibility($save_vis);
|
||
}
|
||
|
||
}
|
||
|
||
$this->printobjectbuffer($is_table, $blockdir);
|
||
|
||
|
||
$this->objectbuffer = array();
|
||
|
||
|
||
$this->ResetSpacing();
|
||
|
||
/*-- LISTS --*/
|
||
... | ... | |
$this->x = $currentx;
|
||
if (isset($bull['x'])) { $this->x += $bull['x']; }
|
||
$this->y -= $lineHeight;
|
||
if (is_array($bull['col'])) { $this->SetTColor($bull['col']); }
|
||
if (isset($bull['col']) && $bull['col']) { $this->SetTColor($bull['col']); } // mPDF 5.6.67
|
||
|
||
if (isset($bull['txt'])) { $this->Cell($bull['w'], $lineHeight,$bull['txt'],'','',$bull['align'],0,'',0,-$this->cMarginL, -$this->cMarginR ); }
|
||
if (isset($bull['font']) && $bull['font'] == 'czapfdingbats') {
|
||
... | ... | |
}
|
||
// IMAGE
|
||
if ($objattr['type'] == 'image') {
|
||
// mPDF 5.7.3 TRANSFORMS
|
||
if (isset($objattr['transform'])) {
|
||
$this->_out("\n".'% BTR'); // Begin Transform
|
||
}
|
||
if (isset($objattr['z-index']) && $objattr['z-index'] > 0 && $this->currentlayer==0) {
|
||
$this->BeginLayer($objattr['z-index']);
|
||
}
|
||
if(isset($objattr['visibility']) && $objattr['visibility']!='visible' && $objattr['visibility']) {
|
||
$this->SetVisibility($objattr['visibility']);
|
||
}
|
||
... | ... | |
if ($tr) { $tr .= ' '; }
|
||
$gradmask = '';
|
||
|
||
// mPDF 5.7.3 TRANSFORMS
|
||
$tr2 = '';
|
||
if (isset($objattr['transform'])) {
|
||
$maxsize_x = $w;
|
||
$maxsize_y = $h;
|
||
$cx = $x + $w/2;
|
||
$cy = $y + $h/2;
|
||
preg_match_all('/(translatex|translatey|translate|scalex|scaley|scale|rotate|skewX|skewY|skew)\((.*?)\)/is',$objattr['transform'],$m);
|
||
if (count($m[0])) {
|
||
for($i=0; $i<count($m[0]); $i++) {
|
||
$c = strtolower($m[1][$i]);
|
||
$v = trim($m[2][$i]);
|
||
$vv = preg_split('/[ ,]+/',$v);
|
||
if ($c=='translate' && count($vv)) {
|
||
$translate_x = $this->ConvertSize($vv[0],$maxsize_x,false,false);
|
||
if (count($vv)==2) { $translate_y = $this->ConvertSize($vv[1],$maxsize_y,false,false); }
|
||
else { $translate_y = 0; }
|
||
$tr2 .= $this->transformTranslate($translate_x, $translate_y, true).' ';
|
||
}
|
||
else if ($c=='translatex' && count($vv)) {
|
||
$translate_x = $this->ConvertSize($vv[0],$maxsize_x,false,false);
|
||
$tr2 .= $this->transformTranslate($translate_x, 0, true).' ';
|
||
}
|
||
else if ($c=='translatey' && count($vv)) {
|
||
$translate_y = $this->ConvertSize($vv[1],$maxsize_y,false,false);
|
||
$tr2 .= $this->transformTranslate(0, $translate_y, true).' ';
|
||
}
|
||
else if ($c=='scale' && count($vv)) {
|
||
$scale_x = $vv[0] * 100;
|
||
if (count($vv)==2) { $scale_y = $vv[1] * 100; }
|
||
else { $scale_y = $scale_x; }
|
||
$tr2 .= $this->transformScale($scale_x, $scale_y, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='scalex' && count($vv)) {
|
||
$scale_x = $vv[0] * 100;
|
||
$tr2 .= $this->transformScale($scale_x, 0, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='scaley' && count($vv)) {
|
||
$scale_y = $vv[1] * 100;
|
||
$tr2 .= $this->transformScale(0, $scale_y, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='skew' && count($vv)) {
|
||
$angle_x = $this->ConvertAngle($vv[0], false);
|
||
if (count($vv)==2) { $angle_y = $this->ConvertAngle($vv[1], false); }
|
||
else { $angle_y = 0; }
|
||
$tr2 .= $this->transformSkew($angle_x, $angle_y, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='skewx' && count($vv)) {
|
||
$angle = $this->ConvertAngle($vv[0], false);
|
||
$tr2 .= $this->transformSkew($angle, 0, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='skewy' && count($vv)) {
|
||
$angle = $this->ConvertAngle($vv[0], false);
|
||
$tr2 .= $this->transformSkew(0, $angle, $cx, $cy, true).' ';
|
||
}
|
||
else if ($c=='rotate' && count($vv)) {
|
||
$angle = $this->ConvertAngle($vv[0]);
|
||
$tr2 .= $this->transformRotate($angle, $cx, $cy, true).' ';
|
||
}
|
||
}
|
||
}
|
||
}
|
||
// mPDF 5.7.3 TRANSFORMS / BACKGROUND COLOR
|
||
// Transform also affects image background
|
||
if ($tr2) { $this->_out('q '.$tr2.' '); }
|
||
if (isset($objattr['bgcolor']) && $objattr['bgcolor']) {
|
||
$bgcol = $objattr['bgcolor'];
|
||
$this->SetFColor($bgcol);
|
||
$this->Rect($x,$y,$w,$h, 'F');
|
||
$this->SetFColor($this->ConvertColor(255));
|
||
}
|
||
if ($tr2) { $this->_out('Q'); }
|
||
|
||
/*-- BACKGROUNDS --*/
|
||
if (isset($objattr['GRADIENT-MASK'])) {
|
||
... | ... | |
/*-- END BACKGROUNDS --*/
|
||
/*-- IMAGES-WMF --*/
|
||
if (isset($objattr['itype']) && $objattr['itype']=='wmf') {
|
||
$outstring = sprintf('q '.$tr.'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr['INNER-X']*_MPDFK-$sx*$objattr['wmf_x'], (($this->h-$objattr['INNER-Y'])*_MPDFK)+$sy*$objattr['wmf_y'], $objattr['ID']);
|
||
$outstring = sprintf('q '.$tr.$tr2.'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr['INNER-X']*_MPDFK-$sx*$objattr['wmf_x'], (($this->h-$objattr['INNER-Y'])*_MPDFK)+$sy*$objattr['wmf_y'], $objattr['ID']); // mPDF 5.7.3 TRANSFORMS
|
||
}
|
||
else
|
||
/*-- END IMAGES-WMF --*/
|
||
if (isset($objattr['itype']) && $objattr['itype']=='svg') {
|
||
$outstring = sprintf('q '.$tr.'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr['INNER-X']*_MPDFK-$sx*$objattr['wmf_x'], (($this->h-$objattr['INNER-Y'])*_MPDFK)+$sy*$objattr['wmf_y'], $objattr['ID']);
|
||
$outstring = sprintf('q '.$tr.$tr2.'%.3F 0 0 %.3F %.3F %.3F cm /FO%d Do Q', $sx, -$sy, $objattr['INNER-X']*_MPDFK-$sx*$objattr['wmf_x'], (($this->h-$objattr['INNER-Y'])*_MPDFK)+$sy*$objattr['wmf_y'], $objattr['ID']); // mPDF 5.7.3 TRANSFORMS
|
||
}
|
||
else {
|
||
$outstring = sprintf("q ".$tr."%.3F 0 0 %.3F %.3F %.3F cm ".$gradmask."/I%d Do Q",$obiw*_MPDFK, $obih*_MPDFK, $objattr['INNER-X'] *_MPDFK, ($this->h-($objattr['INNER-Y'] +$obih ))*_MPDFK,$objattr['ID'] );
|
||
$outstring = sprintf("q ".$tr.$tr2."%.3F 0 0 %.3F %.3F %.3F cm ".$gradmask."/I%d Do Q",$obiw*_MPDFK, $obih*_MPDFK, $objattr['INNER-X'] *_MPDFK, ($this->h-($objattr['INNER-Y'] +$obih ))*_MPDFK,$objattr['ID'] ); // mPDF 5.7.3 TRANSFORMS
|
||
}
|
||
$this->_out($outstring);
|
||
// LINK
|
||
if (isset($objattr['link'])) $this->Link($objattr['INNER-X'],$objattr['INNER-Y'],$objattr['INNER-WIDTH'],$objattr['INNER-HEIGHT'],$objattr['link']);
|
||
if (isset($objattr['opacity'])) { $this->SetAlpha(1); }
|
||
|
||
// mPDF 5.7.3 TRANSFORMS
|
||
// Transform also affects image borders
|
||
if ($tr2) { $this->_out('q '.$tr2.' '); }
|
||
if ((isset($objattr['border_top']) && $objattr['border_top']>0) || (isset($objattr['border_left']) && $objattr['border_left']>0) || (isset($objattr['border_right']) && $objattr['border_right']>0) || (isset($objattr['border_bottom']) && $objattr['border_bottom']>0)) { $this->PaintImgBorder($objattr,$is_table); }
|
||
if ($tr2) { $this->_out('Q'); }
|
||
|
||
if(isset($objattr['visibility']) && $objattr['visibility']!='visible' && $objattr['visibility']) {
|
||
$this->SetVisibility('visible');
|
||
}
|
||
|
||
if (isset($objattr['z-index']) && $objattr['z-index'] > 0 && $this->currentlayer==0) {
|
||
$this->EndLayer();
|
||
}
|
||
// mPDF 5.7.3 TRANSFORMS
|
||
if (isset($objattr['transform'])) {
|
||
$this->_out("\n".'% ETR'); // Begin Transform
|
||
}
|
||
}
|
||
|
||
/*-- BARCODES --*/
|
||
... | ... | |
|
||
// DOT-TAB
|
||
if ($objattr['type'] == 'dottab') {
|
||
// mPDF 5.6.19
|
||
if (isset($objattr['fontfamily'])) { $this->SetFont($objattr['fontfamily'],'',$objattr['fontsize'] ); }
|
||
$sp = $this->GetStringWidth(' ');
|
||
$nb=floor(($w-2*$sp)/$this->GetStringWidth('.'));
|
||
if ($nb>0) { $dots=' '.str_repeat('.',$nb).' '; }
|
||
else { $dots=' '; }
|
||
$col = $this->ConvertColor(0);
|
||
if (isset($objattr['colorarray']) && is_array($objattr['colorarray'])) {
|
||
if (isset($objattr['colorarray']) && ($objattr['colorarray'])) { // mPDF 5.6.19
|
||
$col = $objattr['colorarray'];
|
||
}
|
||
$this->SetTColor($col);
|
||
$save_dh = $this->divheight; // mPDF 5.6.19
|
||
$save_sbd = $this->spanborddet;
|
||
$save_u = $this->U;
|
||
$save_s = $this->strike;
|
||
$this->spanborddet = '';
|
||
$this->divheight = 0; // mPDF 5.6.19
|
||
$this->U = false;
|
||
$this->strike = false;
|
||
$this->Cell($w,$h,$dots,0,0,'C');
|
||
$this->spanborddet = $save_sbd;
|
||
$this->U = $save_u;
|
||
$this->strike = $save_s;
|
||
$this->divheight = $save_dh; // mPDF 5.6.19
|
||
// mPDF 5.0
|
||
$this->SetTColor($this->ConvertColor(0));
|
||
}
|
||
... | ... | |
// where the line should be cutoff if it is to be justified
|
||
$cutoffWidth = $contentWidth;
|
||
|
||
$curlyquote = mb_convert_encoding("\xe2\x80\x9e",$this->mb_enc,'UTF-8');
|
||
$curlylowquote = mb_convert_encoding("\xe2\x80\x9d",$this->mb_enc,'UTF-8');
|
||
// mPDF 5.5.07
|
||
$raquote = mb_convert_encoding("\xc2\xbb",$this->mb_enc,'UTF-8'); //» »
|
||
// mPDF 5.5.20
|
||
$rsquo = mb_convert_encoding("\xe2\x80\x99",$this->mb_enc,'UTF-8'); //’ ’
|
||
$sbquo = mb_convert_encoding("\xe2\x80\x9a",$this->mb_enc,'UTF-8'); //‚ ‚
|
||
$bdquo = mb_convert_encoding("\xe2\x80\xba",$this->mb_enc,'UTF-8'); //„ „
|
||
|
||
$CJKoverflow = false;
|
||
$hanger = ''; // mPDF 5.6.40
|
||
|
||
// COLS
|
||
$oldcolumn = $this->CurrCol;
|
||
... | ... | |
$tmp = mb_strlen( $s, $this->mb_enc );
|
||
}
|
||
|
||
$orphs = 0;
|
||
$check = 0;
|
||
|
||
// for every character in the string
|
||
for ( $i = 0; $i < $tmp; $i++ ) {
|
||
// extract the current character
|
||
... | ... | |
$cw += $rbw*_MPDFK;
|
||
$contentB[(count($contentB)-1)] .= 'R';
|
||
}
|
||
|
||
if ($c==' ') { $check = 1; }
|
||
|
||
// CHECK for ORPHANS
|
||
else if ($c=='.' || $c==',' || $c==')' || $c==']' || $c==';' || $c==':' || $c=='!' || $c=='?'|| $c=='"' || $c==$curlyquote || $c==$curlylowquote || $c==$raquote || $c==$rsquo || $c==$sbquo || $c==$bdquo ) {$check++; } // mPDF 5.5.07 mPDF 5.5.20
|
||
/*-- CJK-FONTS --*/
|
||
else if ($this->checkCJK) {
|
||
if ((!$is_table && $this->CJKfollowing && preg_match("/[".$this->CJKfollowing."]/u", $c)) || ($is_table && preg_match("/[".$this->CJKoverflow ."]/u", $c))) { $check++; }
|
||
else { $check = 0; }
|
||
}
|
||
/*-- END CJK-FONTS --*/
|
||
else { $check = 0; }
|
||
|
||
// There's an orphan '. ' or ', ' or <sup>32</sup> about to be cut off at the end of line
|
||
if($check==1) {
|
||
$currContent .= $c;
|
||
$cutoffWidth = $contentWidth;
|
||
$contentWidth += $cw;
|
Také k dispozici: Unified diff
Release 1.1.8