I try to generate pdf from PHPJasper and this error come and i cannot find a solution for. Please tel me answer or any other way to generate reports
"Your report has an error and couldn 't be processed!\ Try to output the command using the function
output();
and run it manually in the console."
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPJasper\PHPJasper;
try{
$input = __DIR__ . '/Report/Coffee.jasper';
$output = __DIR__ . '/Report';
$options = ['format' => ['pdf']];
$jasper = new PHPJasper;
$jasper->process($input, $output, $options)->execute();
} catch(Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
Did you try the output() command as mentioned in the message?
You can try something easy as this and check the output of it:
$x = $jasper->process(
$input,
$output,
$options
)->output();
print_r($x);
exit(1);//just to avoid getting error handler on your framework
Sometimes that will tell you more information. If it shows the command line to execute, try executing it directly on your command line, you might get more information there.
Common things to consider: - The user (probably the Web server user in your case) has no access or write access to the folder where you are creating the file - Perhaps the line was already generated before, and the error is that the file already exists. Try generating a random name for each report generation to avoid this; or generate the file, serve it in the application and delete it