|
Re: PDF Permissions: msg#00019java.jasperreports.general
Thanks Vicenzo. I was looking for it in the wrong place, I guess. :) Mauricio 2006/7/12, Vincenzo Manzoni <vmanzoni-SYxUK+7R+wReoWH0uzbU5w@xxxxxxxxxxxxxxxx>: > 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: | Reference a parameter from another parameter, David Meiser |
|---|---|
| Next by Date: | Re: Reference a parameter from another parameter, Lucian Chirita |
| Previous by Thread: | Re: PDF Permissions, Vincenzo Manzoni |
| Next by Thread: | Unable to generate WSDL for this service, William Ferguson |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |