I try to create PDF using a comma delimited txt file, but when I create the PDF it sends an error:
JRCsvDataSource ds = new JRCsvDataSource (JRLoader.getLocationInputStream (RutaTXT))
This is the class to create PDF using JASPER to create a cover, and the txt will fill that report.
public class PDF {
private JasperPrint jasperPrint;
public void CrearReportPDF(String RutaPDF, String RutaTXT) throws JRException {
jasperPrint = JasperFillManager.fillReport(".\Recursos\NUMERO_ORDEN.jasper", null, getDataSource(RutaTXT));
JasperExportManager.exportReportToPdfFile(jasperPrint, RutaPDF);
}
private JRCsvDataSource getDataSource(String RutaTXT) throws JRException {
JRCsvDataSource ds = new JRCsvDataSource(JRLoader.getLocationInputStream(RutaTXT));
ds.setRecordDelimiter("\n");
ds.setFieldDelimiter('#');
ds.setUseFirstRowAsHeader(true);
return ds;
}
}