CHANGELOG.txt 15.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379
===========================
mPDF 5.4
14/02/2012
===========================


Files changed
-------------
mpdf.php
config.php
compress.php
classes/ttfontsuni.php
classes/barcode.php
classes/indic.php
classes/svg.php
examples/show_code.php	-----  SECURITY RISK**
examples/example49_changelog.php
examples/example57_new_mPDF_v5-3_active_forms_b (replace example57_new_mPDF_v5-3_active_forms)
includes/out.php
mpdfi/fpdi_pdf_parser.php

Files added
-----------
classes/bmp.php
classes/directw.php
classes/form.php
classes/grad.php
classes/tocontents.php
classes/wmf.php
examples/example58_new_mPDF_v5-4_features

config.php changes
------------------
Edited: $this->allowedCSStags, $this->innerblocktags, $this->defaultCSS;  (CAPTION added in each case)
Moved: Numerous $form_.. variables are now in /classes/form.php

New config variables 
--------------------
$this->bookmarkStyles = array();
$this->cacheTables = true;
	
New methods
-----------
function CircularText()
function SetVisibility()

New/Extended CSS
----------------
box-shadow (block elements - does NOT support "inset")
text-shadow (all text elements - does NOT support "blur")
visibility: visible|hidden|printonly|screenonly (block-level elements and images IMG only)
text-transform: capitalize|uppercase|lowercase (extended to support TD/TH)
tr|td|th:nth-child(odd|even|2n+1)
color, strikethrough, underline and background-color (extended to support rotated TD/TH)
underline and strike-through (extended to support TD/TH)
underline (line colour)  (extended to work correctly in watermark)
page-break-after: left|right|always (block elements and tables)
	NB respects $mpdf->restoreBlockPagebreaks = true; i.e. will make pagebreak act like formfeed
background[-color]: extended to support rgba|cmyka|cmyk|hsla|hsl|spot
border(extended to support inline elements)


New HTML
--------
<caption>
<textcircle />


New features / Improvements
---------------------------
Tables - Zebra Stripes
Tables: overlapping rowspans (partially) supported
Tables - Disk caching
Using progress bars (or $showStats) now reports 'real' memory usage i.e. get_memory_usage(true)
Support for query string in the URLs for external stylesheets e.g. @import url("style.css?ltcyy7");
Table caption partially supported
CircularText
BookMark styling
Spread tables i.e. can split table (columns) across several pages width.
Can use chelvetica, ctimes and ccourier to specify core fonts in a non-core font document
Spread tables i.e. can split table (columns) across several pages width.
{colsum} in <tfoot> cell will insert a column total per page.
SVG embedded as island in HTML supported
Active Forms
	textarea and input (text types) now accept javascript as:
	onKeystroke, onValidate, onCalculate and onFormat
	onChange is depracated but works as onCalculate (for textarea and input)
	(PS Select still accepts onChange cf. 5.3.37)
Ledger and Tabloid added as page formats recognised. NB Ledger is same as tabloid but landscape. In mPDF, both give the same size (portrait)
so need to add -L e.g. Ledger-L for landscape.


Internal script changes
-----------------------
Changed this->k to _MPDFK throughout all scripts
Changes to color (packed binary data in string rather than array) to reduce memory usage esp in tables
Internal variables Removed
	$usetableheader;
	$tableheadernrows;
	$tablefooternrows;
vars $ChangePage, $p_bottom_border, $img_margin_top(+) $issetcolor + other similar  removed

