jsf - I can't see pdf generated by DynamicReport -
i'm making pdf report, i'm using jsf, primefaces, can see report in dialog without problems when download pdf, it's can't show. message adobe reader file damaged.
this code:
bytearrayoutputstream baos = new bytearrayoutputstream(); try { dynamicreports.report() .settemplate(plantillas.reporttemplate) .columns(statecolumn, stateporc) .title(templates.createtitlecomponent2("tittle")) .summary( dynamicreports.cht.barchart() .settitlefont(boldfont) .setcategory(statecolumn) .series( dynamicreports.cht.serie(itemcolumn).setseries(statecolumn) ) .setcategoryaxisformat(dynamicreports.cht.axisformat().setlabel("label")) ) .pagefooter(templates.footercomponent) .setdatasource(createdatasource3()) .topdf(baos); inputstream inputstream = new bytearrayinputstream(baos.tobytearray()); barstream = new defaultstreamedcontent(inputstream, "application/pdf", "example.pdf"); setbarstream(barstream); } catch (drexception e) { e.printstacktrace(); }
set way export.
report.topdf(new fileoutputstream(new file("d:/report11.pdf")));
Comments
Post a Comment