Jump to content

Recommended Posts

Posted

I'm building a PDF with the same image in each page.

I'm trying to avoid the duplicated images by using the script Lucianc said in 2009:
http://community.jaspersoft.com/questions/529773/export-huge-pdf#node-576652

However doesnt seem to work in 6.2.0 neither 6.1.0. 
My code looks like this

LocalJasperReportsContext ctx = new LocalJasperReportsContext(DefaultJasperReportsContext.getInstance());RenderableUtil renderableUtil = RenderableUtil.getInstance(ctx);Renderable image = renderableUtil.getRenderable("http://myimagelocation.jpg"); List<JasperPrint> jasperPrint =  new ArrayList<JasperPrint>();  for(Ticket ticket : tickets){      Map<String, Object> params = new HashMap<>();      params.put("image", image);         try{         JasperPrint aux = JasperFillManager.fillReport(jasperReport, params, new JREmptyDataSource());         jasperPrint.add(aux);      }    catch(JRException jre){  }}  return jasperPrint;[/code]

Report is a simple onepage with one image lazy=false, cache=true, evaluationTime = Report, printRepeatedValues = true, no grouped

Parameter "image" is typed: net.sf.jasperreports.engine.Renderable (since i'm using 6.2.0)

any idea what i'm doing wrong?

thanks in advanced

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

See my post from Sep 22 on that thread, you need to customize the PDF exporter so that the image cache is shared across a batch export of JasperPrints.

Note that in recent JR versions you will need to override the setCurrentExporterInputItem method instead of setJasperPrint.

Regards,

Lucian

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