Skip to content

Commit 5158ada

Browse files
committed
updated docs
1 parent 764bebd commit 5158ada

File tree

2 files changed

+130
-8
lines changed

2 files changed

+130
-8
lines changed

README.md

Lines changed: 64 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ This package is the solution to compile and process JasperReports (.jrxml & .jas
1818
**Note for Linux servers?**
1919

2020
Do not forget to grant permission 777 for the directory
21-
**/vendor/geekcom/phpjasper/src/JasperStarter/bin** and the file binary **jasperstarter**
21+
**/vendor/geekcom/phpjasper/bin/jasperstarter/bin** and the file binary **jasperstarter**
2222

2323
**Do you need to generate Python reports?**
2424

@@ -28,7 +28,7 @@ Meet the **[pyreport](https://github.com/jadsonbr/pyreport)**
2828

2929
Did you ever had to create a good looking Invoice with a lot of fields for your great web app?
3030

31-
I had to, and the solutions out there were not perfect. Generating *HTML* + *CSS* to make a *PDF*? WTF? That doesn't make any sense! :)
31+
I had to, and the solutions out there were not perfect. Generating *HTML* + *CSS* to make a *PDF*? That doesn't make any sense! :)
3232

3333
Then I found **JasperReports** the best open source solution for reporting.
3434

@@ -167,7 +167,7 @@ $jasper->process(
167167

168168
Now check the examples folder! :) Great right? You now have 2 files, `hello_world.pdf` and `hello_world.rtf`.
169169

170-
Check the *API* of the `compile` and `process` functions in the file `src/JasperPHP/JasperPHP.php` file.
170+
Check the *methods* `compile` and `process` in `src/JasperPHP.php` for more details
171171

172172
####Listing Parameters
173173

@@ -263,6 +263,67 @@ $jasper->process(
263263
)->execute();
264264
```
265265

266+
###Reports from a XML
267+
268+
```php
269+
require __DIR__ . '/vendor/autoload.php';
270+
271+
use JasperPHP\JasperPHP;
272+
273+
$input = '/your_input_path/your_report.jasper';
274+
$output = '/your_output_path';
275+
$data_file = __DIR__ . '/your_data_files_path/your_xml_file.xml';
276+
$options = [
277+
'format' => ['pdf'],
278+
'params' => [],
279+
'locale' => 'en',
280+
'db_connection' => [
281+
'driver' => 'xml',
282+
'data_file' => $data_file,
283+
'xml_xpath' => '/your_xml_xpath'
284+
]
285+
];
286+
287+
$jasper = new JasperPHP;
288+
289+
$jasper->process(
290+
$input,
291+
$output,
292+
$options
293+
)->execute();
294+
```
295+
296+
###Reports from a JSON
297+
298+
```php
299+
require __DIR__ . '/vendor/autoload.php';
300+
301+
use JasperPHP\JasperPHP;
302+
303+
$input = '/your_input_path/your_report.jasper';
304+
$output = '/your_output_path';
305+
306+
$data_file = __DIR__ . '/your_data_files_path/your_json_file.json';
307+
$options = [
308+
'format' => ['pdf'],
309+
'params' => [],
310+
'locale' => 'en',
311+
'db_connection' => [
312+
'driver' => 'json',
313+
'data_file' => $data_file,
314+
'json_query' => 'your_json_query'
315+
]
316+
];
317+
318+
$jasper = new JasperPHP;
319+
320+
$jasper->process(
321+
$input,
322+
$output,
323+
$options
324+
)->execute();
325+
```
326+
266327
###MySQL
267328

268329
We ship the [MySQL connector](http://dev.mysql.com/downloads/connector/j/) (v5.1.39) in the `/src/JasperStarter/jdbc/` directory.

docs/pt_BR/LEIA-ME_pt_BR.md

Lines changed: 66 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Este pacote é a solução perfeita para compilar e processar relatórios Jasper
2020
**Seu servidor é Linux?**
2121

2222
Não esqueça de fornecer permissão 777 para o diretório
23-
**/vendor/geekcom/phpjasper/src/JasperStarter/bin** e para o arquivo binário **jasperstarter**
23+
**/vendor/geekcom/phpjasper/bin/jasperstarter/bin** e para o arquivo binário **jasperstarter**
2424

2525
**Precisa gerar relatórios em Python?**
2626

@@ -116,7 +116,7 @@ E execute o comando:
116116

117117
###*Hello World* PHPJasper.
118118

119-
Vá para o diretório de exemplos na raiz do repositório (`vendor/copam/phpjasper/examples`).
119+
Vá para o diretório de exemplos na raiz do repositório (`vendor/geekcom/phpjasper/examples`).
120120
Abra o arquivo `hello_world.jrxml` com o JasperStudio ou seu editor favorito e dê uma olhada no código.
121121

122122
#### Compilando
@@ -186,7 +186,7 @@ foreach($output as $parameter_description)
186186

187187
###Relatórios a partir de um banco de dados
188188

189-
Adicione os parâmetros específicos para conexão com seu banco de dados:
189+
Adicione os parâmetros específicos para conexão com seu banco de dados: MYSQL, POSTGRES ou MSSQL:
190190

191191
```php
192192
require __DIR__ . '/vendor/autoload.php';
@@ -197,7 +197,7 @@ $input = '/your_input_path/your_report.jasper';
197197
$output = '/your_output_path';
198198
$options = [
199199
'format' => ['pdf'],
200-
'locale' => 'en',
200+
'locale' => 'pt_BR',
201201
'params' => [],
202202
'db_connection' => [
203203
'driver' => 'postgres',
@@ -235,7 +235,7 @@ $output = '/your_output_path';
235235
$jdbc_dir = __DIR__ . '/vendor/geekcom/phpjasper/bin/jaspertarter/jdbc';
236236
$options = [
237237
'format' => ['pdf'],
238-
'locale' => 'en',
238+
'locale' => 'pt_BR',
239239
'params' => [],
240240
'db_connection' => [
241241
'driver' => 'generic',
@@ -259,6 +259,67 @@ $jasper->process(
259259
)->execute();
260260
```
261261

262+
###Relatórios a partir de um arquivo XML
263+
264+
```php
265+
require __DIR__ . '/vendor/autoload.php';
266+
267+
use JasperPHP\JasperPHP;
268+
269+
$input = '/your_input_path/your_report.jasper';
270+
$output = '/your_output_path';
271+
$data_file = __DIR__ . '/your_data_files_path/your_xml_file.xml';
272+
$options = [
273+
'format' => ['pdf'],
274+
'params' => [],
275+
'locale' => 'pt_BR',
276+
'db_connection' => [
277+
'driver' => 'xml',
278+
'data_file' => $data_file,
279+
'xml_xpath' => '/your_xml_xpath'
280+
]
281+
];
282+
283+
$jasper = new JasperPHP;
284+
285+
$jasper->process(
286+
$input,
287+
$output,
288+
$options
289+
)->execute();
290+
```
291+
292+
###Relatórios a partir de um arquivo JSON
293+
294+
```php
295+
require __DIR__ . '/vendor/autoload.php';
296+
297+
use JasperPHP\JasperPHP;
298+
299+
$input = '/your_input_path/your_report.jasper';
300+
$output = '/your_output_path';
301+
302+
$data_file = __DIR__ . '/your_data_files_path/your_json_file.json';
303+
$options = [
304+
'format' => ['pdf'],
305+
'params' => [],
306+
'locale' => 'pt_BR',
307+
'db_connection' => [
308+
'driver' => 'json',
309+
'data_file' => $data_file,
310+
'json_query' => 'your_json_query'
311+
]
312+
];
313+
314+
$jasper = new JasperPHP;
315+
316+
$jasper->process(
317+
$input,
318+
$output,
319+
$options
320+
)->execute();
321+
```
322+
262323
###MySQL
263324

264325
Incluímos o [MySQL connector](http://dev.mysql.com/downloads/connector/j/) (v5.1.39) na pasta `/src/JasperStarter/jdbc/`

0 commit comments

Comments
 (0)