Example 5
Description
The default text style (NORMAL) has a size of 9 points, uses font family ‘Helvetica’, the font color is black and the background is white. It acts as the base for all other predefined text styles in the following list.
-
- BOLD
-
- ITALIC
-
- UNDERLINE
-
- SMALLNORMAL
-
- SMALLBOLD
-
- HEADING1
-
- HEADING2
-
- HEADING3
-
- HEADING4
-
- TABLE_HEADER
-
- TABLE_ROW
-
- TABLE_SUBTOTAL
-
- TABLE_TOTAL
-
- FOOTER
-
- HEADER
This are only names, every of this text style can be used for any text in the report. Only the TABLE styles will be used by default for the respective row type.
Output
<?php include_once "../src/Report.php"; use Adi\ReportLib as ReportLib; // Create report instance // default format A4, portrait with margins left = 20mm, top = 10mm, right = 10mm and bottom = 10mm $report = new ReportLib\Report(); // Get ref to the report body $body = $report->getBody(); // Print example text with all predefined text styles $body->AddText("NORMAL (Helvetica, 9 points)", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::NORMAL)); $body->AddText("BOLD is the NORMAL style but bold font face", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::BOLD)); $body->AddText("ITALIC is the NORMAL style but italic", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::ITALIC)); $body->AddText("UNDERLINE is the NORMAL style but underlined", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::UNDERLINE)); $body->AddText("SMALLNOMRMAL is the NORMAL style but one point smaller", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::SMALLNORMAL)); $body->AddText("SMALLBOLD is the NORMAL style but one point smaller and bold face", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::SMALLBOLD)); $body->AddText("HEADING1 is the NORMAL style but nine points taller and bold face", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::HEADING1)); $body->AddText("HEADING2 is the NORMAL style but six points taller and bold face", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::HEADING2)); $body->AddText("HEADING3 is the NORMAL style but three points taller and bold face and italic", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::HEADING3)); $body->AddText("HEADING4 is the NORMAL style but one point taller and bold face and italic", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::HEADING4)); $body->AddText("TABLE_HEADER is the NORMAL style but one point smaller and bold", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::TABLE_HEADER)); $body->AddText("TABLE_ROW is the NORMAL style but one point smaller", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::TABLE_ROW)); $body->AddText("TABLE_SUBTOTAL is the NORMAL style but one point smaller and italic", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::TABLE_SUBTOTAL)); $body->AddText("TABLE_TOTAL is the NORMAL style but one point smaller and bold", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::TABLE_TOTAL)); $body->AddText("FOOTER is the NORMAL style but one point smaller", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::FOOTER)); $body->AddText("HEADER is the NORMAL style but one point smaller", ReportLib\TextStyles::getTextStyle(ReportLib\TextStyles::HEADER)); // Produce the output of the report // uses the same params as TCPDF (F = File, I = Preview etc.) $report->output(__DIR__ . "/example_005.pdf", 'I');