Removed a whole load of // comments
Updates to remove some more Warning Notices (not all marked in text)
Border set on TR - changed so set on each cell, rather than retrospectively at end of TR
All references to table['text'] removed as not needed - uses ['textbuffer'] instead
OpenTag(TD) changes to reduce memory usage with tables
Includes different method to set a default timezone
fn _smallCaps does not need (undefined) $space
this->chrs and this->ords replaced by chr() and ord()
Headers in out.php updated to match those used in Output()
Change to SetFont() to improve performance time
Change to GetStringWidth() to improve performance time
Corrected copying of Glyphs 0,1,2, to all subset fonts (non-SMP/SIP), and only setting 32->127 in subset
Subset fonts (non-SMP/SIP) have additionally Unicode CMap tables (0,0,4 and 0,3,4) as well as Microsoft (3,1,4)
Subset fonts (SMP/SIP) have CMap tables (1,0,6 and 3,0,4) - rather than 1,0,6 and 3,0,6
Subset fonts (SMP/SIP) have 'name' table changed to give 1,0 and 3,0. As it is a symbol font (not Unicode encoded) :
	needs to have a name entry in 3,0 (e.g. symbol) - original font will have 3,1 (i.e. Unicode)
Automatically checks for HTML code length > 100000 characters and gives error warning if
	 PHP < 5.2.0 (as not configurable) or increases pcre.backtrack_limit if PHP < 5.3.7

Removed/Depracated
------------------
function UseTableHeader($opt=true)	fn removed / depracated
function UsePRE($opt=true) removed
$attr['REPEAT_HEADER'] == true		CSS removed / depracated
$this->usepre=true; removed / depracated as never needed - always respects PRE whitespace

ToC: NB Values can no longer be set directly e.g. as in example
	$mpdf->TOCheader = array();	// array as for setting header/footer
	$mpdf->TOCfooter = array();	// array as for setting header/footer
	$mpdf->TOCpreHTML = '<h2>Contents - Portrait</h2>';	// HTML text to appear before table of contents
	$mpdf->TOCpostHTML = '';	// HTML text to appear after table of contents
	$mpdf->TOCbookmarkText = 'Content list';	// Text as it will appear in the Bookmarks (leave blank for none)
Need to use TOCpagebreak either direct (or array version) or as HTML
OR if absolutley necessary, could use:
	$mpdf->tocontents->TOCheader = array();	// array as for setting header/footer
	$mpdf->tocontents->TOCfooter = array();	// array as for setting header/footer
	$mpdf->tocontents->TOCpreHTML = '<h2>Contents - Portrait</h2>';	// HTML text to appear before table of contents
	$mpdf->tocontents->TOCpostHTML = '';	// HTML text to appear after table of contents
	$mpdf->tocontents->TOCbookmarkText = 'Content list';	// Text as it will appear in the Bookmarks (leave blank for none)



Further Details
===============

CSS border on inline elements
-----------------------------
Support for CSS border (and variants) on inline elements e.g. <span style="border-bottom: 1px dashed #000000;">
Border styles solid|dotted|dashed|double only are supported. Border radius not supported.
Nested inline elements will have repeat left|right borders on the nested content (unlike browsers)

