All Projects → SIMITGROUP → phpjasperxml

SIMITGROUP / phpjasperxml

Licence: BSD-3-Clause license
This is a php wysiwyg report library

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to phpjasperxml

JimuReport
「低代码可视化报表」类似excel操作风格,在线拖拽完成设计!功能涵盖: 报表设计、图形报表、打印设计、大屏设计等,完全免费!秉承“简单、易用、专业”的产品理念,极大的降低报表开发难度、缩短开发周期、解决各类报表难题。
Stars: ✭ 2,895 (+7724.32%)
Mutual labels:  report, ireport
automation-report
Automation report是一款可以解决很多行业领域中设涉及到报告生成的需求,本项目最开始的初衷是为公司内部简化人工流程的一个环节,主要实现目的是将实验室检测得出的下机数据结果与对应的报告模版批量结合生成报告(.pdf)。
Stars: ✭ 13 (-64.86%)
Mutual labels:  report
blocko
A block-based WYSIWYG editor.
Stars: ✭ 43 (+16.22%)
Mutual labels:  wysiwyg
ed
Text editing with media widgets
Stars: ✭ 56 (+51.35%)
Mutual labels:  wysiwyg
wysihtml5-rails
A wysiwyg text editor for use in the Rails asset pipeline
Stars: ✭ 28 (-24.32%)
Mutual labels:  wysiwyg
bangle.dev
Collection of higher level rich text editing tools. It powers the local only note taking app https://bangle.io
Stars: ✭ 541 (+1362.16%)
Mutual labels:  wysiwyg
datart
Datart is a next generation Data Visualization Open Platform
Stars: ✭ 1,042 (+2716.22%)
Mutual labels:  report
django-survey
A django survey app that can export results as CSV or PDF using your native language.
Stars: ✭ 178 (+381.08%)
Mutual labels:  report
AsBuiltReport.VMware.vSphere
Repository for AsBuiltReport VMware vSphere module
Stars: ✭ 75 (+102.7%)
Mutual labels:  report
CellReport
CellReport 是一个netcore实现的、以复杂统计报表为核心目标的制作、运行工具。支持数据看板、大屏制作。你可以使用数据库、excel文件、api服务、已有报表等为数据源,通过内置的集合函数组织数据,以类excel界面设计最终呈现结果。
Stars: ✭ 196 (+429.73%)
Mutual labels:  report
yii2-content-tools
ContentTools editor implementation for Yii 2
Stars: ✭ 79 (+113.51%)
Mutual labels:  wysiwyg
tiny-editor
A tiny HTML rich text editor written in vanilla JavaScript
Stars: ✭ 58 (+56.76%)
Mutual labels:  wysiwyg
cazary
jQuery plugin of WYSIWYG editor that aims for fast, lightweight, stylish, customizable, cross-browser, and multi-language.
Stars: ✭ 12 (-67.57%)
Mutual labels:  wysiwyg
nullarbor
💾 📃 "Reads to report" for public health and clinical microbiology
Stars: ✭ 111 (+200%)
Mutual labels:  report
jodit-vue
Vue wrapper for Jodit Editor
Stars: ✭ 60 (+62.16%)
Mutual labels:  wysiwyg
poke
A simple tool to check your site for broken links, media, iframes, stylesheets, scripts, forms or metadata.
Stars: ✭ 24 (-35.14%)
Mutual labels:  report
django-flag-app
A pluggable django application that adds the ability for users to flag(or report) your models.
Stars: ✭ 13 (-64.86%)
Mutual labels:  report
Template-Informe
Template de informe en LaTeX para tareas y trabajos
Stars: ✭ 90 (+143.24%)
Mutual labels:  report
summernote-plugins
Some summernote plugins
Stars: ✭ 37 (+0%)
Mutual labels:  wysiwyg
awesome-newman-html-template
😎 A newman html report very detailed
Stars: ✭ 63 (+70.27%)
Mutual labels:  report

Introduction

This is php library read jasper report designed file (.jrxml) and generate pdf file.

The goal of this project is to allow php developer design reasonable good printable pdf easily with concept WYSIWYG. However, since the .jrxml file design for java project, phpjasperxml not able to make it 100% compatible in php environment. Refer compatibility description to know what you can do and what you cannot do.

It completely rewrite since version 1.x, if you use version 1.x before please verify your output carefully since it is more compatible to jasper studio, but may not work perfectly at last version.

Install

Latest phpjasperxml require php 7.4, and php extension like php-curl, php-intl, php-simplexml.

composer require simitgroup/phpjasperxml

How to use

<?php
require __DIR__."/vendor/autoload.php";

use simitsdk\phpjasperxml\PHPJasperXML;
$filename = __DIR__.'/sample.jrxml';

$data=[ ['user_id'=>0, 'fullname' => 'name1','email'=>'[email protected]','gender'=>'M' ], 
        ['user_id'=>1, 'fullname' => 'name2','email'=>'[email protected]','gender'=>'F' ], 
        ['user_id'=>2, 'fullname' => 'name3','email'=>'[email protected]','gender'=>'M' ], ];

$config = ['driver'=>'array','data'=>$data];

$report = new PHPJasperXML();
$report->load_xml_file($filename)    
    ->setDataSource($config)
    ->export('Pdf'); 

Refer https://github.com/SIMITGROUP/phpjasperxml/blob/master/examples/databasesample.php if you want to use database driver instead of prepare array.

Samples

Refer sample: https://github.com/SIMITGROUP/phpjasperxml/wiki/Sample-output

Compatibility:

