PDF Metadata through iReport

0

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

Gaizka's picture
55
Joined: Apr 6 2013 - 8:19am
Last seen: 4 years 2 months ago

1 Answer:

0

Hi Gaizka, 

Not sure how it works because I've never used it but it seems that this is what you want: 

http://jasperreports.sourceforge.net/api/net/sf/jasperreports/engine/export/JRPdfExporterParameter.html#METADATA_AUTHOR

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

augarte's picture
531
Joined: Jan 27 2010 - 7:20am
Last seen: 1 year 6 months ago

Hi Aitor!
thanks, I had already seen those property but they do not seem to work when set in iReport...thanks for your suggestion!

Gaizka - 6 years 3 months ago

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

augarte - 6 years 3 months ago
Feedback