mirror of
https://github.com/moparisthebest/wallabag
synced 2024-11-30 12:52:24 -05:00
updated mpdf to 5.7.2
This commit is contained in:
parent
fb9df0c269
commit
d07abb5c42
@ -871,6 +871,7 @@ class PDFBarcode {
|
||||
* Very capable code, excellent density, high reliability; in very wide use world-wide
|
||||
*/
|
||||
protected function barcode_c128($code, $type='B', $ean=false) {
|
||||
$code = strcode2utf($code); // mPDF 5.7.1 Allows e.g. <barcode code="5432
1068" type="C128A" />
|
||||
$chr = array(
|
||||
'212222', /* 00 */
|
||||
'222122', /* 01 */
|
||||
|
10
inc/3rdparty/libraries/mpdf/classes/cssmgr.php
vendored
10
inc/3rdparty/libraries/mpdf/classes/cssmgr.php
vendored
@ -221,9 +221,8 @@ function ReadCSS($html) {
|
||||
}
|
||||
}
|
||||
|
||||
// mPDF 5.5.13
|
||||
// Replace any background: url(data:image... with temporary image file reference
|
||||
preg_match_all("/(url\(data:image\/(jpeg|gif|png);base64,(.*)\))/si", $CSSstr, $idata);
|
||||
preg_match_all("/(url\(data:image\/(jpeg|gif|png);base64,(.*?)\))/si", $CSSstr, $idata); // mPDF 5.7.2
|
||||
if (count($idata[0])) {
|
||||
for($i=0;$i<count($idata[0]);$i++) {
|
||||
$file = _MPDF_TEMP_PATH.'_tempCSSidata'.RAND(1,10000).'_'.$i.'.'.$idata[2][$i];
|
||||
@ -699,6 +698,13 @@ function fixCSS($prop) {
|
||||
}
|
||||
else { $newprop[$k] = $v; }
|
||||
}
|
||||
else if ($k == 'LIST-STYLE') { // mPDF 5.7.2
|
||||
if (preg_match('/(lower-roman|upper-roman|lower-latin|lower-alpha|upper-latin|upper-alpha|none|decimal|disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao)/i',$v,$m)
|
||||
|| preg_match('/U\+([a-fA-F0-9]+)/i',$v,$m)) {
|
||||
$newprop['LIST-STYLE-TYPE'] = strtolower(trim($m[1]));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else {
|
||||
$newprop[$k] = $v;
|
||||
|
333
inc/3rdparty/libraries/mpdf/classes/svg.php
vendored
333
inc/3rdparty/libraries/mpdf/classes/svg.php
vendored
@ -808,13 +808,20 @@ $md = $sy * cos($t);
|
||||
}
|
||||
|
||||
if (isset($critere_style['style'])){
|
||||
if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/',$critere_style['style'], $m)) {
|
||||
if (preg_match('/fill:\s*rgb\((\d+),\s*(\d+),\s*(\d+)\)/i',$critere_style['style'], $m)) { // mPDF 5.7.2
|
||||
$current_style['fill'] = '#'.str_pad(dechex($m[1]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[2]), 2, "0", STR_PAD_LEFT).str_pad(dechex($m[3]), 2, "0", STR_PAD_LEFT);
|
||||
}
|
||||
else { $tmp = preg_replace("/(.*)fill:\s*([a-z0-9#_()]*|none)(.*)/i","$2",$critere_style['style']); // mPDF 4.4.003
|
||||
if ($tmp != $critere_style['style']){ $current_style['fill'] = $tmp; }
|
||||
}
|
||||
|
||||
// mPDF 5.7.2
|
||||
if (preg_match("/[^-]opacity:\s*([a-z0-9.]*|none)/i",$critere_style['style'], $m) ||
|
||||
preg_match("/^opacity:\s*([a-z0-9.]*|none)/i",$critere_style['style'], $m)) {
|
||||
$current_style['fill-opacity'] = $m[1];
|
||||
$current_style['stroke-opacity'] = $m[1];
|
||||
}
|
||||
|
||||
$tmp = preg_replace("/(.*)fill-opacity:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
||||
if ($tmp != $critere_style['style']){ $current_style['fill-opacity'] = $tmp;}
|
||||
|
||||
@ -852,6 +859,12 @@ $md = $sy * cos($t);
|
||||
if ($tmp != $critere_style['style']){ $current_style['stroke-dashoffset'] = $tmp;}
|
||||
|
||||
}
|
||||
// mPDF 5.7.2
|
||||
if(isset($critere_style['opacity'])){
|
||||
$current_style['fill-opacity'] = $critere_style['opacity'];
|
||||
$current_style['stroke-opacity'] = $critere_style['opacity'];
|
||||
}
|
||||
|
||||
if(isset($critere_style['fill'])){
|
||||
$current_style['fill'] = $critere_style['fill'];
|
||||
}
|
||||
@ -909,7 +922,7 @@ $md = $sy * cos($t);
|
||||
// Cette fonction ecrit le style dans le stream svg.
|
||||
function svgStyle($critere_style, $attribs, $element){
|
||||
$path_style = '';
|
||||
if (substr_count($critere_style['fill'],'url')>0){
|
||||
if (substr_count($critere_style['fill'],'url')>0 && $element != 'line'){
|
||||
//
|
||||
// couleur degradé
|
||||
$id_gradient = preg_replace("/url\(#([\w_]*)\)/i","$1",$critere_style['fill']);
|
||||
@ -926,7 +939,7 @@ $md = $sy * cos($t);
|
||||
|
||||
}
|
||||
// mPDF 4.4.005 Used as indirect setting for currentColor
|
||||
else if (strtolower($critere_style['fill']) == 'currentcolor'){
|
||||
else if (strtolower($critere_style['fill']) == 'currentcolor' && $element != 'line'){
|
||||
$col = $this->mpdf_ref->ConvertColor($critere_style['color']);
|
||||
if ($col) {
|
||||
// mPDF 5.0.051
|
||||
@ -937,7 +950,7 @@ $md = $sy * cos($t);
|
||||
$style .= 'F';
|
||||
}
|
||||
}
|
||||
else if ($critere_style['fill'] != 'none'){
|
||||
else if ($critere_style['fill'] != 'none' && $element != 'line'){
|
||||
$col = $this->mpdf_ref->ConvertColor($critere_style['fill']);
|
||||
if ($col) {
|
||||
// mPDF 5.0.051
|
||||
@ -1898,12 +1911,10 @@ function Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag)
|
||||
$xbase = $x;
|
||||
$ybase = -$y;
|
||||
|
||||
// mPDF 5.0.041
|
||||
// mPDF 5.0.051
|
||||
$path_cmd = sprintf('q BT /F%d %s %.3F Tf %.3F %.3F Td %s Tr %s %s %s Tj ET Q ',$this->mpdf_ref->CurrentFont['i'],$opacitystr, $this->mpdf_ref->FontSizePt,$pdfx*$this->kp,$pdfy*$this->kp,$render,$fillstr,$strokestr,$txt)."\n";
|
||||
// mPDF 5.7.2
|
||||
$path_cmd = sprintf('q BT /F%d %.3F Tf %s %.3F %.3F Td %s Tr %s %s %s Tj ET Q ',$this->mpdf_ref->CurrentFont['i'], $this->mpdf_ref->FontSizePt, $opacitystr, $pdfx*$this->kp,$pdfy*$this->kp,$render,$fillstr,$strokestr,$txt)."\n";
|
||||
unset($this->txt_data[0], $this->txt_data[1],$this->txt_data[2]);
|
||||
|
||||
// mPDF 5.4.12
|
||||
if (isset($current_style['font-size-parent'])) {
|
||||
$this->mpdf_ref->SetFontSize($current_style['font-size-parent']);
|
||||
}
|
||||
@ -1912,7 +1923,6 @@ function Arcto($x1, $y1, $x2, $y2, $rx, $ry, $angle, $largeArcFlag, $sweepFlag)
|
||||
{
|
||||
return ' ';
|
||||
}
|
||||
// $path_cmd .= 'h '; // mPDF 5.0
|
||||
return $path_cmd;
|
||||
}
|
||||
|
||||
@ -1964,8 +1974,8 @@ function svgDefineTxtStyle($critere_style)
|
||||
$tmp = preg_replace("/(.*)stroke-dashoffset:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
||||
if ($tmp != $critere_style['style']){ $current_style['stroke-dashoffset'] = $tmp;}
|
||||
|
||||
// mPDF 5.0.039
|
||||
$tmp = preg_replace("/(.*)font-family:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
||||
// mPDF 5.7.2
|
||||
$tmp = preg_replace("/(.*)font-family:\s*([a-z0-9.\"' ,\-]*|none)(.*)/i","$2",$critere_style['style']);
|
||||
if ($tmp != $critere_style['style']){ $critere_style['font-family'] = $tmp;}
|
||||
|
||||
$tmp = preg_replace("/(.*)font-size:\s*([a-z0-9.]*|none)(.*)/i","$2",$critere_style['style']);
|
||||
@ -2120,15 +2130,15 @@ function svgDefineTxtStyle($critere_style)
|
||||
}
|
||||
|
||||
|
||||
// mPDF 4.4.003
|
||||
if (preg_match('/xlink:href=/si',$data)) {
|
||||
// GRADIENTS
|
||||
// Get links
|
||||
preg_match_all('/(<(linearGradient|radialgradient)[^>]*)xlink:href=["\']#(.*?)["\'](.*?)\/>/si',$data, $links);
|
||||
if (count($links[0])) { $links[5] = array(); } // mPDF 4.5.010
|
||||
if (count($links[0])) { $links[5] = array(); }
|
||||
// Delete links from data - keeping in $links
|
||||
for ($i=0; $i<count($links[0]); $i++) {
|
||||
$links[5][$i] = 'tmpLink'.RAND(100000,9999999); // mPDF 4.5.010
|
||||
$data = preg_replace('/'.preg_quote($links[0][$i],'/').'/is', '<MYLINKS'.$links[5][$i].'>' , $data); // mPDF 4.5.010
|
||||
$links[5][$i] = 'tmpLink'.RAND(100000,9999999);
|
||||
$data = preg_replace('/'.preg_quote($links[0][$i],'/').'/is', '<MYLINKS'.$links[5][$i].'>' , $data);
|
||||
}
|
||||
// Get targets
|
||||
preg_match_all('/<(linearGradient|radialgradient)([^>]*)id=["\'](.*?)["\'](.*?)>(.*?)<\/(linearGradient|radialgradient)>/si',$data, $m);
|
||||
@ -2140,13 +2150,110 @@ function svgDefineTxtStyle($critere_style)
|
||||
}
|
||||
// Add back links this time as targets (gradients)
|
||||
for ($i=0; $i<count($links[0]); $i++) {
|
||||
$def = $links[1][$i] .' '.$links[4][$i].'>'. $stops[$links[3][$i]].'</'.$links[2][$i] .'>' ; // mPDF 4.5.010
|
||||
$data = preg_replace('/<MYLINKS'.$links[5][$i].'>/is', $def , $data); // mPDF 4.5.010
|
||||
$def = $links[1][$i] .' '.$links[4][$i].'>'. $stops[$links[3][$i]].'</'.$links[2][$i] .'>' ;
|
||||
$data = preg_replace('/<MYLINKS'.$links[5][$i].'>/is', $def , $data);
|
||||
}
|
||||
|
||||
// mPDF 5.7.2
|
||||
// <USE>
|
||||
preg_match_all('/<use ([^>]*)xlink:href=["\']#([^>]*?)["\']([^>]*)\/>/si',$data, $links);
|
||||
for ($i=0; $i<count($links[0]); $i++) {
|
||||
|
||||
// Get the item to use from defs
|
||||
$insert = '';
|
||||
if (preg_match('/<([a-zA-Z]*) [^>]*id=["\']'.$links[2][$i].'["\'][^>]*\/>/si',$data, $m)) {
|
||||
$insert = $m[0];
|
||||
}
|
||||
if (!$insert && preg_match('/<([a-zA-Z]*) [^>]*id=["\']'.$links[2][$i].'["\']/si',$data, $m)) {
|
||||
|
||||
if (preg_match('/<'.$m[1].'[^>]*id=["\']'.$links[2][$i].'["\'][^>]*>.*?<\/'.$m[1].'>/si',$data, $m)) {
|
||||
$insert = $m[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ($insert) {
|
||||
|
||||
$inners = $links[1][$i] . ' ' . $links[3][$i];
|
||||
// Change x,y coords to translate()
|
||||
if (preg_match('/y=["\']([^>]*?)["\']/', $inners, $m)) { $y = $m[1]; }
|
||||
else { $y = 0; }
|
||||
if (preg_match('/x=["\']([^>]*?)["\']/', $inners, $m)) { $x = $m[1]; }
|
||||
else { $x = 0; }
|
||||
if ($x || $y) {
|
||||
$inners = preg_replace('/(y|x)=["\']([^>]*?)["\']/', '', $inners);
|
||||
if (preg_match('/transform=["\']([^>]*?)["\']/', $inners, $m)) {
|
||||
if (preg_match('/translate\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/', $m[1], $mm)) {
|
||||
$transform = $m[1]; // transform="...."
|
||||
$x += $mm[1];
|
||||
$y += $mm[2];
|
||||
$transform = preg_replace('/'.preg_quote($mm[0],'/').'/', '', $transform);
|
||||
$transform = 'transform="'.$transform.' translate('.$x.', '.$y.')"';
|
||||
$inners = preg_replace('/'.preg_quote($m[0],'/').'/is', $transform, $inners);
|
||||
}
|
||||
else {
|
||||
$inners = preg_replace('/'.preg_quote($m[0],'/').'/is', 'transform="'.$m[1].' translate('.$x.', '.$y.')"', $inners);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$inners .= ' transform="translate('.$x.', '.$y.')"';
|
||||
}
|
||||
}
|
||||
}
|
||||
$replacement = '<g '.$inners.'>'.$insert.'</g>';
|
||||
$data = preg_replace('/'.preg_quote($links[0][$i],'/').'/is', $replacement, $data);
|
||||
}
|
||||
preg_match_all('/<use ([^>]*)xlink:href=["\']#([^>]*?)["\']([^>]*)>\s*<\/use>/si',$data, $links);
|
||||
for ($i=0; $i<count($links[0]); $i++) {
|
||||
|
||||
// Get the item to use from defs
|
||||
$insert = '';
|
||||
if (preg_match('/<([a-zA-Z]*) [^>]*id=["\']'.$links[2][$i].'["\'][^>]*\/>/si',$data, $m)) {
|
||||
$insert = $m[0];
|
||||
}
|
||||
if (!$insert && preg_match('/<([a-zA-Z]*) [^>]*id=["\']'.$links[2][$i].'["\']/si',$data, $m)) {
|
||||
|
||||
if (preg_match('/<'.$m[1].'[^>]*id=["\']'.$links[2][$i].'["\'][^>]*>.*?<\/'.$m[1].'>/si',$data, $m)) {
|
||||
$insert = $m[0];
|
||||
}
|
||||
}
|
||||
|
||||
if ($insert) {
|
||||
|
||||
$inners = $links[1][$i] . ' ' . $links[3][$i];
|
||||
// Change x,y coords to translate()
|
||||
if (preg_match('/y=["\']([^>]*?)["\']/', $inners, $m)) { $y = $m[1]; }
|
||||
else { $y = 0; }
|
||||
if (preg_match('/x=["\']([^>]*?)["\']/', $inners, $m)) { $x = $m[1]; }
|
||||
else { $x = 0; }
|
||||
if ($x || $y) {
|
||||
$inners = preg_replace('/(y|x)=["\']([^>]*?)["\']/', '', $inners);
|
||||
if (preg_match('/transform=["\']([^>]*?)["\']/', $inners, $m)) {
|
||||
if (preg_match('/translate\(\s*([0-9\.]+)\s*,\s*([0-9\.]+)\s*\)/', $m[1], $mm)) {
|
||||
$transform = $m[1]; // transform="...."
|
||||
$x += $mm[1];
|
||||
$y += $mm[2];
|
||||
$transform = preg_replace('/'.preg_quote($mm[0],'/').'/', '', $transform);
|
||||
$transform = 'transform="'.$transform.' translate('.$x.', '.$y.')"';
|
||||
$inners = preg_replace('/'.preg_quote($m[0],'/').'/is', $transform, $inners);
|
||||
}
|
||||
else {
|
||||
$inners = preg_replace('/'.preg_quote($m[0],'/').'/is', 'transform="'.$m[1].' translate('.$x.', '.$y.')"', $inners);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$inners .= ' transform="translate('.$x.', '.$y.')"';
|
||||
}
|
||||
}
|
||||
$replacement = '<g '.$inners.'>'.$insert.'</g>';
|
||||
$data = preg_replace('/'.preg_quote($links[0][$i],'/').'/is', $replacement, $data);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
// mPDF 4.4.003 - Removes <pattern>
|
||||
// Removes <pattern>
|
||||
$data = preg_replace('/<pattern.*?<\/pattern>/is', '', $data);
|
||||
// mPDF 4.4.003 - Removes <marker>
|
||||
// Removes <marker>
|
||||
$data = preg_replace('/<marker.*?<\/marker>/is', '', $data);
|
||||
|
||||
$this->svg_info['data'] = $data;
|
||||
@ -2155,14 +2262,96 @@ function svgDefineTxtStyle($critere_style)
|
||||
|
||||
//
|
||||
// chargement unique des fonctions
|
||||
if(!function_exists("xml_svg2pdf_start")){ // mPDF 5.3.76
|
||||
if(!function_exists("xml_svg2pdf_start")){
|
||||
|
||||
function xml_svg2pdf_start($parser, $name, $attribs){
|
||||
//
|
||||
// definition
|
||||
global $svg_class, $last_gradid;
|
||||
|
||||
// mPDF 4.4.003
|
||||
// mPDF 5.7.2
|
||||
if (strtolower($name) == 'lineargradient'){
|
||||
$tmp_gradient = array(
|
||||
'type' => 'linear',
|
||||
'info' => array(
|
||||
'x1' => $attribs['x1'],
|
||||
'y1' => $attribs['y1'],
|
||||
'x2' => $attribs['x2'],
|
||||
'y2' => $attribs['y2']
|
||||
),
|
||||
'transform' => $attribs['gradientTransform'],
|
||||
'units' => $attribs['gradientUnits'],
|
||||
'spread' => $attribs['spreadMethod'],
|
||||
'color' => array()
|
||||
);
|
||||
$last_gradid = $attribs['id'];
|
||||
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
||||
return;
|
||||
}
|
||||
else if (strtolower($name) == 'radialgradient'){
|
||||
$tmp_gradient = array(
|
||||
'type' => 'radial',
|
||||
'info' => array(
|
||||
'x0' => $attribs['cx'],
|
||||
'y0' => $attribs['cy'],
|
||||
'x1' => $attribs['fx'],
|
||||
'y1' => $attribs['fy'],
|
||||
'r' => $attribs['r']
|
||||
),
|
||||
'transform' => $attribs['gradientTransform'],
|
||||
'units' => $attribs['gradientUnits'],
|
||||
'spread' => $attribs['spreadMethod'],
|
||||
'color' => array()
|
||||
);
|
||||
$last_gradid = $attribs['id'];
|
||||
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
||||
return;
|
||||
}
|
||||
else if (strtolower($name) == 'stop'){
|
||||
if (!$last_gradid) break;
|
||||
if (isset($attribs['style']) AND preg_match('/stop-color:\s*([^;]*)/i',$attribs['style'],$m)) {
|
||||
$color = trim($m[1]);
|
||||
} else if (isset($attribs['stop-color'])) {
|
||||
$color = $attribs['stop-color'];
|
||||
}
|
||||
$col = $svg_class->mpdf_ref->ConvertColor($color);
|
||||
|
||||
if ($col{0}==3 || $col{0}==5) { // RGB
|
||||
$color_final = sprintf('%.3F %.3F %.3F',ord($col{1})/255,ord($col{2})/255,ord($col{3})/255);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='RGB';
|
||||
}
|
||||
else if ($col{0}==4 || $col{0}==6) { // CMYK
|
||||
$color_final = sprintf('%.3F %.3F %.3F %.3F',ord($col{1})/100,ord($col{2})/100,ord($col{3})/100,ord($col{4})/100);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='CMYK';
|
||||
}
|
||||
else if ($col{0}==1) { // Grayscale
|
||||
$color_final = sprintf('%.3F',ord($col{1})/255);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='Gray';
|
||||
}
|
||||
|
||||
$stop_opacity = 1;
|
||||
if (isset($attribs['style']) AND preg_match('/stop-opacity:\s*([0-9.]*)/i',$attribs['style'],$m)) {
|
||||
$stop_opacity = $m[1];
|
||||
} else if (isset($attribs['stop-opacity'])) {
|
||||
$stop_opacity = $attribs['stop-opacity'];
|
||||
}
|
||||
else if ($col{0}==5) { // RGBa
|
||||
$stop_opacity = ord($col{4}/100);
|
||||
}
|
||||
else if ($col{0}==6) { // CMYKa
|
||||
$stop_opacity = ord($col{5}/100);
|
||||
}
|
||||
|
||||
$tmp_color = array(
|
||||
'color' => $color_final,
|
||||
'offset' => $attribs['offset'],
|
||||
'opacity' => $stop_opacity
|
||||
);
|
||||
array_push($svg_class->svg_gradient[$last_gradid]['color'],$tmp_color);
|
||||
return;
|
||||
}
|
||||
if ($svg_class->inDefs) { return; }
|
||||
|
||||
$svg_class->xbase = 0;
|
||||
$svg_class->ybase = 0;
|
||||
switch (strtolower($name)){
|
||||
@ -2293,99 +2482,6 @@ function svgDefineTxtStyle($critere_style)
|
||||
$path_style = $svg_class->svgDefineStyle($critere_style);
|
||||
break;
|
||||
|
||||
case 'lineargradient':
|
||||
$tmp_gradient = array(
|
||||
'type' => 'linear',
|
||||
'info' => array(
|
||||
'x1' => $attribs['x1'],
|
||||
'y1' => $attribs['y1'],
|
||||
'x2' => $attribs['x2'],
|
||||
'y2' => $attribs['y2']
|
||||
),
|
||||
'transform' => $attribs['gradientTransform'],
|
||||
'units' => $attribs['gradientUnits'], /* mPDF 4.4.003 */
|
||||
'spread' => $attribs['spreadMethod'], /* mPDF 5.0.040 */
|
||||
'color' => array()
|
||||
);
|
||||
|
||||
$last_gradid = $attribs['id'];
|
||||
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
||||
break;
|
||||
|
||||
case 'radialgradient':
|
||||
$tmp_gradient = array(
|
||||
'type' => 'radial',
|
||||
'info' => array(
|
||||
'x0' => $attribs['cx'],
|
||||
'y0' => $attribs['cy'],
|
||||
'x1' => $attribs['fx'],
|
||||
'y1' => $attribs['fy'],
|
||||
'r' => $attribs['r']
|
||||
),
|
||||
'transform' => $attribs['gradientTransform'],
|
||||
'units' => $attribs['gradientUnits'], /* mPDF 4.4.003 */
|
||||
'spread' => $attribs['spreadMethod'], /* mPDF 5.0.040 */
|
||||
'color' => array()
|
||||
);
|
||||
|
||||
$last_gradid = $attribs['id'];
|
||||
|
||||
$svg_class->svgAddGradient($attribs['id'],$tmp_gradient);
|
||||
|
||||
break;
|
||||
|
||||
case 'stop':
|
||||
if (!$last_gradid) break;
|
||||
// mPDF 4.4.003 // mPDF 5.0.040
|
||||
if (isset($attribs['style']) AND preg_match('/stop-color:\s*([^;]*)/i',$attribs['style'],$m)) {
|
||||
$color = trim($m[1]);
|
||||
} else if (isset($attribs['stop-color'])) {
|
||||
$color = $attribs['stop-color'];
|
||||
}
|
||||
$col = $svg_class->mpdf_ref->ConvertColor($color);
|
||||
|
||||
// mPDF 5.0.051
|
||||
// mPDF 5.3.74
|
||||
if ($col{0}==3 || $col{0}==5) { // RGB
|
||||
$color_final = sprintf('%.3F %.3F %.3F',ord($col{1})/255,ord($col{2})/255,ord($col{3})/255);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='RGB';
|
||||
}
|
||||
else if ($col{0}==4 || $col{0}==6) { // CMYK
|
||||
$color_final = sprintf('%.3F %.3F %.3F %.3F',ord($col{1})/100,ord($col{2})/100,ord($col{3})/100,ord($col{4})/100);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='CMYK';
|
||||
}
|
||||
else if ($col{0}==1) { // Grayscale
|
||||
$color_final = sprintf('%.3F',ord($col{1})/255);
|
||||
$svg_class->svg_gradient[$last_gradid]['colorspace']='Gray';
|
||||
}
|
||||
|
||||
|
||||
// mPDF 5.0.020
|
||||
$stop_opacity = 1;
|
||||
// mPDF 4.4.003
|
||||
if (isset($attribs['style']) AND preg_match('/stop-opacity:\s*([0-9.]*)/i',$attribs['style'],$m)) {
|
||||
$stop_opacity = $m[1];
|
||||
} else if (isset($attribs['stop-opacity'])) {
|
||||
$stop_opacity = $attribs['stop-opacity'];
|
||||
}
|
||||
// mPDF 5.0.051
|
||||
// mPDF 5.3.74
|
||||
else if ($col{0}==5) { // RGBa
|
||||
$stop_opacity = ord($col{4}/100);
|
||||
}
|
||||
else if ($col{0}==6) { // CMYKa
|
||||
$stop_opacity = ord($col{5}/100);
|
||||
}
|
||||
|
||||
$tmp_color = array(
|
||||
'color' => $color_final,
|
||||
'offset' => $attribs['offset'],
|
||||
'opacity' => $stop_opacity
|
||||
);
|
||||
array_push($svg_class->svg_gradient[$last_gradid]['color'],$tmp_color);
|
||||
break;
|
||||
|
||||
|
||||
case 'a':
|
||||
if (isset($attribs['xlink:href'])) {
|
||||
unset($attribs['xlink:href']); // this should be a hyperlink
|
||||
@ -2403,7 +2499,6 @@ function svgDefineTxtStyle($critere_style)
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
// mPDF 4.4.003
|
||||
$array_style = $svg_class->svgDefineStyle($attribs);
|
||||
if ($array_style['transformations']) {
|
||||
$svg_class->svgWriteString(' q '.$array_style['transformations']);
|
||||
@ -2436,6 +2531,7 @@ function svgDefineTxtStyle($critere_style)
|
||||
function characterData($parser, $data)
|
||||
{
|
||||
global $svg_class;
|
||||
if ($svg_class->inDefs) { return; } // mPDF 5.7.2
|
||||
if(isset($svg_class->txt_data[2])) {
|
||||
$svg_class->txt_data[2] .= $data;
|
||||
}
|
||||
@ -2447,6 +2543,13 @@ function svgDefineTxtStyle($critere_style)
|
||||
|
||||
function xml_svg2pdf_end($parser, $name){
|
||||
global $svg_class;
|
||||
// Don't output stuff inside <defs>
|
||||
// mPDF 5.7.2
|
||||
if ($name == 'defs') {
|
||||
$svg_class->inDefs = false;
|
||||
return;
|
||||
}
|
||||
if ($svg_class->inDefs) { return; }
|
||||
switch($name){
|
||||
|
||||
case "g":
|
||||
|
@ -224,7 +224,6 @@ function insertTOC() {
|
||||
$tocstart=count($this->mpdf->pages);
|
||||
if ($toc_preHTML) { $this->mpdf->WriteHTML($toc_preHTML); }
|
||||
|
||||
|
||||
// mPDF 5.6.19
|
||||
$html ='<div class="mpdf_toc" id="mpdf_toc_'.$toc_id.'">';
|
||||
foreach($this->_toc as $t) {
|
||||
@ -268,7 +267,7 @@ function insertTOC() {
|
||||
$s .= $this->mpdf->PrintBodyBackgrounds();
|
||||
|
||||
$s .= $this->mpdf->PrintPageBackgrounds();
|
||||
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$s."\n".'\\1', $this->mpdf->pages[$this->mpdf->page]);
|
||||
$this->mpdf->pages[$this->mpdf->page] = preg_replace('/(___BACKGROUND___PATTERNS'.$this->mpdf->uniqstr.')/', "\n".$s."\n".'\\1', $this->mpdf->pages[$this->mpdf->page]);
|
||||
$this->mpdf->pageBackgrounds = array();
|
||||
|
||||
//Page footer
|
||||
|
@ -1,5 +1,13 @@
|
||||
<?php
|
||||
|
||||
// mPDF 5.7
|
||||
// Replace a section of an array with the elements in reverse
|
||||
function array_splice_reverse(&$arr, $offset, $length) {
|
||||
$tmp = (array_reverse(array_slice($arr, $offset, $length)));
|
||||
array_splice($arr, $offset, $length, $tmp);
|
||||
}
|
||||
|
||||
|
||||
// mPDF 5.6.23
|
||||
function array_insert(&$array, $value, $offset) {
|
||||
if (is_array($array)) {
|
||||
@ -92,12 +100,30 @@ function PreparePreText($text,$ff='//FF//') {
|
||||
if(!function_exists('strcode2utf')){
|
||||
function strcode2utf($str,$lo=true) {
|
||||
//converts all the &#nnn; and &#xhhh; in a string to Unicode
|
||||
if ($lo) { $lo = 1; } else { $lo = 0; }
|
||||
$str = preg_replace('/\&\#([0-9]+)\;/me', "code2utf('\\1',{$lo})",$str);
|
||||
$str = preg_replace('/\&\#x([0-9a-fA-F]+)\;/me', "codeHex2utf('\\1',{$lo})",$str);
|
||||
// mPDF 5.7
|
||||
if ($lo) {
|
||||
$str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_lo_callback', $str);
|
||||
$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_lo_callback', $str);
|
||||
}
|
||||
else {
|
||||
$str = preg_replace_callback('/\&\#([0-9]+)\;/m', 'code2utf_callback', $str);
|
||||
$str = preg_replace_callback('/\&\#x([0-9a-fA-F]+)\;/m', 'codeHex2utf_callback', $str);
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
}
|
||||
function code2utf_callback($matches) {
|
||||
return code2utf($matches[1], 0);
|
||||
}
|
||||
function code2utf_lo_callback($matches) {
|
||||
return code2utf($matches[1], 1);
|
||||
}
|
||||
function codeHex2utf_callback($matches) {
|
||||
return codeHex2utf($matches[1], 0);
|
||||
}
|
||||
function codeHex2utf_lo_callback($matches) {
|
||||
return codeHex2utf($matches[1], 1);
|
||||
}
|
||||
|
||||
if(!function_exists('code2utf')){
|
||||
function code2utf($num,$lo=true){
|
||||
|
328
inc/3rdparty/libraries/mpdf/mpdf.php
vendored
328
inc/3rdparty/libraries/mpdf/mpdf.php
vendored
@ -2,10 +2,10 @@
|
||||
|
||||
// ******************************************************************************
|
||||
// Software: mPDF, Unicode-HTML Free PDF generator *
|
||||
// Version: 5.7 based on *
|
||||
// Version: 5.7.2 based on *
|
||||
// FPDF by Olivier PLATHEY *
|
||||
// HTML2FPDF by Renato Coelho *
|
||||
// Date: 2013-07-14 *
|
||||
// Date: 2013-09-01 *
|
||||
// Author: Ian Back <ianb@bpm1.com> *
|
||||
// License: GPL *
|
||||
// *
|
||||
@ -13,7 +13,7 @@
|
||||
// ******************************************************************************
|
||||
|
||||
|
||||
define('mPDF_VERSION','5.7');
|
||||
define('mPDF_VERSION','5.7.2');
|
||||
|
||||
//Scale factor
|
||||
define('_MPDFK', (72/25.4));
|
||||
@ -269,6 +269,7 @@ var $directw;
|
||||
//////////////////////
|
||||
// INTERNAL VARIABLES
|
||||
//////////////////////
|
||||
var $uniqstr; // mPDF 5.7.2
|
||||
var $writingToC; // mPDF 5.6.38
|
||||
// mPDF 5.6.01
|
||||
var $layers;
|
||||
@ -850,6 +851,7 @@ function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=1
|
||||
$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;
|
||||
@ -1146,7 +1148,7 @@ function mPDF($mode='',$format='A4',$default_font_size=0,$default_font='',$mgl=1
|
||||
$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; }
|
||||
}
|
||||
@ -1682,8 +1684,8 @@ function SetAlpha($alpha, $bm='Normal', $return=false, $mode='B') {
|
||||
$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)); }
|
||||
@ -1765,7 +1767,7 @@ function Close() {
|
||||
$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')
|
||||
@ -2344,7 +2346,7 @@ function AddPage($orientation='',$condition='', $resetpagenum='', $pagenumstyle=
|
||||
$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' : '');
|
||||
@ -2485,7 +2487,7 @@ function AddPage($orientation='',$condition='', $resetpagenum='', $pagenumstyle=
|
||||
$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();
|
||||
}
|
||||
|
||||
@ -2545,9 +2547,9 @@ function AddPage($orientation='',$condition='', $resetpagenum='', $pagenumstyle=
|
||||
}
|
||||
|
||||
// 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
|
||||
@ -3628,9 +3630,8 @@ function Cell($w,$h=0,$txt='',$border=0,$ln=0,$align='',$fill=0,$link='', $curre
|
||||
$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
|
||||
|
||||
|
||||
@ -6086,6 +6087,17 @@ function WriteFlowingBlock( $s)
|
||||
$savedContent = array_pop( $content );
|
||||
$savedContentB = array_pop($contentB); // mPDF 5.6.20
|
||||
$savedFont = array_pop( $font );
|
||||
|
||||
// mPDF 5.7.2
|
||||
// e.g: |first chunk |second chunk |[IndexEntry]|doesntfit
|
||||
if (isset($this->objectbuffer[(count($content)-1)]) && $this->objectbuffer[(count($content)-1)]['OUTER-WIDTH'] < 0.001) {
|
||||
$savedObj = $this->objectbuffer[(count($content)-1)];
|
||||
array_pop( $content );
|
||||
array_pop( $contentB );
|
||||
array_pop( $font );
|
||||
array_pop( $this->objectbuffer );
|
||||
}
|
||||
|
||||
// trim any trailing spaces off the last bit of content
|
||||
$currContent =& $content[ count( $content ) - 1 ];
|
||||
$currContent = rtrim( $currContent );
|
||||
@ -6347,6 +6359,10 @@ function WriteFlowingBlock( $s)
|
||||
$this->keep_block_together = 0;
|
||||
}
|
||||
|
||||
if ($this->kwt && !$is_table) { // mPDF 5.7+
|
||||
$this->printkwtbuffer();
|
||||
$this->kwt = false;
|
||||
}
|
||||
|
||||
/*-- COLUMNS --*/
|
||||
// COLS
|
||||
@ -6913,7 +6929,7 @@ function Image($file,$x,$y,$w=0,$h=0,$type='',$link='',$paint=true, $constrain=t
|
||||
|
||||
if ($this->watermarkImgBehind) {
|
||||
$outstring = $this->watermarkImgAlpha . "\n" . $outstring . "\n" . $this->SetAlpha(1, 'Normal', true) . "\n";
|
||||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.date('jY').')/', "\n".$outstring."\n".'\\1', $this->pages[$this->page]);
|
||||
$this->pages[$this->page] = preg_replace('/(___BACKGROUND___PATTERNS'.$this->uniqstr.')/', "\n".$outstring."\n".'\\1', $this->pages[$this->page]);
|
||||
}
|
||||
else { $this->_out($outstring); }
|
||||
|
||||
@ -7387,7 +7403,7 @@ function Output($name='',$dest='')
|
||||
/*-- PROGRESS-BAR --*/
|
||||
if ($this->progressBar && ($dest=='D' || $dest=='I')) {
|
||||
if($name=='') { $name='mpdf.pdf'; }
|
||||
$tempfile = '_tempPDF'.RAND(1,10000);
|
||||
$tempfile = '_tempPDF'.uniqid(rand(1,100000),true);
|
||||
//Save to local file
|
||||
$f=fopen(_MPDF_TEMP_PATH.$tempfile.'.pdf','wb');
|
||||
if(!$f) $this->Error('Unable to create temporary output file: '.$tempfile.'.pdf');
|
||||
@ -7451,7 +7467,7 @@ function Output($name='',$dest='')
|
||||
// don't use length if server using compression
|
||||
header('Content-Length: '.strlen($this->buffer));
|
||||
}
|
||||
header('Content-disposition: attachment; filename="'.$name.'"');
|
||||
header('Content-disposition: inline; filename="'.$name.'"');
|
||||
header('Cache-Control: public, must-revalidate, max-age=0');
|
||||
header('Pragma: public');
|
||||
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
|
||||
@ -7501,7 +7517,7 @@ function Output($name='',$dest='')
|
||||
$interval = 3600;
|
||||
if ($handle = opendir(preg_replace('/\/$/','',_MPDF_TEMP_PATH))) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (!is_dir($file) && ((filemtime(_MPDF_TEMP_PATH.$file)+$interval) < time()) && ($file != "..") && ($file != ".")) { // mPDF 5.4.19
|
||||
if (!is_dir($file) && ((filemtime(_MPDF_TEMP_PATH.$file)+$interval) < time()) && ($file != "..") && ($file != ".") && (substr($file, 0, 1) !== '.') && ($file !='dummy.txt')) { // mPDF 5.7
|
||||
unlink(_MPDF_TEMP_PATH.$file);
|
||||
}
|
||||
}
|
||||
@ -7576,7 +7592,7 @@ function _puthtmlheaders() {
|
||||
else { $pntstr = ''; }
|
||||
$html = str_replace($this->aliasNbPgGp,$pntstr,$html ); // {nbpg}
|
||||
$html = str_replace($this->aliasNbPg,$nb,$html ); // {nb}
|
||||
$html = preg_replace('/\{DATE\s+(.*?)\}/e',"date('\\1')",$html );
|
||||
$html = preg_replace_callback('/\{DATE\s+(.*?)\}/', array($this, 'date_callback') ,$html ); // mPDF 5.7
|
||||
|
||||
$this->HTMLheaderPageLinks = array();
|
||||
$this->HTMLheaderPageAnnots = array();
|
||||
@ -7602,7 +7618,7 @@ function _puthtmlheaders() {
|
||||
|
||||
// Writes over the page background but behind any other output on page
|
||||
$os = preg_replace('/\\\\/','\\\\\\\\',$os);
|
||||
$this->pages[$n] = preg_replace('/(___HEADER___MARKER'.date('jY').')/', "\n".$os."\n".'\\1', $this->pages[$n]);
|
||||
$this->pages[$n] = preg_replace('/(___HEADER___MARKER'.$this->uniqstr.')/', "\n".$os."\n".'\\1', $this->pages[$n]);
|
||||
|
||||
$lks = $this->HTMLheaderPageLinks;
|
||||
foreach($lks AS $lk) {
|
||||
@ -7659,7 +7675,7 @@ function _puthtmlheaders() {
|
||||
else { $pntstr = ''; }
|
||||
$html = str_replace($this->aliasNbPgGp,$pntstr,$html ); // {nbpg}
|
||||
$html = str_replace($this->aliasNbPg,$nb,$html ); // {nb}
|
||||
$html = preg_replace('/\{DATE\s+(.*?)\}/e',"date('\\1')",$html );
|
||||
$html = preg_replace_callback('/\{DATE\s+(.*?)\}/', array($this, 'date_callback') ,$html ); // mPDF 5.7
|
||||
|
||||
|
||||
$this->HTMLheaderPageLinks = array();
|
||||
@ -7694,7 +7710,7 @@ function _puthtmlheaders() {
|
||||
$os .= $this->StopTransform(true)."\n";
|
||||
// Writes over the page background but behind any other output on page
|
||||
$os = preg_replace('/\\\\/','\\\\\\\\',$os);
|
||||
$this->pages[$n] = preg_replace('/(___HEADER___MARKER'.date('jY').')/', "\n".$os."\n".'\\1', $this->pages[$n]);
|
||||
$this->pages[$n] = preg_replace('/(___HEADER___MARKER'.$this->uniqstr.')/', "\n".$os."\n".'\\1', $this->pages[$n]);
|
||||
|
||||
$lks = $this->HTMLheaderPageLinks;
|
||||
foreach($lks AS $lk) {
|
||||
@ -7876,10 +7892,10 @@ function _putpages()
|
||||
$thispage=str_replace($this->aliasNbPgGpHex,$r,$thispage);
|
||||
|
||||
}
|
||||
$thispage = preg_replace('/(\s*___BACKGROUND___PATTERNS'.date('jY').'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___HEADER___MARKER'.date('jY').'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___PAGE___START'.date('jY').'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___TABLE___BACKGROUNDS'.date('jY').'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___BACKGROUND___PATTERNS'.$this->uniqstr.'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___HEADER___MARKER'.$this->uniqstr.'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___PAGE___START'.$this->uniqstr.'\s*)/', " ", $thispage);
|
||||
$thispage = preg_replace('/(\s*___TABLE___BACKGROUNDS'.$this->uniqstr.'\s*)/', " ", $thispage);
|
||||
|
||||
//Page
|
||||
$this->_newobj();
|
||||
@ -7928,10 +7944,13 @@ function _putpages()
|
||||
}
|
||||
|
||||
$annotsnum = 0;
|
||||
$embeddedfiles = array(); // mPDF 5.7.2 /EmbeddedFiles
|
||||
|
||||
if (isset($this->PageLinks[$n])) { $annotsnum += count($this->PageLinks[$n]); }
|
||||
/*-- ANNOTATIONS --*/
|
||||
if (isset($this->PageAnnots[$n])) {
|
||||
foreach ($this->PageAnnots[$n] as $k => $pl) {
|
||||
if (!empty($pl['opt']['file'])) { $embeddedfiles[$annotsnum+1] = true ; } // mPDF 5.7.2 /EmbeddedFiles
|
||||
if (!empty($pl['opt']['popup']) || !empty($pl['opt']['file'])) { $annotsnum += 2 ; }
|
||||
else { $annotsnum++; }
|
||||
$this->PageAnnots[$n][$k]['pageobj'] = $this->n;
|
||||
@ -7952,7 +7971,7 @@ function _putpages()
|
||||
if ($annotsnum || $formsnum) {
|
||||
$s = '/Annots [ ';
|
||||
for($i=0;$i<$annotsnum;$i++) {
|
||||
$s .= ($annotid + $i) . ' 0 R ';
|
||||
if (!isset($embeddedfiles[$i])) { $s .= ($annotid + $i) . ' 0 R '; } // mPDF 5.7.2 /EmbeddedFiles
|
||||
}
|
||||
$annotid += $annotsnum;
|
||||
/*-- FORMS --*/
|
||||
@ -7974,7 +7993,7 @@ function _putpages()
|
||||
$this->_putstream($p);
|
||||
$this->_out('endobj');
|
||||
}
|
||||
$this->_putannots($n);
|
||||
$this->_putannots(); // mPDF 5.7.2
|
||||
|
||||
//Pages root
|
||||
$this->offsets[1]=strlen($this->buffer);
|
||||
@ -7991,7 +8010,7 @@ function _putpages()
|
||||
}
|
||||
|
||||
|
||||
function _putannots($n) {
|
||||
function _putannots() { // mPDF 5.7.2
|
||||
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
|
||||
$nb=$this->page;
|
||||
for($n=1;$n<=$nb;$n++)
|
||||
@ -9752,7 +9771,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
if ($this->PDFA && !$this->PDFAauto) { $this->PDFAXwarnings[] = "JPG image may not use CMYK color space - ".$file." - (Image converted to RGB. NB This will alter the colour profile of the image.)"; }
|
||||
$im = @imagecreatefromstring($data);
|
||||
if ($im) {
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.RAND(1,10000).'.png';
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.md5($file).RAND(1,10000).'.png';
|
||||
imageinterlace($im, false);
|
||||
$check = @imagepng($im, $tempfile);
|
||||
if (!$check) { return $this->_imageError($file, $firsttime, 'Error creating temporary file ('.$tempfile.') whilst using GD library to parse JPG(CMYK) image'); }
|
||||
@ -9857,7 +9876,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
$w = imagesx($im);
|
||||
$h = imagesy($im);
|
||||
if ($im) {
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.RAND(1,10000).'.png';
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.md5($file).RAND(1,10000).'.png';
|
||||
// Alpha channel set
|
||||
if ($pngalpha) {
|
||||
if ($this->PDFA) { $this->Error("PDFA1-b does not permit images with alpha channel transparency (".$file.")."); }
|
||||
@ -9865,24 +9884,18 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
// generate gray scale pallete
|
||||
for ($c = 0; $c < 256; ++$c) { ImageColorAllocate($imgalpha, $c, $c, $c); }
|
||||
// extract alpha channel
|
||||
$gammacorr = 2.2; // gamma correction
|
||||
for ($xpx = 0; $xpx < $w; ++$xpx) {
|
||||
for ($ypx = 0; $ypx < $h; ++$ypx) {
|
||||
//$colorindex = imagecolorat($im, $xpx, $ypx);
|
||||
//$col = imagecolorsforindex($im, $colorindex);
|
||||
//$gamma2 = (pow((((127 - $col['alpha']) * 255 / 127) / 255), $gammacorr) * 255);
|
||||
$alpha = (imagecolorat($im, $xpx, $ypx) & 0x7F000000) >> 24;
|
||||
// mPDF 5.7.2
|
||||
if ($alpha < 127) {
|
||||
if ($alpha==0) { $gamma = 255; }
|
||||
else
|
||||
$gamma = (pow((((127 - $alpha) * 255 / 127) / 255), $gammacorr) * 255);
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, $gamma);
|
||||
imagesetpixel($imgalpha, $xpx, $ypx, (255-($alpha * 2)));
|
||||
}
|
||||
}
|
||||
}
|
||||
// create temp alpha file
|
||||
$tempfile_alpha = _MPDF_TEMP_PATH.'_tempMskPNG'.RAND(1,10000).'.png';
|
||||
if (!is_writable($tempfile_alpha)) {
|
||||
$tempfile_alpha = _MPDF_TEMP_PATH.'_tempMskPNG'.md5($file).RAND(1,10000).'.png';
|
||||
if (!is_writable(_MPDF_TEMP_PATH)) { // mPDF 5.7.2
|
||||
ob_start();
|
||||
$check = @imagepng($imgalpha);
|
||||
if (!$check) { return $this->_imageError($file, $firsttime, 'Error creating temporary image object whilst using GD library to parse PNG image'); }
|
||||
@ -9892,6 +9905,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
ob_end_clean();
|
||||
// extract image without alpha channel
|
||||
$imgplain = imagecreatetruecolor($w, $h);
|
||||
imagealphablending( $imgplain, false ); // mPDF 5.7.2
|
||||
imagecopy($imgplain, $im, 0, 0, 0, 0, $w, $h);
|
||||
// create temp image file
|
||||
$minfo = $this->_getImage($this->_tempimglnk, false);
|
||||
@ -9918,6 +9932,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
|
||||
// extract image without alpha channel
|
||||
$imgplain = imagecreatetruecolor($w, $h);
|
||||
imagealphablending( $imgplain, false ); // mPDF 5.7.2
|
||||
imagecopy($imgplain, $im, 0, 0, 0, 0, $w, $h);
|
||||
|
||||
// create temp image file
|
||||
@ -10040,7 +10055,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
if (isset($gd['GIF Read Support']) && $gd['GIF Read Support']) {
|
||||
$im = @imagecreatefromstring($data);
|
||||
if ($im) {
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.RAND(1,10000).'.png';
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.md5($file).RAND(1,10000).'.png';
|
||||
imagealphablending($im, false);
|
||||
imagesavealpha($im, false);
|
||||
imageinterlace($im, false);
|
||||
@ -10171,7 +10186,7 @@ function _getImage(&$file, $firsttime=true, $allowvector=true, $orig_srcpath=fal
|
||||
if (isset($gd['PNG Support']) && $gd['PNG Support']) {
|
||||
$im = @imagecreatefromstring($data);
|
||||
if (!$im) { return $this->_imageError($file, $firsttime, 'Error parsing image file - image type not recognised, and not supported by GD imagecreate'); }
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.RAND(1,10000).'.png';
|
||||
$tempfile = _MPDF_TEMP_PATH.'_tempImgPNG'.md5($file).RAND(1,10000).'.png';
|
||||
imagealphablending($im, false);
|
||||
imagesavealpha($im, false);
|
||||
imageinterlace($im, false);
|
||||
@ -10295,10 +10310,10 @@ function _convImage(&$data, $colspace, $targetcs, $w, $h, $dpi, $mask) {
|
||||
$imgdata .= chr($r).chr($g).chr($b);
|
||||
}
|
||||
if ($mask) {
|
||||
$col = imagecolorsforindex($im, $rgb);
|
||||
$gammacorr = 2.2; // gamma correction
|
||||
$gamma = intval((pow((((127 - $col['alpha']) * 255 / 127) / 255), $gammacorr) * 255));
|
||||
$mimgdata .= chr($gamma);
|
||||
// mPDF 5.7.2 Gamma correction
|
||||
$alpha = ($rgb & 0x7F000000) >> 24;
|
||||
if ($alpha < 127) { $mimgdata .= chr(255-($alpha * 2)); }
|
||||
else { $mimgdata .= chr(0); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -10316,7 +10331,7 @@ function _convImage(&$data, $colspace, $targetcs, $w, $h, $dpi, $mask) {
|
||||
$minfo = array('w'=>$w,'h'=>$h,'cs'=>'DeviceGray','bpc'=>8,'f'=>'FlateDecode','data'=>$mimgdata, 'type'=>'png',
|
||||
'parms'=>'/DecodeParms <</Colors '.$ncols.' /BitsPerComponent 8 /Columns '.$w.'>>');
|
||||
if ($dpi) { $minfo['set-dpi'] = $dpi; }
|
||||
$tempfile = '_tempImgPNG'.RAND(1,10000).'.png';
|
||||
$tempfile = '_tempImgPNG'.md5($file).RAND(1,10000).'.png';
|
||||
$imgmask = count($this->images)+1;
|
||||
$minfo['i']=$imgmask ;
|
||||
$this->images[$tempfile] = $minfo;
|
||||
@ -10408,7 +10423,7 @@ function file_get_contents_by_socket($url, &$data) {
|
||||
|
||||
function _imageTypeFromString(&$data) {
|
||||
$type = '';
|
||||
if (substr($data, 6, 4)== 'JFIF' || substr($data, 6, 4)== 'Exif') {
|
||||
if (substr($data, 6, 4)== 'JFIF' || substr($data, 6, 4)== 'Exif' || substr($data, 0, 2)== chr(255).chr(216)) { // 0xFF 0xD8 // mpDF 5.7.2
|
||||
$type = 'jpeg';
|
||||
}
|
||||
else if (substr($data, 0, 6)== "GIF87a" || substr($data, 0, 6)== "GIF89a") {
|
||||
@ -11117,7 +11132,11 @@ function GetFullPath(&$path,$basepath='') {
|
||||
if (!$basepath) { $basepath = $this->basepath; }
|
||||
//Fix path value
|
||||
$path = str_replace("\\","/",$path); //If on Windows
|
||||
$path = preg_replace('/^\/\//','http://',$path); // mPDF 5.6.27
|
||||
// mPDF 5.7.2
|
||||
if (substr($path,0,2) == "//") {
|
||||
$tr = parse_url($basepath);
|
||||
$path = $tr['scheme'].':'.$path;
|
||||
}
|
||||
$regexp = '|^./|'; // Inadvertently corrects "./path/etc" and "//www.domain.com/etc"
|
||||
$path = preg_replace($regexp,'',$path);
|
||||
|
||||
@ -11138,7 +11157,10 @@ function GetFullPath(&$path,$basepath='') {
|
||||
else if( strpos($path,":/") === false || strpos($path,":/") > 10) { //It is a Local Link
|
||||
if (substr($path,0,1) == "/") {
|
||||
$tr = parse_url($basepath);
|
||||
$root = $tr['scheme'].'://'.$tr['host'];
|
||||
// mPDF 5.7.2
|
||||
$root = '';
|
||||
if (!empty($tr['scheme'])) { $root .= $tr['scheme'].'://'; }
|
||||
$root .= $tr['host'];
|
||||
$path = $root . $path;
|
||||
}
|
||||
else { $path = $basepath . $path; }
|
||||
@ -11350,7 +11372,7 @@ function Header($content='') {
|
||||
if (isset($h[$side][$pos]['content']) && $h[$side][$pos]['content']) {
|
||||
$hd = str_replace('{PAGENO}',$pgno,$h[$side][$pos]['content']);
|
||||
$hd = str_replace($this->aliasNbPgGp,$this->nbpgPrefix.$this->aliasNbPgGp.$this->nbpgSuffix,$hd);
|
||||
$hd = preg_replace('/\{DATE\s+(.*?)\}/e',"date('\\1')",$hd);
|
||||
$hd = preg_replace_callback('/\{DATE\s+(.*?)\}/', array($this, 'date_callback') ,$hd); // mPDF 5.7
|
||||
if (isset($h[$side][$pos]['font-family']) && $h[$side][$pos]['font-family']) { $hff = $h[$side][$pos]['font-family']; }
|
||||
else { $hff = $this->original_default_font; }
|
||||
if (isset($h[$side][$pos]['font-size']) && $h[$side][$pos]['font-size']) { $hfsz = $h[$side][$pos]['font-size']; }
|
||||
@ -11421,10 +11443,24 @@ function Header($content='') {
|
||||
|
||||
/*-- TABLES --*/
|
||||
function TableHeaderFooter($content='',$tablestartpage='',$tablestartcolumn ='',$horf = 'H',$level, $firstSpread=true, $finalSpread=true) {
|
||||
if(($horf=='H' || $horf=='F') && !empty($content) && !empty($content[0])) { // mPDF 5.6.61
|
||||
if(($horf=='H' || $horf=='F') && !empty($content)) { // mPDF 5.7.2
|
||||
$table = &$this->table[1][1];
|
||||
// Advance down page by half width of top border
|
||||
|
||||
// mPDF 5.7.2
|
||||
if ($horf=='F') { // Table Footer
|
||||
$firstrow = count($table['cells']) - $table['footernrows'];
|
||||
$lastrow = count($table['cells']) - 1;
|
||||
}
|
||||
else { // Table Header
|
||||
$firstrow = 0;
|
||||
$lastrow = $table['headernrows'] - 1;
|
||||
}
|
||||
if(empty($content[$firstrow])) {
|
||||
if ($this->debug) { $this->Error("<tfoot> must precede <tbody> in a table"); }
|
||||
else { return; }
|
||||
}
|
||||
|
||||
// Advance down page by half width of top border
|
||||
if ($horf=='H') { // Only if header
|
||||
if ($table['borders_separate']) { $adv = $table['border_spacing_V']/2 + $table['border_details']['T']['w'] + $table['padding']['T']; }
|
||||
else { $adv = $table['max_cell_border_width']['T'] /2 ; }
|
||||
@ -11438,14 +11474,6 @@ function TableHeaderFooter($content='',$tablestartpage='',$tablestartcolumn ='',
|
||||
}
|
||||
}
|
||||
|
||||
if ($horf=='F') { // Table Footer
|
||||
$firstrow = count($table['cells']) - $table['footernrows'];
|
||||
$lastrow = count($table['cells']) - 1;
|
||||
}
|
||||
else { // Table Header
|
||||
$firstrow = 0;
|
||||
$lastrow = $table['headernrows'] - 1;
|
||||
}
|
||||
|
||||
$topy = $content[$firstrow][0]['y']-$this->y;
|
||||
|
||||
@ -12054,7 +12082,7 @@ function _getHtmlHeight($html) {
|
||||
$html = str_replace('{PAGENO}',$this->pagenumPrefix.$this->docPageNum($this->page).$this->pagenumSuffix,$html);
|
||||
$html = str_replace($this->aliasNbPgGp,$this->nbpgPrefix.$this->docPageNumTotal($this->page).$this->nbpgSuffix,$html );
|
||||
$html = str_replace($this->aliasNbPg,$this->page,$html );
|
||||
$html = preg_replace('/\{DATE\s+(.*?)\}/e',"date('\\1')",$html );
|
||||
$html = preg_replace_callback('/\{DATE\s+(.*?)\}/', array($this, 'date_callback') ,$html ); // mPDF 5.7
|
||||
$this->HTMLheaderPageLinks = array();
|
||||
$this->HTMLheaderPageAnnots = array();
|
||||
$this->HTMLheaderPageForms = array();
|
||||
@ -12064,6 +12092,10 @@ function _getHtmlHeight($html) {
|
||||
$this->writingHTMLheader = false;
|
||||
$h = ($this->y - $this->margin_header);
|
||||
$this->Reset();
|
||||
// mPDF 5.7.2 - Clear in case Float used in Header/Footer
|
||||
$this->blk[0]['blockContext'] = 0;
|
||||
$this->blk[0]['float_endpos'] = 0;
|
||||
|
||||
$this->pageoutput[$this->page] = array();
|
||||
$this->headerbuffer = '';
|
||||
$this->pageBackgrounds = $savepb;
|
||||
@ -12489,7 +12521,7 @@ function Footer() {
|
||||
if (isset($h[$side][$pos]['content']) && $h[$side][$pos]['content']) {
|
||||
$hd = str_replace('{PAGENO}',$pgno,$h[$side][$pos]['content']);
|
||||
$hd = str_replace($this->aliasNbPgGp,$this->nbpgPrefix.$this->aliasNbPgGp.$this->nbpgSuffix,$hd);
|
||||
$hd = preg_replace('/\{DATE\s+(.*?)\}/e',"date('\\1')",$hd);
|
||||
$hd = preg_replace_callback('/\{DATE\s+(.*?)\}/', array($this, 'date_callback') ,$hd); // mPDF 5.7
|
||||
if (isset($h[$side][$pos]['font-family']) && $h[$side][$pos]['font-family']) { $hff = $h[$side][$pos]['font-family']; }
|
||||
else { $hff = $this->original_default_font; }
|
||||
if (isset($h[$side][$pos]['font-size']) && $h[$side][$pos]['font-size']) { $hfsz = $h[$side][$pos]['font-size']; }
|
||||
@ -12579,7 +12611,7 @@ function hardHyphenate($word, $maxWidth) {
|
||||
else if ($this->FontFamily!='csymbol' && $this->FontFamily!='czapfdingbats') {
|
||||
$p = strpos($word, "-", $offset);
|
||||
}
|
||||
if ($p !== false) { $poss[] = $p - count($poss); }
|
||||
if ($p !== false) { $poss[] = $p; } // mPDF 5.7.2
|
||||
else { break; }
|
||||
$offset = $p+1;
|
||||
}
|
||||
@ -12634,7 +12666,9 @@ function softHyphenate($word, $maxWidth) {
|
||||
else if ($this->FontFamily!='csymbol' && $this->FontFamily!='czapfdingbats') {
|
||||
$p = strpos($word, chr(173), $offset);
|
||||
}
|
||||
if ($p !== false) { $poss[] = $p - count($poss); }
|
||||
// mPDF 5.7.2
|
||||
//if ($p !== false) { $poss[] = $p - count($poss); }
|
||||
if ($p !== false) { $poss[] = $p; }
|
||||
else { break; }
|
||||
$offset = $p+1;
|
||||
}
|
||||
@ -13049,7 +13083,8 @@ function WriteHTML($html,$sub=0,$init=true,$close=true) {
|
||||
$cnt += $this->SubstituteCharsMB($a, $i, $e);
|
||||
}
|
||||
if ($this->biDirectional) { // *RTL*
|
||||
$e = preg_replace("/([".$this->pregRTLchars."]+)/ue", '$this->ArabJoin(stripslashes(\'\\1\'))', $e); // *RTL*
|
||||
// mPDF 5.7+
|
||||
$e = preg_replace_callback("/([".$this->pregRTLchars."]+)/u", array($this, 'arabJoinPregCallback'), $e ); // *RTL*
|
||||
} // *RTL*
|
||||
// Font-specific ligature substitution for Indic fonts
|
||||
if (isset($this->CurrentFont['indic']) && $this->CurrentFont['indic']) $this->ConvertIndic($e); // *INDIC*
|
||||
@ -13343,7 +13378,7 @@ function WriteHTML($html,$sub=0,$init=true,$close=true) {
|
||||
if ($old_page != $new_page) {
|
||||
$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();
|
||||
$this->page = $new_page;
|
||||
$this->ResetMargins();
|
||||
@ -14426,7 +14461,7 @@ function ClearFloats($clear, $blklvl=0) {
|
||||
if ($old_page != $new_page) {
|
||||
$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();
|
||||
$this->page = $new_page;
|
||||
}
|
||||
@ -14924,8 +14959,8 @@ function OpenTag($tag,$attr)
|
||||
if (strpos($size,',')) { $size = explode(',',$size); }
|
||||
}
|
||||
else { $size = 'D'; }
|
||||
if (isset($attr['POS']) && $attr['POS']) {
|
||||
$pos = $attr['POS'];
|
||||
if (isset($attr['POSITION']) && $attr['POSITION']) { // mPDF 5.7.2
|
||||
$pos = $attr['POSITION'];
|
||||
if (strpos($pos,',')) { $pos = explode(',',$pos); }
|
||||
}
|
||||
else { $pos = 'P'; }
|
||||
@ -15273,7 +15308,7 @@ function OpenTag($tag,$attr)
|
||||
$this->meter = new meter();
|
||||
$svg = $this->meter->makeSVG(strtolower($tag), $type, $value, $max, $min, $optimum, $low, $high);
|
||||
//Save to local file
|
||||
$srcpath= _MPDF_TEMP_PATH.'_tempSVG'.RAND(1,10000).'_'.strtolower($tag).'.svg';
|
||||
$srcpath= _MPDF_TEMP_PATH.'_tempSVG'.uniqid(rand(1,100000),true).'_'.strtolower($tag).'.svg';
|
||||
file_put_contents($srcpath, $svg);
|
||||
$orig_srcpath = $srcpath;
|
||||
$this->GetFullPath($srcpath);
|
||||
@ -17111,7 +17146,7 @@ function OpenTag($tag,$attr)
|
||||
if ($this->cacheTables) {
|
||||
$this->packTableData = true; // required for cacheTables
|
||||
$this->simpleTables = false; // Cannot co-exist with cacheTables
|
||||
$table['cache'] = _MPDF_TEMP_PATH.'_tempTblCache'.RAND(1,1000000).'.dat';
|
||||
$table['cache'] = _MPDF_TEMP_PATH.'_tempTblCache'.uniqid(rand(1,100000),true).'.dat';
|
||||
$fh = fopen($table['cache'] , "wb") or $this->Error("When using cacheTables, you must have read/write access to cache files (".$table['cache'] .")");
|
||||
fwrite($fh, "\x00");
|
||||
fclose($fh);
|
||||
@ -18237,10 +18272,7 @@ function OpenTag($tag,$attr)
|
||||
|
||||
function _getListStyle($ls) {
|
||||
if (stristr($ls,'decimal')) { return '1'; }
|
||||
/* CSS3 list-styles numeric (selected) + I added tamil
|
||||
arabic-indic | bengali | devanagari | gujarati | gurmukhi | kannada | malayalam | oriya | persian | telugu | thai | urdu
|
||||
*/
|
||||
else if (preg_match('/(disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu)/i',$ls,$m)) {
|
||||
else if (preg_match('/(disc|circle|square|arabic-indic|bengali|devanagari|gujarati|gurmukhi|kannada|malayalam|oriya|persian|tamil|telugu|thai|urdu|cambodian|khmer|lao)/i',$ls,$m)) {
|
||||
return strtolower(trim($m[1]));
|
||||
}
|
||||
else if (stristr($ls,'lower-roman')) { return 'i'; }
|
||||
@ -18470,7 +18502,7 @@ function CloseTag($tag)
|
||||
if ($old_page != $new_page) {
|
||||
$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();
|
||||
$this->page = $new_page;
|
||||
$this->ResetMargins();
|
||||
@ -18529,7 +18561,7 @@ function CloseTag($tag)
|
||||
// If width not set, here would need to adjust and output buffer
|
||||
$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();
|
||||
$this->Reset();
|
||||
$this->pageoutput[$this->page] = array();
|
||||
@ -18561,7 +18593,7 @@ function CloseTag($tag)
|
||||
// If width not set, here would need to adjust and output buffer
|
||||
$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();
|
||||
$this->Reset();
|
||||
$this->pageoutput[$this->page] = array();
|
||||
@ -19834,6 +19866,19 @@ arabic-indic | bengali | cambodian | devanagari | gujarati | gurmukhi | kannada
|
||||
$list_item_marker = $rnum . $this->list_number_suffix;
|
||||
$blt_width = $this->GetStringWidth(str_repeat($this->dec2other(5, $cp),strlen($maxnum)).$this->list_number_suffix);
|
||||
break;
|
||||
case 'khmer':
|
||||
case 'cambodian':
|
||||
$cp = 0x17E0;
|
||||
$rnum = $this->dec2other($num, $cp);
|
||||
$list_item_marker = $rnum . $this->list_number_suffix;
|
||||
$blt_width = $this->GetStringWidth(str_repeat($this->dec2other(3, $cp),strlen($maxnum)).$this->list_number_suffix);
|
||||
break;
|
||||
case 'lao':
|
||||
$cp = 0x0ED0;
|
||||
$rnum = $this->dec2other($num, $cp);
|
||||
$list_item_marker = $rnum . $this->list_number_suffix;
|
||||
$blt_width = $this->GetStringWidth(str_repeat($this->dec2other(6, $cp),strlen($maxnum)).$this->list_number_suffix);
|
||||
break;
|
||||
default:
|
||||
if ($this->listDir == 'rtl') { $list_item_marker = $this->list_number_suffix . $num; }
|
||||
else { $list_item_marker = $num . $this->list_number_suffix; }
|
||||
@ -20643,10 +20688,10 @@ function _setBorderLine($b, $k=1) {
|
||||
$this->SetLineWidth($b['w']/$k);
|
||||
$this->SetDColor($b['c']);
|
||||
if ($b['c'][0]==5) { // RGBa
|
||||
$this->SetAlpha($b['c'][4], 'Normal', false, 'S')."\n";
|
||||
$this->SetAlpha(ord($b['c'][4])/100, 'Normal', false, 'S')."\n"; // mPDF 5.7.2
|
||||
}
|
||||
else if ($b['c'][0]==6) { // CMYKa
|
||||
$this->SetAlpha($b['c'][5], 'Normal', false, 'S')."\n";
|
||||
$this->SetAlpha(ord($b['c'][5])/100, 'Normal', false, 'S')."\n"; // mPDF 5.7.2
|
||||
}
|
||||
}
|
||||
|
||||
@ -23767,7 +23812,7 @@ function _tableColumnWidth(&$table,$firstpass=false){
|
||||
}
|
||||
else {
|
||||
$wi = $c['miw'] - $wis;
|
||||
foreach ($list as $k) { $wc[$k]['miw'] += ($wc[$k]['miw']/$wisa)*$wi; }
|
||||
foreach ($list as $k) { if (!isset($wc[$k]['w']) || !$wc[$k]['w']) $wc[$k]['miw'] += ($wc[$k]['miw']/$wisa)*$wi; } // mPDF 5.7.2
|
||||
}
|
||||
}
|
||||
if ($c['maw'] > $was) {
|
||||
@ -25813,7 +25858,7 @@ function _tableWrite(&$table, $split=false, $startrow=0, $startcol=0, $splitpg=0
|
||||
}
|
||||
}
|
||||
|
||||
if ($level==1) { $this->_out('___TABLE___BACKGROUNDS'.date('jY')); }
|
||||
if ($level==1) { $this->_out('___TABLE___BACKGROUNDS'.$this->uniqstr); }
|
||||
$tableheaderadj = 0;
|
||||
$tablefooteradj = 0;
|
||||
|
||||
@ -26076,12 +26121,12 @@ function _tableWrite(&$table, $split=false, $startrow=0, $startcol=0, $splitpg=0
|
||||
if ($this->tableBackgrounds) {
|
||||
$s = $this->PrintTableBackgrounds();
|
||||
if ($this->bufferoutput) {
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', '\\1'."\n".$s."\n", $this->headerbuffer);
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', " ", $this->headerbuffer );
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->headerbuffer);
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', " ", $this->headerbuffer );
|
||||
}
|
||||
else {
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', " ", $this->pages[$this->page]);
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', " ", $this->pages[$this->page]);
|
||||
}
|
||||
$this->tableBackgrounds = array();
|
||||
}
|
||||
@ -26103,7 +26148,7 @@ function _tableWrite(&$table, $split=false, $startrow=0, $startcol=0, $splitpg=0
|
||||
|
||||
$this->AddPage($this->CurOrientation);
|
||||
|
||||
$this->_out('___TABLE___BACKGROUNDS'.date('jY'));
|
||||
$this->_out('___TABLE___BACKGROUNDS'.$this->uniqstr);
|
||||
|
||||
|
||||
if ($this->tableClipPath ) { $this->_out($this->tableClipPath); }
|
||||
@ -26972,16 +27017,16 @@ function _tableWrite(&$table, $split=false, $startrow=0, $startcol=0, $splitpg=0
|
||||
if ($this->tableBackgrounds && $level == 1) {
|
||||
$s = $this->PrintTableBackgrounds();
|
||||
if ($this->table_rotate && !$this->processingHeader && !$this->processingFooter) {
|
||||
$this->tablebuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', '\\1'."\n".$s."\n", $this->tablebuffer);
|
||||
if ($level == 1) { $this->tablebuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', " ", $this->tablebuffer); }
|
||||
$this->tablebuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->tablebuffer);
|
||||
if ($level == 1) { $this->tablebuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', " ", $this->tablebuffer); }
|
||||
}
|
||||
else if ($this->bufferoutput) {
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', '\\1'."\n".$s."\n", $this->headerbuffer);
|
||||
if ($level == 1) { $this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', " ", $this->headerbuffer ); }
|
||||
$this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->headerbuffer);
|
||||
if ($level == 1) { $this->headerbuffer = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', " ", $this->headerbuffer ); }
|
||||
}
|
||||
else {
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||||
if ($level == 1) { $this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.date('jY').')/', " ", $this->pages[$this->page]); }
|
||||
$this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', '\\1'."\n".$s."\n", $this->pages[$this->page]);
|
||||
if ($level == 1) { $this->pages[$this->page] = preg_replace('/(___TABLE___BACKGROUNDS'.$this->uniqstr.')/', " ", $this->pages[$this->page]); }
|
||||
}
|
||||
$this->tableBackgrounds = array();
|
||||
}
|
||||
@ -28108,14 +28153,9 @@ function TOCpagebreak($tocfont='', $tocfontsize='', $tocindent='', $TOCusePaging
|
||||
}
|
||||
|
||||
function TOC_Entry($txt, $level=0, $toc_id=0) {
|
||||
$txt = $this->purify_utf8_text($txt);
|
||||
if ($this->text_input_as_HTML) {
|
||||
$txt = $this->all_entities_to_utf8($txt);
|
||||
}
|
||||
if ($this->usingCoreFont) { $txt = mb_convert_encoding($txt,$this->mb_enc,'UTF-8'); }
|
||||
// mPDF 5.7.2
|
||||
if ($this->ColActive) { $ily = $this->y0; } else { $ily = $this->y; } // use top of columns
|
||||
|
||||
// mPDF 5.6.19 mPDF 5.6.25 mPDF 5.6.37
|
||||
if (!class_exists('tocontents', false)) { include(_MPDF_PATH.'classes/tocontents.php'); }
|
||||
if (empty($this->tocontents)) { $this->tocontents = new tocontents($this); }
|
||||
$linkn = $this->AddLink();
|
||||
@ -28130,7 +28170,7 @@ function TOC_Entry($txt, $level=0, $toc_id=0) {
|
||||
|
||||
/*-- RTL --*/
|
||||
if ($this->biDirectional) {
|
||||
$txt = preg_replace("/([".$this->pregRTLchars."]+)/ue", '$this->ArabJoin(stripslashes(\'\\1\'))', $txt );
|
||||
$txt = preg_replace_callback("/([".$this->pregRTLchars."]+)/u", array($this, 'arabJoinPregCallback'), $txt ); // mPDF 5.7+
|
||||
}
|
||||
/*-- END RTL --*/
|
||||
if (strtoupper($toc_id)=='ALL') { $toc_id = '_mpdf_all'; }
|
||||
@ -28556,7 +28596,7 @@ function IndexEntry($txt, $xref='') {
|
||||
if ($this->keep_block_together) {
|
||||
if (isset($this->ktReference[$i]['t']) && $this->ktReference[$i]['t']==$txt){
|
||||
$Present=1;
|
||||
if (!in_array($this->page,$this->ktReference[$i]['p'])) {
|
||||
if ($this->page != $this->ktReference[$i]['op']) { // mPDF 5.7.2
|
||||
$this->ktReference[$i]['op'] = $this->page;
|
||||
}
|
||||
}
|
||||
@ -28565,7 +28605,7 @@ function IndexEntry($txt, $xref='') {
|
||||
else if ($this->table_rotate) {
|
||||
if (isset($this->tbrot_Reference[$i]['t']) && $this->tbrot_Reference[$i]['t']==$txt){
|
||||
$Present=1;
|
||||
if (!in_array($this->page,$this->tbrot_Reference[$i]['p'])) {
|
||||
if ($this->page != $this->tbrot_Reference[$i]['op']) { // mPDF 5.7.2
|
||||
$this->tbrot_Reference[$i]['op'] = $this->page;
|
||||
}
|
||||
}
|
||||
@ -28573,7 +28613,7 @@ function IndexEntry($txt, $xref='') {
|
||||
else if ($this->kwt) {
|
||||
if (isset($this->kwt_Reference[$i]['t']) && $this->kwt_Reference[$i]['t']==$txt){
|
||||
$Present=1;
|
||||
if (!in_array($this->page,$this->kwt_Reference[$i]['p'])) {
|
||||
if ($this->page != $this->kwt_Reference[$i]['op']) { // mPDF 5.7.2
|
||||
$this->kwt_Reference[$i]['op'] = $this->page;
|
||||
}
|
||||
}
|
||||
@ -28583,7 +28623,7 @@ function IndexEntry($txt, $xref='') {
|
||||
else if ($this->ColActive) {
|
||||
if (isset($this->col_Reference[$i]['t']) && $this->col_Reference[$i]['t']==$txt){
|
||||
$Present=1;
|
||||
if (!in_array($this->page,$this->col_Reference[$i]['p'])) {
|
||||
if ($this->page != $this->col_Reference[$i]['op']) { // mPDF 5.7.2
|
||||
$this->col_Reference[$i]['op'] = $this->page;
|
||||
}
|
||||
}
|
||||
@ -28719,7 +28759,7 @@ function CreateIndex($NbCol=1, $reffontsize='', $linespacing='', $offset=3, $use
|
||||
/*-- RTL --*/
|
||||
// Change Arabic + Persian. to Presentation Forms
|
||||
if ($this->biDirectional) {
|
||||
$this->Reference[$i]['t'] = preg_replace("/([".$this->pregRTLchars."]+)/ue", '$this->ArabJoin(stripslashes(\'\\1\'))', $this->Reference[$i]['t'] );
|
||||
$this->Reference[$i]['t'] = preg_replace_callback("/([".$this->pregRTLchars."]+)/u", array($this, 'arabJoinPregCallback'), $this->Reference[$i]['t'] ); // mPDF 5.7+
|
||||
}
|
||||
/*-- END RTL --*/
|
||||
|
||||
@ -29002,7 +29042,7 @@ function NewColumn() {
|
||||
|
||||
function printcolumnbuffer() {
|
||||
// Columns ended (but page not ended) -> try to match all columns - unless disabled by using a custom column-break
|
||||
if (!$this->ColActive && $this->ColumnAdjust && !$this->keepColumns) {
|
||||
if (!$this->ColActive && $this->ColumnAdjust && !$this->keepColumns) { // mPDF 5.7.2
|
||||
// Calculate adjustment to add to each column to calculate rel_y value
|
||||
$this->ColDetails[0]['add_y'] = 0;
|
||||
$last_col = 0;
|
||||
@ -29106,12 +29146,14 @@ function printcolumnbuffer() {
|
||||
$yadj = ($s['rel_y'] - $s['y']) - ($last_col_bottom)+$this->y0;
|
||||
// callback function
|
||||
$t = $s['s'];
|
||||
$t = preg_replace('/BT (\d+\.\d\d+) (\d+\.\d\d+) Td/e',"\$this->columnAdjustAdd('Td',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
|
||||
$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) ([\-]{0,1}\d+\.\d\d+) re/e',"\$this->columnAdjustAdd('re',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4')",$t);
|
||||
$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) l/e',"\$this->columnAdjustAdd('l',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
|
||||
$t = preg_replace('/q (\d+\.\d\d+) 0 0 (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) cm \/(I|FO)/e',"\$this->columnAdjustAdd('img',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4','\\5')",$t);
|
||||
$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) m/e',"\$this->columnAdjustAdd('draw',_MPDFK,$xadj,$yadj,'\\1','\\2')",$t);
|
||||
$t = preg_replace('/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) c/e',"\$this->columnAdjustAdd('bezier',_MPDFK,$xadj,$yadj,'\\1','\\2','\\3','\\4','\\5','\\6')",$t);
|
||||
|
||||
// mPDF 5.7+
|
||||
$t = $this->columnAdjustPregReplace('Td', $xadj, $yadj, '/BT (\d+\.\d\d+) (\d+\.\d\d+) Td/', $t);
|
||||
$t = $this->columnAdjustPregReplace('re', $xadj, $yadj, '/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) ([\-]{0,1}\d+\.\d\d+) re/', $t);
|
||||
$t = $this->columnAdjustPregReplace('l', $xadj, $yadj, '/(\d+\.\d\d+) (\d+\.\d\d+) l/', $t);
|
||||
$t = $this->columnAdjustPregReplace('img', $xadj, $yadj, '/q (\d+\.\d\d+) 0 0 (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) cm \/(I|FO)/', $t);
|
||||
$t = $this->columnAdjustPregReplace('draw', $xadj, $yadj, '/(\d+\.\d\d+) (\d+\.\d\d+) m/', $t);
|
||||
$t = $this->columnAdjustPregReplace('bezier',$xadj, $yadj, '/(\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) (\d+\.\d\d+) c/', $t);
|
||||
|
||||
$this->columnbuffer[$key]['s'] = $t;
|
||||
$this->columnbuffer[$key]['newcol'] = $newcolumn;
|
||||
@ -29466,6 +29508,16 @@ function printcolumnbuffer() {
|
||||
$this->breakpoints = array();
|
||||
}
|
||||
|
||||
// mPDF 5.7+
|
||||
function columnAdjustPregReplace($type, $xadj, $yadj, $pattern, $subject) {
|
||||
preg_match($pattern, $subject, $matches);
|
||||
if (!isset($matches[3])) { $matches[3] = 0; }
|
||||
if (!isset($matches[4])) { $matches[4] = 0; }
|
||||
if (!isset($matches[5])) { $matches[5] = 0; }
|
||||
if (!isset($matches[6])) { $matches[6] = 0; }
|
||||
return str_replace($matches[0], $this->columnAdjustAdd($type, _MPDFK, $xadj, $yadj, $matches[1], $matches[2], $matches[3], $matches[4], $matches[5], $matches[6]), $subject);
|
||||
}
|
||||
|
||||
/*-- END COLUMNS --*/
|
||||
|
||||
|
||||
@ -30127,6 +30179,11 @@ function reverse_letters($str) {
|
||||
return $this->mb_strrev($str, $this->mb_enc);
|
||||
}
|
||||
|
||||
// mPDF 5.7+
|
||||
function reverse_letters_preg_callback($matches) {
|
||||
return $this->reverse_letters($matches[1]);
|
||||
}
|
||||
|
||||
function magic_reverse_dir(&$chunk, $join=true, $dir) {
|
||||
if ($this->usingCoreFont) { return 0; }
|
||||
if ($this->biDirectional) {
|
||||
@ -30136,7 +30193,7 @@ function magic_reverse_dir(&$chunk, $join=true, $dir) {
|
||||
|
||||
// Change Arabic + Persian. to Presentation Forms
|
||||
if ($join) {
|
||||
$chunk = preg_replace("/([".$pregRTLchars."]+)/ue", '$this->ArabJoin(stripslashes(\'\\1\'))', $chunk );
|
||||
$chunk = preg_replace_callback("/([".$pregRTLchars."]+)/u", array($this, 'arabJoinPregCallback'), $chunk ); // mPDF 5.7+
|
||||
}
|
||||
$contains_rtl = false;
|
||||
$all_rtl = true;
|
||||
@ -30196,7 +30253,7 @@ function magic_reverse_dir(&$chunk, $join=true, $dir) {
|
||||
}
|
||||
else {
|
||||
// Reverse numerals only to RTL
|
||||
$sbit = preg_replace("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/ue", '$this->reverse_letters(\'\\1\')', $sbit ); // mPDF 5.6.32 // mPDF 5.6.46
|
||||
$sbit = preg_replace_callback("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/u", array($this, 'reverse_letters_preg_callback'), $sbit ); // mPDF 5.7+
|
||||
$sbits[$sbitkey] = $sbit;
|
||||
}
|
||||
}
|
||||
@ -30208,7 +30265,7 @@ function magic_reverse_dir(&$chunk, $join=true, $dir) {
|
||||
}
|
||||
else {
|
||||
// Reverse numerals only to RTL
|
||||
$bit = preg_replace("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/ue", '$this->reverse_letters(\'\\1\')', $bit ); // mPDF 5.6.32 // mPDF 5.6.46
|
||||
$bit = preg_replace_callback("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/u", array($this, 'reverse_letters_preg_callback'), $bit ); // mPDF 5.7+
|
||||
$bits[$bitkey] = $bit;
|
||||
}
|
||||
}
|
||||
@ -30219,7 +30276,7 @@ function magic_reverse_dir(&$chunk, $join=true, $dir) {
|
||||
$contains_rtl = true;
|
||||
|
||||
// Un-Reverse numerals back to ltr
|
||||
$chunk = preg_replace("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/ue", '$this->reverse_letters(\'\\1\')', $chunk ); // mPDF 5.6.13 // mPDF 5.6.32 // mPDF 5.6.46
|
||||
$chunk = preg_replace_callback("/([\x{0660}-\x{066C}0-9]+[\x{0660}-\x{066C}0-9\.,:\/]*[\x{0660}-\x{066C}0-9]+)/u", array($this, 'reverse_letters_preg_callback'), $chunk ); // mPDF 5.7+
|
||||
if ($dir == 'rtl') {
|
||||
if ($endSpace) { $chunk = ' '.$chunk; }
|
||||
if ($initSpace) { $chunk .= ' '; }
|
||||
@ -31193,7 +31250,7 @@ function AutoFont($html) {
|
||||
|
||||
/*-- CJK-FONTS --*/
|
||||
if ($this->autoFontGroups & AUTOFONT_CJK) {
|
||||
$e = preg_replace("/([".$this->pregCJKchars.$extra."]*[".$this->pregCJKchars."][".$this->pregCJKchars.$extra."]*)/ue", '$this->replaceCJK(stripslashes(\'\\1\'))', $e);
|
||||
$e = preg_replace_callback("/([".$this->pregCJKchars .$extra."]*[".$this->pregCJKchars ."][".$this->pregCJKchars .$extra."]*)/u", array($this, 'replaceCJKPregCallback'), $e ); // mPDF 5.7+
|
||||
}
|
||||
/*-- END CJK-FONTS --*/
|
||||
|
||||
@ -31202,7 +31259,7 @@ function AutoFont($html) {
|
||||
// HEBREW
|
||||
$e = preg_replace("/([".$this->pregHEBchars .$extra."]*[".$this->pregHEBchars ."][".$this->pregHEBchars .$extra."]*)/u", "\xef\xbf\xb0span lang=\"he\"\xef\xbf\xb1\\1\xef\xbf\xb0/span\xef\xbf\xb1", $e);
|
||||
// All Arabic
|
||||
$e = preg_replace("/([".$this->pregARABICchars .$extra."]*[".$this->pregARABICchars ."][".$this->pregARABICchars .$extra."]*)/ue", '$this->replaceArabic(stripslashes(\'\\1\'))', $e);
|
||||
$e = preg_replace_callback("/([".$this->pregARABICchars .$extra."]*[".$this->pregARABICchars ."][".$this->pregARABICchars .$extra."]*)/u", array($this, 'replaceArabicPregCallback'), $e ); // mPDF 5.7+
|
||||
}
|
||||
/*-- END RTL --*/
|
||||
|
||||
@ -31279,6 +31336,11 @@ function replaceCJK($str) {
|
||||
}
|
||||
return $str;
|
||||
}
|
||||
|
||||
// mPDF 5.7+
|
||||
function replaceCJKPregCallback($matches) {
|
||||
return $this->replaceCJK(stripslashes($matches[1]));
|
||||
}
|
||||
/*-- END CJK-FONTS --*/
|
||||
|
||||
/*-- RTL --*/
|
||||
@ -31318,6 +31380,11 @@ function replaceArabic($str) {
|
||||
return $str;
|
||||
}
|
||||
|
||||
// mPDF 5.7+
|
||||
function replaceArabicPregCallback($matches) {
|
||||
return $this->replaceArabic(stripslashes($matches[1]));
|
||||
}
|
||||
|
||||
// ARABIC ===========================
|
||||
// mPDF 5.4.08
|
||||
function InitArabic() {
|
||||
@ -31616,6 +31683,11 @@ function ArabJoin($str) {
|
||||
return $s;
|
||||
}
|
||||
|
||||
// mPDF 5.7+
|
||||
function arabJoinPregCallback($matches) {
|
||||
return $this->ArabJoin(stripslashes($matches[1]));
|
||||
}
|
||||
|
||||
// mPDF 5.4.08
|
||||
function get_arab_glyphs($char, $type) {
|
||||
if ($type>0 && isset($this->arabGlyphs[$char])) {
|
||||
@ -32061,7 +32133,7 @@ function AdjustHTML($html, $tabSpaces=8) {
|
||||
preg_match_all("/(<svg.*?<\/svg>)/si", $html, $svgi);
|
||||
if (count($svgi[0])) {
|
||||
for($i=0;$i<count($svgi[0]);$i++) {
|
||||
$file = _MPDF_TEMP_PATH.'_tempSVG'.RAND(1,10000).'_'.$i.'.svg';
|
||||
$file = _MPDF_TEMP_PATH.'_tempSVG'.uniqid(rand(1,100000),true).'_'.$i.'.svg';
|
||||
//Save to local file
|
||||
file_put_contents($file, $svgi[0][$i]);
|
||||
$html = str_replace($svgi[0][$i], '<img src="'.$file.'" />', $html); // mPDF 5.5.18
|
||||
@ -32137,12 +32209,14 @@ function AdjustHTML($html, $tabSpaces=8) {
|
||||
$iterator = 0;
|
||||
while($thereispre) //Recover <pre attributes>content</pre>
|
||||
{
|
||||
$temp[2][$iterator] = preg_replace("/^([^\n\t]*?)\t/me", "stripslashes('\\1') . str_repeat(' ', ( $tabSpaces - (mb_strlen(stripslashes('\\1')) % $tabSpaces)) )",$temp[2][$iterator]);
|
||||
$temp[2][$iterator] = preg_replace('/<([^a-zA-Z_:])/','<\\1',$temp[2][$iterator]); // mPDF 5.7.2
|
||||
$temp[2][$iterator] = preg_replace_callback("/^([^\n\t]*?)\t/m", array($this, 'tabs2spaces_callback'), $temp[2][$iterator]); // mPDF 5.7+
|
||||
$temp[2][$iterator] = preg_replace('/\t/',str_repeat(" ",$tabSpaces),$temp[2][$iterator]);
|
||||
|
||||
$temp[2][$iterator] = preg_replace('/\n/',"<br />",$temp[2][$iterator]);
|
||||
$temp[2][$iterator] = str_replace('\\',"\\\\",$temp[2][$iterator]);
|
||||
$html = preg_replace('#<pre(.*?)>(.*?)</pre>#si','<erp'.$temp[1][$iterator].'>'.$temp[2][$iterator].'</erp>',$html,1);
|
||||
//$html = preg_replace('#<pre(.*?)>(.*?)</pre>#si','<erp'.$temp[1][$iterator].'>'.$temp[2][$iterator].'</erp>',$html,1);
|
||||
$html = preg_replace('#<pre(.*?)>(.*?)</pre>#si','<erp'.$temp[1][$iterator].'>'.str_replace('$','\$',$temp[2][$iterator]).'</erp>',$html,1); // mPDF 5.7+
|
||||
$thereispre--;
|
||||
$iterator++;
|
||||
}
|
||||
@ -32170,6 +32244,14 @@ function AdjustHTML($html, $tabSpaces=8) {
|
||||
|
||||
return $html;
|
||||
}
|
||||
// mPDF 5.7+
|
||||
function tabs2spaces_callback($matches) {
|
||||
return (stripslashes($matches[1]) . str_repeat(' ', $this->tabSpaces - (mb_strlen(stripslashes($matches[1])) % $this->tabSpaces)));
|
||||
}
|
||||
// mPDF 5.7+
|
||||
function date_callback($matches) {
|
||||
return date($matches[1]);
|
||||
}
|
||||
|
||||
/*-- LISTS --*/
|
||||
function dec2other($num, $cp) {
|
||||
|
Loading…
Reference in New Issue
Block a user