Generally, phpjasperxml provide below compatiblity result of:

Bands

Band support both print order:

  • vertical
  • horizontal
Band Name Status Description
title First page only
page header
column header multiple column supported
detail(s) multiple band supported
column footer
page footer
last page footer
summary
no data
groups multiple group supported, in both vertical/horizontal print order

According try & error, there is some band like page header, column footer, page footer not allow grow according textField "stretchHeight". To make life easier phpjasperxml rules:

  1. only detail band will grow
  2. position type (default "Fix relative to top")
  3. stretch type (default "use Not stretch")
Element Status Description
textField
staticText
line Double line not supported
rectangle
circle
image Some scaleImage is not supported (Clip,RealHeight,RealSize). You can define image expression with base64 string too
barcode some standard is not supported, refer barcode example.
break column break not work nicely, in single page multple column also may error
subreport support basic fixed height sub report (the subreport will simply draw at current location and expand according data without consider band limits)
frame
chart
spiderchart
table
list
generic
custom visualzation
map

TextField and StaticText

TextField and Static Text is most important element in report. Below is the compatibility detail.

Setting Status Description
x
y
w
h
Forecolor
Backcolor
Font Changing font is configurable, but upstream (tcpdf) not support lot of fonts. Developer shall manually add font into yourproject/vendor/tecnickcom/tcpdf/fonts. Unicode character for Chinese, Japanese, Korean detected will replace as fixed font(So it display the content instead of show '?'. However, you have no way to change the their font ).
Transparent
Print Repeated Value Default = True
Label
Key
Remove Line When Blank
Print First Whole Band
Detail Overflow
Group Changes
Print When Expression
Paddings
Borders
Expressions
Text Adjust ScaleFont look differently compare to jasperreport
Text Align Horizontal
Text Align Vertical not work when Stretch Type = StretchHeight
Text Rotation
Pattern only support number
Pattern Expression only support number
Markup No markup, or html only
Hyperlink Reference Expression Link Type = Reference, will convert become html cell with hyperlink. Some format may lose

Line

Setting Status Description
x
y
w
h
Width
Color
Style Double line is not supported
Print When Expression

Rectangle

Setting Status Description
x
y
w
h
Print When Expression
Forecolor Line color override Forecolor
Backcolor
Transparent
Line Color Line color override Forecolor
Line Style
Line Width
Border Radius radius will cause line style/color/width weird due to bugs in tcpdf. dont use radius if you wish to change line style.

Ellipse

Setting Status Description
x
y
w
h
Print When Expression
Forecolor Line color override Forecolor
Backcolor
Transparent
Line Color Line color override Forecolor
Line Style
Line Width

Outputs

PHPJasperxml going to output report into several format.

Output Status Description
PDF done, not stable yet
XLSX Only support staticText and TextField
HTML coming future

Expressions

jrxml use a lot of expression which is defined as java(groovy) syntax. It not fit into php environment perfectly. Sometimes the report look nice in jasperstudio, but not exactly same in php. It is important to know how PHPJasperxml evaluate the expression, and the flow. Below is the flow:

  1. phpjasperxml extract expression string from specific element
  2. analyse expression using preg_match, and replace desire value into $F{},$V{},$P{}.
  3. If value data type is text/string kinds (Such as java.lang.String), it will apply quote/escape the string
  4. if quote exists, it will replace '+' become '.', cause php combine string using '.'
  5. then use eval() to evaluate it, get the final value. (Since eval() is not secure, you shall not allow untrusted developer define expression).

Expression used at many places, included present the value, set hyperlink, set image location, show/hide specific element or band. It is To make report present as expected, you shall define expression according below rules:

  1. Use more php style syntax: $F{fieldname} == "COMPAREME", instead of $F{fieldname}.equal("COMPAREME")
  2. If you perform some operation/comparison with expression, make sure you double check, compare result from jasperstudio and generated pdf from phpjasperxml.
  3. There is plenty of effort to make expression accurate, but I still recommend you perform calculation within sql, php level. Example: use sql calculate is more guarantee : SELECT a+b+c as result1 from mytable (assume a=1,b=2,c=3, then result1=6) then $F{a}+$F{b}+$F{c} // the result1 most probably = 6, but also possible become 123 (concate 3 string)

Variables

Variable is important, but very language dependent. Below is unsupported features:

  • Increment Type

Calculation Function

Calculation Status Description
No Calculation Function
Sum
Average
Highest
Lowest
First
Variance coming future
Standard Deviation coming future
Count coming future
Distinct Count coming future

Reset Types

Reset Type Status Description
Report
Page
Column
Groupxxx
None
Master No plan

Sort Fields

SortField support fields ASC and DESC. Variables/Function is not support

Scriptlet

Scriptlet is a method to allow report fetch specific value from existing functions. To compatible with jasperstudio as much as possible, we use expression method to define php code in Scriptlet description so in jasperstudio not complain. Then in phpjasperxml we will execute and put the value into scriptlet parameter. Refer script from jasperreport to know more.

How to use:

  1. Create scriptlet: "replace_as_alias"
  2. Define description in scriptlet: str_replace("@",'alias',$F{email})
  3. textField define value from scriptlet's parameter "$P{replace_as_alias_SCRIPTLET}"

Refer https://github.com/SIMITGROUP/phpjasperxml/blob/master/examples/groups.jrxml

Styles

Style template is ignore, and not effect element at the moment.

Supported Datasource:

samples

  1. Postgresql
  2. Mysql
  3. PDO (the rest of database)
  4. Array (prepare associate array outside of lib)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].