Jump to content
Changes to the Jaspersoft community edition download ×

Absolute paths and ReportFileResolver


tempusfugit

Recommended Posts

Hello everyone,

 

i'm about to write an application using  JasperReports 3.5.3. The reports contain subreports, pictures and different fonts. I want to get some pdf documents, so i use the pdfFontName attribute to set the font. The grapichs and subreports have absolute paths using parameters.

eg

String subReportDir = "C:/my reports/subreports";
params.put ("SUBREPORT_DIR", subreportDir);


 

So far no problem.

But I want the font paths also pass through from the application. But I wasn't able to use a parameter in the attribute pdfFontName.

I tried to avoid this problem by using  the REPORT_FILE_RESOLVER parameter:

String fontDir = "C:/fonts";
params.put(JRParameter.REPORT_FILE_RESOLVER, new SimpleFileResolver(new File(fontDir)));

 

When I use the REPORT_FILE_RESOLVER parameter I get the exception:

net.sf.jasperreports.engine.JRException: Could not load object from location : C:\my reports\subreports\anySubReport.jasper

        at net.sf.jasperreports.engine.util.JRLoader.loadObjectFromLocation(JRLoader.java:273)
        at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:321)
        at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:270)
        at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:260)
        at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:486)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1427)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:729)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:256)
        at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:114)
        at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:911)
        at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:123)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:439)
        at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)

 

Without using the REPORT_FILE_RESOLVER I don't get this exception. The subreport is at this location. I don't know, what should be wrong, so is this a bug?

Anyone got an idea, how to pass the path for the fonts to JasperReports?

 

Thanks,

Daniel

Code:


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