I am trying to export a PDF file as PDFA/a1 with JasperReports, but it doesn't work and I really don't know why.
I want all the fonts to be embedded, but for some reason Helvetica isn't. How should I add the font to my project?
If you have ever exported a file as PDFA/a1 successfully, please tell me how I can I fix the issue, or give me just a sample that works and I'll find my issue from there.
Here is my the code I have so far:
byte[] byte_array=null;
try {
String directorio = BuscarCarpetaArchivosReport(context);
File f = new File(directorio, report + ".jrxml");
if (f.exists() && f.isFile()) {
FileInputStream fis = new FileInputStream(f);
//Compilo el JRXML
JasperReport jasperReport = JasperCompileManager.compileReport(fis);
Map parametrosAux=(Map)parametros.get("parametros");
JasperPrint jasperPrint;
jasperPrint = JasperFillManager.fillReport(jasperReport, parametrosAux, new JREmptyDataSource());
JRPdfExporter Exporter= new JRPdfExporter();
SimplePdfExporterConfiguration configuracio=new SimplePdfExporterConfiguration();
configuracio.setPdfaConformance(PdfaConformanceEnum.PDFA_1A);
configuracio.setIccProfilePath(directorio+"sRGB_v4_ICC_preference.icc");
configuracio.setPdfVersion(PdfVersionEnum.VERSION_1_6);
List<JasperPrint> jasperPrintList = new ArrayList<JasperPrint>();
jasperPrintList.add(jasperPrint);
Exporter.setExporterInput(SimpleExporterInput.getInstance(jasperPrintList));
java.io.ByteArrayOutputStream outputStream=new java.io.ByteArrayOutputStream();
Exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outputStream) );
Exporter.setConfiguration(configuracio);
Exporter.exportReport();
byte_array=outputStream.toByteArray();
} else {
}
} catch (Exception excep) {
Logger.getLogger(BusquedaDatos.class.getName()).log(Level.SEVERE, null, excep);
}
return byte_array;