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

gabri124

Members
  • Posts

    2
  • Joined

  • Last visited

gabri124'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. OH!!! Thank you very much. It is working. the problem then was when I made the jrxml file with IReport tool.
  2. Hello I am new using jasper library and i wanna to run and easily example. I have made the jrmxl and I have a xml file with the data. But when i made the pdf report the pdf is not filled with the values of xml. Can u help me? Code: public static void main(String[] args) { String filexml = args[0]; byte[] PDFSalida = null; ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); try { System.out.println("Create DataSource..."); File file = new File(filexml); System.out.println("EL FICHERO ES "+file.getAbsolutePath()); JRXmlDataSource xmlDataSource = new JRXmlDataSource(file,"/personas/persona"); System.out.println("Compiling report..."); Map<String, Object> parameters = new HashMap<String, Object>(); JasperCompileManager. compileReportToFile("c:/Temp/jrmx/personas.jrxml"); System.out.println("Filled report..."); byte[] bytes = JasperRunManager. runReportToPdf("c:/Temp/jrmx/personas.jasper",parameters,xmlDataSource); String filePDF = filexml.substring(0,filexml.length()-3)+".pdf"; FileOutputStream output = new FileOutputStream(filePDF); output.write(bytes); output.flush(); output.close(); System.out.println("Done!"); } catch (JRException e) { e.printStackTrace(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
×
×
  • Create New...