Jump to content
We've recently updated our Privacy Statement, available here ×

Rendering dynamic image via API


nockdg

Recommended Posts

Hi,

I have a problem with rendering some reports under 6.3.1 where the previewer gives the error 'Error displaying report page. See the console for details.'. However, there are no details on the console.

I have tracked the problem to rendering of images. Previously I was using a class extending JRAbstractSvgRenderer but have changed to extending AbstractRenderToImageDataRenderer.

However neither are working.

I can see the constructor being called but it never enters the render method. I suspect then that the problem lies in the adding of the element to the report. Unfortunately there don't seem to be any examples of this using the API.

I have seen a similar previewing error when using a JRDesignComponentElement, which was resolved by adding a call to setComponentKey(). However there is nothing similar for the design image.

My basic function looks like:

 public static void addImageToRowDetailBand(JRDesignBand band, String aData, int offsetX, int offsetY, int width, int height) {    JRDesignImage imageField = new JRDesignImage(null);    imageField.setX(offsetX);    imageField.setY(offsetY);    imageField.setWidth(width);    imageField.setHeight(height);    imageField.setHorizontalAlignment(HorizontalAlignEnum.CENTER);    JRDesignExpression expression = new JRDesignExpression();    String aLabelExpression = "new generateMyImage("+aData+")";  expression.setText(aLabelExpression);     imageField.setExpression(expression);    band.addElement(imageField);}[/code]

where generateMyImage is class extending AbstractRenderToImageDataRenderer.

 

Thanks,

Dave

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