Last active
January 17, 2020 09:27
-
-
Save nunomazer/8421402 to your computer and use it in GitHub Desktop.
Using PHP client for Jaspersoft Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Initializing client */ | |
require_once "client/JasperClient.php"; | |
$client = new Jasper\JasperClient('localhost', // Hostname | |
8080, // Port | |
'jasperadmin', // Username | |
'jasperadmin', // Password | |
'/jasperserver-pro', // Base URL | |
'organization_1'); // Organization (pro only) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$report_options = $client->getReportOptions('/reports/samples/Cascading_multi_select_report'); | |
foreach($report_options as $ro) { | |
echo $ro->getLabel() . " | |
"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$report = $client->runReport('/reports/samples/AllAccounts', 'pdf'); | |
header('Cache-Control: must-revalidate'); | |
header('Pragma: public'); | |
header('Content-Description: File Transfer'); | |
header('Content-Disposition: attachment; filename=report.pdf'); | |
header('Content-Transfer-Encoding: binary'); | |
header('Content-Length: ' . strlen($report)); | |
header('Content-Type: application/pdf'); | |
echo $report; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$controls = array('Country_multi_select' => array('USA', 'Mexico'), | |
'Cascading_state_multi_select' => array('CA', 'OR')); | |
$report = $client->runReport('/reports/samples/Cascading_multi_select_report','html', null, $controls); | |
echo $report; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$report = $client->runReport('/reports/samples/AllAccounts', 'html'); | |
// The URI string could also be found from a resourceDescriptor object using the getUriString() method | |
echo $report; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment