|
Re: PDF Permissions: msg#00015java.jasperreports.general
Hi Mauricio, > How can I generate a PDF file, using jasperreports, disabling > AllowCopy and AllowPrinting permissions? if you are using the version 1.2.3 of JasperReports, in the subfolder demo\samples\pdfencrypt there is an example that show how to disallow copy and printing. I copy and paste here a part of it. File sourceFile = new File(fileName); JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(sourceFile); File destFile = new File(sourceFile.getParent(), jasperPrint.getName() + ".pdf"); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_FILE, destFile); exporter.setParameter(JRPdfExporterParameter.IS_ENCRYPTED, Boolean.TRUE); exporter.setParameter(JRPdfExporterParameter.IS_128_BIT_KEY, Boolean.TRUE); exporter.setParameter(JRPdfExporterParameter.USER_PASSWORD, "jasper"); exporter.setParameter(JRPdfExporterParameter.OWNER_PASSWORD, "reports"); exporter.setParameter( JRPdfExporterParameter.PERMISSIONS, new Integer(PdfWriter.AllowCopy | PdfWriter.AllowPrinting) ); exporter.exportReport(); Bye, Vincenzo ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
|
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Unable to generate WSDL for this service, William Ferguson |
|---|---|
| Next by Date: | Re: Unable to generate WSDL for this service, Giulio Toffoli |
| Previous by Thread: | PDF Permissions, Mauricio Wodarski da Silva |
| Next by Thread: | Re: PDF Permissions, Mauricio Wodarski da Silva |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |