Hi! Is it possible to set a property of the PDF file generated directly from iReport? I found some generic properties for pdf, but nothing seems to be good
I need, for example, to set the author of a PDF file craeted through iReport and exported in PDF format.
Any help is appreciated!
Thanks,
Gaizka
1 Answer:
Posted on July 8, 2013 at 2:31am
Hi Gaizka,
Not sure how it works because I've never used it but it seems that this is what you want:
Maybe you can directly set the property and its value in iReport: net.sf.jasperreports.engine.export.JRPdfExporterParameter.METADATA_AUTHOR
There is a similar property METADATA_CREATOR. I really don't know which one is the difference between them but maybe you can use any of them to achieve what you want.
Hope this help.
Regards,
Aitor
Hi Aitor!
thanks, I had already seen those property but they do not seem to work when set in iReport...thanks for your suggestion!
Hi Gaizka,
I've tried to set it through iReport but didn't work for me. Im my case, as I export the reports through java, I have a exporter method, to which I have added the both properties mentioned in the previous post:
public void ExpToPdf (String Nam, List<JasperPrint> JasLst)
/************************************************************************************************/
{
try{
JRPdfExporter PdfExporter = new JRPdfExporter ();
PdfExporter.setParameter (JRExporterParameter.JASPER_PRINT_LIST, JasLst);
PdfExporter.setParameter (JRExporterParameter.OUTPUT_FILE_NAME, Nam);
PdfExporter.setParameter (JRPdfExporterParameter.METADATA_AUTHOR, "Aitor Ugarte");
PdfExporter.setParameter (JRPdfExporterParameter.METADATA_CREATOR,"Ugarte Aitor");
PdfExporter.exportReport ();
}
catch (Exception e){
e.printStackTrace();
}
}
This worked for me, don't know if it is a valid solution for you.
Hope this helps.
Regards,
Aitor