Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8920719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T06:20:54+00:00 2026-06-15T06:20:54+00:00

I designed a jasper report using ireport designer in which I added logo image

  • 0

I designed a jasper report using ireport designer in which I added logo image in the title of the report. This image is added from the hard coded path on the local machine. I need to add the logo image from my projects classpath. To do that I created a parameter for the image in the report which is supplied from the program.

InputStream imgInputStream = this.getClass().getResourceAsStream("header.png");

HashMap<String, Object> parameters = new HashMap<String, Object>();
parameters.put("dateFrom", datum1);
parameters.put("dateTo", datum2);
parameters.put("logo", imgInputStream);


strQuery = "Select calldate,src,dst,duration,disposition,cdrcost from cdrcost where date(calldate) between '" + datum1 + "' and '" + datum2 + "'";

rs = conexiondb.Consulta(strQuery);
JRResultSetDataSource resultSetDataSource = new JRResultSetDataSource(rs);
//JasperPrint jasperPrint = JasperFillManager.fillReport(reportStream, parameters);

JasperRunManager.runReportToPdfStream(reportStream, fos, parameters, resultSetDataSource);

And below is the image snippet from the report:

<image>
  <reportElement x="0" y="1" width="555" height="61"/>
  <imageExpression><![CDATA[$P{logo}]]>
  </imageExpression>
</image>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T06:20:55+00:00Added an answer on June 15, 2026 at 6:20 am

    We always pass in the image instead of the InputStream. First load up the image and set it in the parameter map:

    BufferedImage image = ImageIO.read(getClass().getResource("/images/IMAGE.png"));
    parameters.put("logo", image );
    

    Then the parameter is just defined like:

    <parameter name="logo" class="Object" isForPrompting="false">
      <parameterDescription><![CDATA[The letterhead image]]></parameterDescription>
      <defaultValueExpression><![CDATA[]]></defaultValueExpression>
    </parameter>
    

    And when placed in the report it looks like:

    <image>
      <reportElement x="324" y="16" width="154" height="38"/>
      <imageExpression><![CDATA[$P{logo}]]></imageExpression>
    </image>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have designed jasper report using iReport version (4.7.1). Through iReport it works fine.
I'm trying to preview a Jasper report in iReport and am getting this error.
I am using JasperReport's iReport 4.5.0 designer to build my report. I am having
I designed a rdlc report. In that I embedded one image, say logo. But
I designed a report in iReport that has a straight forward query as the
I designed a report using Business Development Studio 2008 and my reporting server is
Has anyone successfully connected to their MS Access db using Jasper Reports iReport? I
I designed this basic web page which appears perfectly fine in IE and Firefox
I'm getting this error when compiling my JRXML file in iReport 3.1.2: com.jaspersoft.ireport.designer.errorhandler.ProblemItem@f1cdfb The
I designed a query in SQL View using MS Access: select floor(num1) from t1;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.