Jump to content
Changes to the Jaspersoft community edition download ×

Display image


Recommended Posts

By: karibouxe - karibouxe

Display image

2006-05-11 09:16

I want to display an image. I try to put a String:

<imageExpression class="java.lang.String"><![CDATA[new String("http://reporting/images/logo.jpg")]]>

or a URL:

<imageExpression class="java.net.URL"><![CDATA[new URL("http://reporting/images/logo.jpg")]]>

 

but my browser search the image /nullimg_0_0_1 :'-(

how do I do to display may image?

 

Thanks for any advices

 

 

 

 

By: karibouxe - karibouxe

RE: Display image

2006-05-11 10:06

actually in my .jrxml. I'm this <image>

 

<image evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="0"

y="0"

width="59"

height="50"

key="image-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch"/>

<imageExpression class="java.net.URL"><![CDATA[new URL("http://reporting/images/logo.jpg")]]></imageExpression>

</image>

 

but my browser search always an image /nullimg_0_0_1 :'-(

 

 

 

 

By: Lucian Chirita - lucianc

RE: Display image

2006-05-15 05:15

Set the isLazy flag for the image and use a string expression. If the flag is set, the JR engine would not try to load the image and the Html export would refer directly the image location.

 

HTH,

Lucian

 

 

 

 

By: karibouxe - karibouxe

RE: Display image

2006-05-15 07:32

Tanks for your help, but

I try your solution and it doesn't work :'-(

My pdf file is ok but my html page search always a null_img_0_0_1 ...

 

for illustrate my said, look my .jrxml

<image isLazy="true" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >

<reportElement

x="0"

y="1"

width="43"

height="44"

key="image-1"/>

<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>

<graphicElement stretchType="NoStretch"/>

<imageExpression class="java.lang.String"><![CDATA["http://reporting/images/logo.jpg"]]></imageExpression>

</image>

 

 

 

 

 

By: Lucian Chirita - lucianc

RE: Display image

2006-05-15 08:16

Are you sure it doesn't work? Maybe you got the html page from the browser's cache?

 

Try to run the "images" sample in the demo/samples folder of the JR distribution and see whether the image having isLazy set produces an img element in the resulted html with the right source URL.

 

 

 

 

By: karibouxe - karibouxe

RE: Display image

2006-05-16 00:56

Hi,

 

i used a anather method. and it work.

look that:

 

if(formatRapport.equals("web"))

{

JRHtmlExporter exporter = new JRHtmlExporter();

exporter.setParameter(JRHtmlExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRHtmlExporterParameter.OUTPUT_STREAM, outStr);

 

//permet notamment de voir apparaître les accents

exporter.setParameter(JRHtmlExporterParameter.CHARACTER_ENCODING, "iso-8859-1");

exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, Boolean.TRUE);

 

//false:supprime les images, true: essaye d'afficher les images

exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE);

//déclare où on doit récupérer les images

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, reportSrcPath+"imagesJasper/");

//déclare où doivent être stocké les images

exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, reportSrcPath+"imagesJasper/");

//déclare que les images doivent être sauvegardé sur la base

exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR , Boolean.TRUE);

exporter.exportReport();

}

 

with that, i can use the picture in my reports. I point out that it work in my browser IE but not with mozilla.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...