Jump to content
We've recently updated our Privacy Statement, available here ×

dustedrob

Members
  • Posts

    3
  • Joined

  • Last visited

dustedrob's Achievements

Newbie

Newbie (1/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Conversation Starter Rare

Recent Badges

0

Reputation

  1. I just tried that and now got a weird exception. Here's my code: String input=FacesContext.getCurrentInstance().getExternalContext().getRealPath("/REPORT.jrxml"); File reporte= new File(input); design = JRXmlLoader.load(reporte); report = JasperCompileManager.compileReport(design); Listprints=new ArrayList(); for (int i=folioInicial;i<=folioFinal;i++) { parametros.put("p_oficio",i); print= JasperFillManager.fillReport(report, parametros, new JREmptyDataSource()); prints.add(print); } JRPdfExporter pdfExporter = new JRPdfExporter (); pdfExporter.setParameter (JRExporterParameter.JASPER_PRINT_LIST, prints); pdfExporter.setParameter (JRExporterParameter.OUTPUT_FILE,new File("REPORT.pdf")); pdfExporter.exportReport(); The exception is: SEVERE: net.sf.jasperreports.engine.JRException: Image read failed. at net.sf.jasperreports.engine.util.JRJdk14ImageReader.readImage(JRJdk14ImageReader.java:73) at net.sf.jasperreports.engine.util.JRImageLoader.loadAwtImageFromBytes(JRImageLoader.java:167) at net.sf.jasperreports.engine.JRImageRenderer.getImage(JRImageRenderer.java:407) at net.sf.jasperreports.engine.JRImageRenderer.getOnErrorRendererForImage(JRImageRenderer.java:310) at net.sf.jasperreports.engine.export.JRPdfExporter.exportImage(JRPdfExporter.java:1381) at net.sf.jasperreports.engine.export.JRPdfExporter.exportElements(JRPdfExporter.java:854) at net.sf.jasperreports.engine.export.JRPdfExporter.exportPage(JRPdfExporter.java:818) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:695) at net.sf.jasperreports.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:417)
  2. I'd like to know If it's possible to generate a report template multiple times and have the resulting templates concatenated in a single PDF file. As of now, this os how i generate a single report: String input=FacesContext.getCurrentInstance().getExternalContext().getRealPath("/REPORT.jrxml"); File reporte= new File(input); design = JRXmlLoader.load(reporte); report = JasperCompileManager.compileReport(design); parametros.put("p_id",1); print= JasperFillManager.fillReport(report, parametros, new JREmptyDataSource()); byte[]archivo=JasperExportManager.exportReportToPdf(print); InputStream stream=new ByteArrayInputStream(archivo); content= new DefaultStreamedContent(stream, "application/pdf","REPORT"); The "p_id" parameter is what would change in every iteration of the report but the template would be the same. All the reports would be printed in the same file. How can i achieve this?
  3. Hi, I'm a JasperReport noob and I'm trying to build a simple report with some nodes that can repeat multiple times. Here's my xml: <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <Comprobante xmlns="http://www.sat.gob.mx/cfd/2" version="2.0" serie="FAC-AA" folio="1" fecha="2010-12-25T09:39:21.044-06:00" sello="um8oh1kJZ5IYyJrbefc5XYiah8e2bf3hFuhlcFFezlkdu1iQWfVsmWZvJC/RMvNyUM5/Wh5M0daT 3KDlC8g6z6AtWnrEgh75LufjlMu5F1OimTP6TDc3gE3xpiT66RVVAen86kRx5FW62p34+7Xbh+H6 3mYdWf6YU6dkWbKClkA=" noAprobacion="2010" anoAprobacion="2010" formaDePago="Pago en una sola exhibición" noCertificado="30001000000100000800" subTotal="1900.49" descuento="665.1715" total="1531.20" metodoDePago="Efectivo" tipoDeComprobante="ingreso"> <Emisor rfc="AAAA000000XX1" nombre="Razon social"> <DomicilioFiscal calle="Calle" noExterior="00" noInterior="00" colonia="Colonia" localidad="localidad" municipio="municipio" estado="estado" pais="México" codigoPostal="03330"/> </Emisor> <Receptor rfc="BESR870619RD7" nombre="Roberto Betancourt"> <Domicilio calle="Priv. Popocateptl" noExterior="36" noInterior=" E 103" colonia="Xoco" localidad="Mexico" municipio="Benito Juarez" estado="Distrito Federal" pais="México" codigoPostal="03330"/> </Receptor> <Conceptos> <Concepto cantidad="1" noIdentificacion="id-prod001" descripcion="Producto con informacion aduanera" valorUnitario="500.50" importe="500.50"> <InformacionAduanera numero="019283470" fecha="2010-01-10" aduana="Colima"/> </Concepto> <Concepto cantidad="2" noIdentificacion="id-prod002" descripcion="Producto con cuenta predial" valorUnitario="200.00" importe="400.00"> <CuentaPredial numero="añlskdjfañlskdfj"/> </Concepto> <Concepto cantidad="3" noIdentificacion="idprod-003" descripcion="Producto normal" valorUnitario="333.33" importe="999.99"/> </Conceptos> <Impuestos totalImpuestosTrasladados="295.88"> <Traslados> <Traslado impuesto="IEPS" tasa="25" importe="243.83"/> <Traslado impuesto="IVA" tasa="0" importe="0"/> <Traslado impuesto="IVA" tasa="16" importe="52.05"/> </Traslados> </Impuestos> </Comprobante> The node I'm currently interested is <Concepto> which in this case repeats three times. I'm following the tutorial posted at: http://jasperforge.org/website/ireportwebsite/IR%20Website/ir_xml_datasources.html?header=project&target=ireport But I'm having a lot of issues when trying to define subdatasources. My Xpath for the subdatasource is /Comprobante/Conceptos/Concepto and the datasource expression for the list is: $P{REPORT_DATA_SOURCE}.subDataSource("/Comprobante/Conceptos/Concepto") In this way, the first Concepto node is repeated three times instead of displaying three different Concepto nodes. I've also tried setting /Conceptos/Concepto and the Xpath and the datasource expression but nothing appears. Is it a bug or am i making some stupid noob mistake?
×
×
  • Create New...