davidcanos Posted March 10, 2016 Posted March 10, 2016 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-576652However doesnt seem to work in 6.2.0 neither 6.1.0. My code looks like thisLocalJasperReportsContext 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 groupedParameter "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
lucianc Posted March 11, 2016 Posted March 11, 2016 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now