Skip to content

k-yamamura/thinreports-php

 
 

Repository files navigation

Thinreports Generator for PHP

Latest Stable Version Latest Unstable Version Build Status Code Climate

About

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.

What is Thinreports

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.

Getting Started

Supported versions

  • PHP 5.6

Quick Start

Step1 Install Thinreports Editor

See the Official Installation Guide.

Step2 Install Thinreports Generator for PHP

Put this line in your composer.json:

"require": {
  "thinreports-php/thinreports-php": "dev-master"
}

Then composer install or composer update:

$ composer install
-- or --
$ composer update

Step3 Create a report format file using the Editor

Follow "Step1 Creating the layout for the report" section in the official doucmentation.

Step4 Write code for generating a PDF

<?php
// date_default_timezone_set('Asia/Tokyo');

use Thinreports;

$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
$report->addPage(function ($new_page) {
    $new_page->setItemValues(['world' => 'Japan', 'thinreports' => 'PDF']);
});

$report->generate('hello_world.pdf');

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.

Quick Reference

TODO: Write a reference

Features

Implemented

See Quick Start and Quick Reference for currently available features.

Not Implemented

  • List
  • Multiple Layouts
  • Disabling Hyphenation
  • Font Fallback
  • Permission and Security settings of PDF

Other Tasks

  • Memory Usage Optimization
    • Disposing raw base64-data after generating a image file
  • Performance Optimization
    • Pre-Converting IPA-Font to AFM from TTF

Development Community

Gitter

License

Thinreports PHP is licensed under the MIT-License. See LICENSE for further details.

Dependency Library & Resource

TCPDF

LGPLv3 / Copyright (c) Nicola Asuni Tecnick.com LTD

IPA Font

IPA Font License Agreement v1.0

Copyright

Copyright (c) 2015 Matsukei Co.,Ltd.

About

An implementation of the Thinreports Generator in PHP. It provides easy and simple way for generating a PDF on pure PHP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%