Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources in report #99

Closed
Azariil opened this issue Apr 24, 2018 · 3 comments
Closed

Resources in report #99

Azariil opened this issue Apr 24, 2018 · 3 comments

Comments

@Azariil
Copy link

Azariil commented Apr 24, 2018

Hi.
I use the image in the report for the logo.

<image>
        <reportElement x="10" y="10" width="50" height="50" uuid="6b170fd6-161e-40ff-ab0b-284c062091b2"/>
        <imageExpression><![CDATA["img/logo.png"]]></imageExpression>
</image>

But I had one problem. If I use only parameters in the report, the report is not generated, because the parameter "-r" is missing. This happens because in this code section this parameter is added only if there is a connection to the database or another resource.

if ($options['db_connection']) {
    ...
    if ($options['resources']) {
         $this->command .= " -r {$options['resources']}";
    }
}

I somehow incorrectly use this parameter? How can you add photos to the report differently?

Thanks!

@geekcom
Copy link
Member

geekcom commented Apr 25, 2018

Hi @Azariil , i use images as parameter, see how to do...

yourReport.jrxml

<parameter name="image" class="java.lang.String"/>

<image>
    <reportElement key="" x="7" y="2" width="69" height="76" uuid="3dd59614-b0b3-4034-a9c5-7a936d36e79a"/>
    <imageExpression><![CDATA[$P{image}]]></imageExpression>
</image>

yourController.php

$input = '/home/geekcom/projects/project1/reports/yourReport.jrxml';
$output = '/tmp';
$options = [
    'format' => ['pdf'],
    'locale' => 'pt_BR',
    'params' => [
        'image' => '/home/geekcom/projects/project1/public/images/image.png',
    ],
];

$jasper = new PHPJasper;
$jasper->process(
    $input,
    $output,
    $options
)->execute();

@geekcom
Copy link
Member

geekcom commented Apr 25, 2018

Thanks for suggestion @Azariil see.. #100

@Azariil
Copy link
Author

Azariil commented Apr 25, 2018

Hi @geekcom
Thank you very much for the last commit.
I just add an image in Jasper Studio and do not forward any parameters in the code. With the -r option, everything is perfectly generated.
Thank you.

@Azariil Azariil closed this as completed Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants