Jump to content

Duplicate declaration of report font


ktrinad

Recommended Posts

By: protifar ipo - protifar

Duplicate declaration of report font

2004-02-27 08:39

I write a project with Tomcat 4.1.18 and jasper 0.5.2 .

 

a piece of my code as

 

JasperPrint stat=new JasperPrint();

JRDesignReportFont small = new JRDesignReportFont();

String fontPath=request.getRealPath("./web/manage/stat/kai.ttf");

small.setDefault(true);

small.setPdfFontName(fontPath);

small.setPdfEncoding("Identity-H");

small.setPdfEmbedded(true);

small.setName("Small");

small.setSize(fontSize);

stat.addFont(small);

.

.

.

.

byte[] bytes=JasperExportManager.exportReportToPdf(stat);

response.setContentType("application/pdf");

response.setContentLength(bytes.length);

ServletOutputStream ouputStream = response.getOutputStream();

ouputStream.write(bytes, 0, bytes.length);

ouputStream.flush();

ouputStream.close();

 

and an exception occurs

 

Duplicate declaration of report font : Small

at dori.jasper.engine.JasperPrint.addFont(JasperPrint.java:235)

.

.

.

.

but if

 

JasperExportManager.exportReportToPdfFile(stat,request.getRealPath("./web/manage/stat/stat.pdf"));

 

the output stat.pdf is nothing wrong

 

who can help me, I'm emergent

 

 

 

By: Teodor Danciu - teodord

RE: Duplicate declaration of report font

2004-02-27 09:29

 

Hi,

 

This has nothing to do with the way you export the

document (or at least it should not).

The error comes from the fact that apparently you

add two report fonts with the same name or you add

a report font twice to the JasperPrint object.

 

I hope this helps.

Teodor

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