Jump to content
JasperReports Library 7.0 is now available ×

pdf look bad on print JRRenderable JFreeChart


2004 IR Help

Recommended Posts

By: ThinkSquare - squareware

pdf look bad on print JRRenderable JFreeChart

2005-08-30 06:56

Hi,

 

I am trying to include a JFreeChart into JasperReports. The first step was to create a java.awt.image and that worked fine, except when printing the pdf you get these scaling artifacts, i.e., the text looks ugly.

 

So in a second step I used the fact that the class JFreeChart implements the org.jfree.ui.Drawable, which in turn can be used via net.sf.jasperreports.engine.JRRenderable to turn into something the JasperReports understands. (See code below)

 

Now the funny thing is, when displaying the pdf on screen, it looks perfect, but when printing it, very funny things happen:

 

- Acrobat Reader 5: some of the graph is blank, and depending on the printer, the blank areas are in different places.

- Acrobat Reader 6: it greys out the whole graph.

 

Maybe this is an issue for iText? Has anybody seen a similar problem?

 

Thanks.

 

 

public class ChartJRRenderableWrapper implements JRRenderable {

private JFreeChart myChart;

 

public ChartJRRenderableWrapper(JFreeChart chart) {

this.myChart = chart;

}

 

public void render(Graphics2D g, java.awt.geom.Rectangle2D r) {

if (myChart != null && g instanceof Graphics2D) {

myChart.draw((Graphics2D) g, r1);

}

}

 

public byte getType() {

return TYPE_SVG;

}

 

 

public java.awt.geom.Dimension2D getDimension() {

return null;

}

 

public byte[] getImageData() throws JRException {

return null;

}

}

 

 

 

 

 

By: Teodor Danciu - teodord

RE: pdf look bad on print JRRenderable JFreeC

2005-08-30 07:02

 

Hi,

 

I have not heared if such a problem before.

Note however that we ship the library with a ready-to-use

renderer implementation that wraps a drawable object

from JFreeChart.

 

Check the JCommonDrawableRenderer class.

 

Not sure if you saw that, but there is built-in support

for charts in JR since 1.0.0.

 

I hope this helps.

Teodor

 

 

 

 

 

By: ThinkSquare - squareware

RE: pdf look bad on print JRRenderable JFreeC

2005-08-30 07:38

Hi Teodor,

 

thanks for the hint. However, it did not solve the issue. But looking at a post in the iText forum, I found the following:

 

Acrobat 6: when you're in the Print Dialog and select Advanced, you can choose 'Print as Image' and then it works fine, or if you select 'Language Level 3' then it also works fine. But the preselected 'Language Level 2' causes problems.

 

Acrobat 5: Unfortunately, couldn't get it to work there. Tried all the different levels.

 

What do you think, is that an iText issue?

 

Thanks,

Ralph

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