ffranco_1 Posted April 22, 2023 Share Posted April 22, 2023 Hello, I have a requirement from users to encrypt the PDF files generated based on the result of one query.The password should be set dynamically based on the value returned by a query.Is it possible ? And if yes this would be good if example can be shared.Thanks,Frederic Link to comment Share on other sites More sharing options...
szy.ly Posted April 24, 2023 Share Posted April 24, 2023 Frederic,Maybe this is the best information for u: https://jasperreports.sourceforge.net/sample.reference/pdfencrypt/index.htmlexampleJRPdfExporter exporter = new JRPdfExporter();exporter.setExporterInput(new SimpleExporterInput(jasperPrint));exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(outFile));SimplePdfExporterConfiguration configuration = new SimplePdfExporterConfiguration();configuration.setEncrypted(true);configuration.set128BitKey(true);configuration.setUserPassword("jasper");configuration.setOwnerPassword("reports");configuration.setPermissions(PdfWriter.ALLOW_COPY | PdfWriter.ALLOW_PRINTING);exporter.setConfiguration(configuration);hope to help u ,whatClasss Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now