Jump to content
Changes to the Jaspersoft community edition download ×

Is it possible to set net.sf.jasperreports.export.pdf.user.password property dinamically


ffranco_1

Recommended Posts

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Frederic,

Maybe this is the best information for u:  https://jasperreports.sourceforge.net/sample.reference/pdfencrypt/index.html

example

JRPdfExporter 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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...