Tables - Zebra Stripes
----------------------
TABLE - striped rows cf. http://dev.opera.com/articles/view/zebra-striping-tables-with-css3/
tr:nth-child(odd) { background-color: #99ff99; }
thead tr:nth-child(3n+2) { background-color: #FFBBFF; }
td:nth-child(2n+1) { background-color: #BBBBFF; }
table.zebraTable td:nth-child(2n+1) { background-color: #BBBBFF; }
table.zebraTable th:nth-child(2n+1) { background-color: #BBBBFF; }

NB mPDF does NOT correctly apply specificity to all CSS
table.zebra tbody tr:nth-child(2n+1) td { background-color: #FFFFBB; }
table.zebra tbody td:nth-child(odd) { background-color: #BBBBFF; }

should make every odd row yellow, and every odd coloumn blue, but with the row/yellow overriding the column/blue.
In mPDF the td:nth-child(odd) trumps the plain td, so the column colour wins out. You can force the effect you want by using
table.zebra tbody tr:nth-child(2n+1) td:nth-child(1n+0) { background-color: #FFFFBB; }

(The :nth-child(1n+0) selector just selects every td cell.)



Tables - Disk caching
---------------------
TABLES: using disk caching
// Using disk to cache table data can reduce memory usage dramatically, but at a cost of increased 
// executon time and disk access (read and write)
$this->cacheTables = true;
NB		$this->packTableData will be overridden to => true;	// required for cacheTables
		$this->simpleTables will be overridden to => false;  // Cannot co-exist with cacheTables


Table caption
-------------
Must come immediately after <table...>
CSS caption-side and HTML align attribute of top|bottom supported (not attribute left|right)
Handled as a separate block element brought outside the table, so:
	CSS will not cascade correctly on the table
	width of caption block is that of page or of the block element containing the table
	so alignment will be to the page-width not the table width
	if table page-break-after: always, the caption will follow the pagebreak.
This does work:
<style>
.tablecaption { caption-side: bottom; text-align: left; font-weight: bold; color: green; }
</style>
...
<table>
<caption class="tablecaption">Caption title here</caption>
<tbody>

CSS visibility: printonly, screenonly
-------------------------------------
Roughly based on CSS

Works on Block elements P, DIV etc, or Image
Cannot nest / layer.
Inner blocks/image with set visibility are ignored if already set on enclosing block element.
(Block element) does not work inside table (image does)
So 'visible' does nothing but is set as default
(NB Changes output to PDF version 1.5)
Incompatible with PDFA / PDFX

'visibility'
    Value:  	visible | hidden | (collapse | inherit)
    Initial:  	visible
    Applies to:  	all elements
    Inherited:  	yes

The 'visibility' property specifies whether the boxes generated by an element are rendered.
Invisible boxes still affect layout (set the 'display' property to 'none' to suppress box generation altogether).
Values have the following meanings:

visible
    The generated box is visible.
hidden
    The generated box is invisible (fully transparent, nothing is drawn), but still affects layout.
	Furthermore, descendants of the element will be visible if they have 'visibility: visible'.
collapse | inherit
    NOT supported in mPDF

CUSTOM:
printonly | screenonly


Added VISIBILITY function
$mpdf->SetVisibility('screenonly'); or 'printonly' 'visible' or 'hidden'
(NB Changes output to PDF version 1.5)
Incompatible with PDFA / PDFX

CircularText
------------
function CircularText($x, $y, $r, $text, $align='top', $kerning=120, $fontwidth=100) {
x: abscissa of center
y: ordinate of center
r: radius of circle
text: text to be printed
align: text alignment: top or bottom. Default value: top
kerning: spacing between letters in percentage. Default value: 120. Zero is not allowed.
fontwidth: width of letters in percentage. Default value: 100. Zero is not allowed

- now uses Kerning between letters if useKerning == true (set manually see example)

BookMark styling
----------------
New configurable variable to control appearance of Bookmarks e.g.
$this->bookmarkStyles = array(
	0 => array('color'=> array(0,64,128), 'style'=>'B'),
	1 => array('color'=> array(128,0,0), 'style'=>''),
	2 => array('color'=> array(0,128,0), 'style'=>'I'),
);
	
Column sums
-----------
(Also changed some preg_replace to str_replace to improve performance)
To use: just add {colsum} to any cells of the table footer <tfoot>
Add a number to specify a fixed number of decimal points e.g. <td>{colsum2}</td>  will give you 123.40
The width of the column will be calculated using the actual string {colsum} as a placeholder.
If you need the column to be wider, use underscores "_" to pad it e.g. {colsum2_____}


Spread tables
-------------
i.e. can split table (columns) across several pages width.
CSS <table style="overflow: visible">
Cannot use with: 
$this->kwt - ignored
$this->table_rotate - ignored
$this->table_keep_together - ignored
$this->ColActive  - cancels spread tables

Messes up with:
$mpdf->forcePortraitHeaders = true;
$mpdf->forcePortraitMargins = true;
Problems with CJK, and RTL

Will do no resizing of fonts at all.
Maximum width of column = page width i.e. will not split columns across pages - NB will keep colspan>1 on one page
If table row too high for page will die with error message.
Will override some specs for width if this creates conflicts
Recommended to specify absolute value of width on each column.




Bug fixes
=========
Dottab - if text after dottab is hyperlinked <a></a> then dots are underlined

page-break-before now respects $mpdf->restoreBlockPagebreaks = true; i.e. will make pagebreak act like formfeed
Annotation() function called directly with colorarray(r,g,b)

Added urldecode to _getImage to cope with ../name%20of%20image.jpg
Added urldecode AND htmlspecials_decode to href in <a> link e.g. https://www.google.com/search?hl=en&amp;q=mpdf&amp;filename=name%20of%20file
[barcode.php] Allow &nbsp; in C39 codes - will be changed to spaces

<table> inside a <div position:fixed, left:300px;> not calculating table width correctly
	- leading to either upside down table or error width less than 1 character

Depracated magic_quotes_runtime() in compress.php

DIRECTW included twice in compress.php
FORMS mark up for compress.php corrected

double backslashes not preserved inside <pre> or <textarea>

font-weight and font-style not recognised in <pageheader>

Progress bars causing corrupt PDF file (out.php) changed fopen from "r" mode to "rb" (binary)
Target around image - <a href="#internaltarget"><img ... /></a> - not working

SmallCaps in <thead> error

Fonts with "name" table in format 1 not recognised correctly
Rotated table which does not fit on remaining page, forces a new page even if already at top of page

Locale causing problems - all instances of sprintf() using %.3f changed to %.3F so not locale aware

CSS border radius not implemented on fixed/absolute positioned block element

Background color in rotated table extending way beyond bottom of table

Nested table containing <thead> or <tfoot> was confused with <thead> or <tfoot> of parent table

Correct handling of spaces, < or & in textarea

<option> and <input ..> attributes value/title decoded with fn lesser_entity_decode instead of htmlspecialchars_decode to include &apos;

line width not restored to correct value after "line-through" text in Cell()

Kannada - incorrect positioning of Reph

Forms - In <input> or <option> (select) not correctly handling HTML named entities e.g. &lt; in value or title
Active forms - &nbsp; as Value or Title incorrectly showing as Euro - PDFDocEncoding fixed

Unicode data in embedded fonts not encrypted when doc encrypted 

Nested block elements which are empty including innermost one, top margin of innermost block was ignored

font-size: xx% inside a block was setting on block's parent font-size

Active forms - radio buttons (removed name from Widget - leave on Radio group)
	causing problems accessing field for radio buttons

When using simple tables and border-collapse, if table border set, but cell borders not set, should display table border (fixed)
position:fixed block - if neither top nor bottom nor height specified, was positioned incorrectly (y)
Leave - if top, bottom, margin-top, margiin-bottom and height are all left unspecified (or auto), will centre vertically
on the page (specific to mPDF - not consistent with CSS2.1)
But if any one of them are specified (including e.g. margin-top=0), follows CSS spec, so top is the current "static" position

background-image-opacity=0 not working on BODY or BLOCK

Lists - if LI continues after a nested List, would add as a new LI item (should continue as part of earlier LI item)

fn WriteCell() converts to 'windows-1252' when required
if multiple calls to mPDF used, cannot redefine function cmp()
internal link targets <a name="xx" /> in ToC not moved when using: page-break-inside:avoid
internal link targets <a name="xx" /> not moved when using: columns, page-break-inside:avoid, keep-with-table or table rotate

Active Forms - onChange not working for SELECT (cf. 5.3.25) Example 57 only worked by chance as JS was carried over from Select to Text field
Bug is fixed, but example file needed updating to onCalculate for the display field.

Table cell: if height set as %, currently sets it as % of page-width; instead this now ignores it.

Bengali letter Khanda Ta (U+09CE) character not recognised; was added in Unicode v4.1 and prior to this, (U+09A4 U+09CD U+200D)
	so mPDF converts to this string and seems to work.

OCR characters wrong size in barcodes if using different ocr font