Jump to content
Changes to the Jaspersoft community edition download ×

Images in HTML ->how to show it?


paburgos

Recommended Posts

Hi,

 

I'm using this parameter in my report

 

<parameter name="BaseDir" isForPrompting="true" class="java.lang.String">

<defaultValueExpression><![CDATA["\"]]></defaultValueExpression>

</parameter>

 

my image in the jrxml file

 

<imageExpression class="java.io.File"><![CDATA[new File($P{BaseDir}, "cabezote.jpg")]]></imageExpression>

 

when I load the report I assing it to the image's location

 

strAbsolutePath = context.getRealPath("/") "reportes\";

parameters.put("BaseDir", strAbsolutePath);

 

and

 

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);

exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR,new

Boolean(true));

exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean(false));

exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, strAbsolutePath);

exporter.setParameter(JRHtmlExporterParameter.IS_REMOVE_EMPTY_SPACE_BETWEEN_ROWS, new Boolean(true));

 

when I lauch the report it does not show the image

 

what is wrong?

 

thaks

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

well I tried this;

 

<servlet>

<servlet-name>ImageServlet</servlet-name>

<servlet-class>

net.sf.jasperreports.j2ee.servlets.ImageServlet

</servlet-class>

</servlet>

<servlet-mapping>

<servlet-name>ImageServlet</servlet-name>

<url-pattern>/reportes</url-pattern>

</servlet-mapping>

 

and

exporter.setParameter (JRExporterParameter.JASPER_PRINT,jasperPrint);

exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI,"image?image=");

exporter.setParameter(JRExporterParameter.OUTPUT_WRITER,

response.getWriter());

exporter.setParameter

(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN,

new Boolean(false));

 

reportes is the folder were the images are stored but

I still get as a result:

 

<img src="image?image=img_0_0_7" border="0" style="width: 270px" alt=""/>

 

mi image is not shown, can you help me?

Link to comment
Share on other sites

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...