mPDF
Text can be justified in table cells using in-line or stylesheet CSS. (Note that <p> tags are removed within cells along with any style definition or attributes.)
Col/Row Header |
Second column header p |
Third column header |
---|---|---|
Row header 1 | This is data | This is data |
Row header 2 |
This is data p |
This is data |
Row header 3 |
This is long data |
This is data |
Row header 4 <th> cell acting as header |
Proin aliquet lorem id felis. Curabitur vel libero at mauris nonummy tincidunt. Donec imperdiet. Vestibulum sem sem, lacinia vel, molestie et, laoreet eget, urna. Curabitur viverra faucibus pede. Morbi lobortis. Donec dapibus. Donec tempus. Ut arcu enim, rhoncus ac, venenatis eu, porttitor mollis, dui. Sed vitae risus. In elementum sem placerat dui. Nam tristique eros in nisl. Nulla cursus sapien non quam porta porttitor. Quisque dictum ipsum ornare tortor. Fusce ornare tempus enim. |
This is data |
Row header 5 | Also data | Also data |
Row header 6 | Also data | Also data |
Row header 7 | Also data | Also data |
Row header 8 | Also data | Also data |
http://www-950.ibm.com/software/globalization/icu/demo/converters?s=ALL&snd=4356&dnd=4356
Maecenas feugiat pede vel risus. Nulla et lectus eleifend verylongwordthatwontsplit neque sit amet erat
Maecenas feugiat pede vel risus. Nulla et lectus eleifend et verylongwordthatwontsplit neque sit amet erat
The next example has a non-breaking space between eleifend and the very long word.
Maecenas feugiat pede vel risus. Nulla et lectus eleifend verylongwordthatwontsplitanywhere neque sit amet erat
Nbsp will only work in fonts that have a glyph to represent the character i.e. not in the CJK languages nor some Unicode fonts.
This is strikethrough in block and small strikethrough in small span and big strikethrough in big span and then underline but out of span again but blue font and ACRONYM text
This is a green reference32-47 and underlined reference32-47 then reference32-47 and underlined reference32-47 then Strikethrough reference32-47 and strikethrough reference32-47 and then more text.
Repeated in BIG: This is reference32-47 and underlined reference32-47 then reference32-47 and underlined reference32-47 but out of span again but blue font and ACRONYM text
Repeated in small: This is reference32-47 and underlined reference32-47 then reference32-47 and underlined reference32-47 but out of span again but blue font and ACRONYM text
This is strikethrough in block and big strikethrough in big span and then underline but out of span again but blue font and ACRONYM text
This is reference32-47 and underlined reference32-47 then reference32-47 and underlined reference32-47 then Strikethrough reference32-47 and strikethrough reference32-47 then more text.
Repeated in BIG: This is reference32-47 and underlined reference32-47 then reference32-47 and underlined reference32-47 but out of span again but blue font and ACRONYM text
'; //============================================================== //============================================================== // NB This only works using Core Fonts // In other modes, you cannot set jSpacing at runtime, as it is // corrected automatically - unless you set useLang = false; //============================================================== include("../mpdf.php"); $mpdf=new mPDF('en-GB-c','A4','','',32,25,27,25,16,13); $mpdf->SetDisplayMode('fullpage'); // LOAD a stylesheet $stylesheet = file_get_contents('mpdfstyletables.css'); $mpdf->WriteHTML($stylesheet,1); // The parameter 1 tells that this is css/style only and no body/html/text $mpdf->WriteHTML($html); // SPACING $mpdf->WriteHTML("The PDF file definition will not allow word spacing to be changed in multibyte-encoded files. mPDF gets round this by changing the character spacing for each space. Thus both character- and word-spacing are possible. The default is a mixture of both. Only word spacing should be used for cursive languages such as Arabic, and character spacing is essential for CJK languages, where each character is a word.
"); $mpdf->jSpacing = 'C'; $mpdf->WriteHTML("Maecenas feugiat pede vel risus. Nulla et lectus eleifend verylongwordthatwontsplitanywhere neque sit amet erat
"); $mpdf->jSpacing = 'W'; $mpdf->WriteHTML("Maecenas feugiat pede vel risus. Nulla et lectus eleifend verylongwordthatwontsplitanywhere neque sit amet erat
"); $mpdf->jSpacing = ''; $mpdf->WriteHTML("Maecenas feugiat pede vel risus. Nulla et lectus eleifend verylongwordthatwontsplitanywhere neque sit amet erat
"); // ORPHANS $mpdf->WriteHTML("Punctuation marks should not be split when the last word on a line is in <tags> eg NATO. The punctuation should go to the next line with the word if necessary.
"); $mpdf->WriteHTML("Punctuation marks should not be split when the last word on a line is in <tags> e.g. UNESCO. The punctuation should go to the next line with the word if necessary.
"); $mpdf->WriteHTML("Single marks .,?!;:\xe2\x80\x9e\xe2\x80\x9d should be preserved when last word on a line is in <tags> e.g. NATO? All of these are automatically protected in mPDF.
"); $mpdf->orphansAllowed = 0; $mpdf->WriteHTML("Similarly, sub and super texts should not be split when justifying text such as references23. (Note that this sentence has the orphansAllowed set to zero.) Altering the value of \$mpdf->orphansAllowed will determine how many extra characters can be preserved on a line; the next line allows 3 (default value 5):
"); $mpdf->orphansAllowed = 3; $mpdf->WriteHTML("Similarly, sub and super texts should not be split when justifying text such as references23. The references should go to the next line with the word if necessary.
"); $mpdf->Output(); exit; ?>