Thinreports Generator for PHP is an implementation of the Thinreports Generator in PHP. It provides easy and simple way for generating a PDF on pure PHP.
Thinreports is an open source report generation tools. It provides the Thinreports Editor which is a tool for designing a report format, and the Thinreports Generator for Ruby which is a library for generating a PDF.
Please see the following pages for further details.
- Performance improvements on rendering texts with unicode-fonts
- Multiple layouts support
See also: Changes in version alpha1 and alpha2.
- PHP 5.3, 5.4, 5.5, 5.6, 7
- See build result on TravisCI
- Thinreports Editor >= 0.8
See the Official Installation Guide.
$ composer require thinreports-php/thinreports-php:0.8.0-alpha2
Follow "Step1 Creating the layout for the report" section in the official doucmentation.
<?php
// date_default_timezone_set('Asia/Tokyo');
$report = new Thinreports\Report('hello_world.tlf');
// 1st page
$page = $report->addPage();
$page->item('world')->setValue('World');
$page->item('thinreports')->setValue('Thinreports');
// 2nd page
$page = $report->addPage();
$page('world')->setValue('PHP');
$page('thinreports')->setValue('Thinreports PHP');
// 3rd page
$page = $report->addPage();
$page('world')->setValue('World')
->setStyle('color', '#ff0000');
$page('hello')->hide();
// 4th page
$page = $report->addPage();
$page->setItemValue('thinreports', 'PDF');
$page->setItemValues(array(
'world' => 'PHP'
));
// 5th page
$page = $report->addPage();
$page->item('world_image')->setSource('/path/to/world.png');
$report->generate('hello_world.pdf');
// You can get content of the PDF in the following code:
$pdf_data = $report->generate();
NOTE: If you want to render multi-byte characters such as "日本語", you need to configure the IPAFont to font-family property of the Text-block in the Editor.
TODO: Write a reference
See Quick Start and Quick Reference for currently available features.
- List
- Multiple Layouts
- Disabling Hyphenation
- Font Fallback
- Permission and Security settings of PDF
- Memory Usage Optimization
- Disposing raw base64-data after generating a image file
- Performance Optimization
- Pre-Converting IPA-Font to AFM from TTF
Thinreports PHP is licensed under the MIT-License. See LICENSE for further details.
LGPLv3 / Copyright (c) Nicola Asuni Tecnick.com LTD
IPA Font License Agreement v1.0
Copyright (c) 2015 Matsukei Co.,Ltd.