How to set default PDF password

Stimulsoft Reports.NET discussion
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

How to set default PDF password

Post by Martin Hart Turner »

I am using the WinForms version of StimulReports, and use the following code to show the rendered report on screen:

Code: Select all

  stiReport.Show(this, true);
If the end user wants to export the report to PDF, I would like to be able to set the default password from my code. How might I go about such a task?
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set default PDF password

Post by HighAley »

Hello, Martin.

Could you specufy what password you need to set as default?
This should be the CertificatePassword of the StiPdfExportSettings?

Thank you.
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Re: How to set default PDF password

Post by Martin Hart Turner »

Hi:
The password I wish to apply is the password used to open a PDF file. I don't wish to sign it with a certificate.
You see, the problem I have is I don't use the ExportDocument method to export of the report, I just show it in a modal window with the Show method. If the user decides to export the report to PDF via the modal windows' Save button, the user is asked to configure how he/she wishes to generate the PDF document. One of there settings is the password needed to open the exported PDF file. This is the password I wish to set programatically from my program, but I don't know if there is any option to do so!!
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set default PDF password

Post by HighAley »

Hello, Martin.

Could you specify what password are are writing about?
Is it this password?
password.png
password.png (23.3 KiB) Viewed 5836 times
Thank you.
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Re: How to set default PDF password

Post by Martin Hart Turner »

Yes, it is the 'User Password' specifically.
Thanks for your help.
Martin.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: How to set default PDF password

Post by Alex K. »

Hello,

Please try to set the PasswordInputUser and PasswordInputOwner in the StiPdfExportSettings.

Thank you.
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Re: How to set default PDF password

Post by Martin Hart Turner »

Aleksey:
  • 1.I don't use the ExportDocument method to export of the report, I just show it in a modal window with the report.Show method.
    2.If the user decides to export the report to PDF via the modal windows' Save button, the user is asked to configure the export options.
    3. This is what I am trying to set programmatically
As I don't use the ExportDocument method, and only use the report.Show method, I take it any possible setting would have to be a static property in a particular class (I have looked at Stimulsoft.Report.StiOptions.Export.Pdf, but the password is not one of the options available)

There may also be a way of assigning the StiPdfExportSettings to a report, but I can't find anything like that.

Finally, there may be a way to use Events from the report.Show window, but I can't see anything there either.

Regards,
Martin
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set default PDF password

Post by HighAley »

Hello, Martin.

We understand your issue.
We will try to add a static option and will let you know when it will be available.

Thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: How to set default PDF password

Post by HighAley »

Hello, Martin.

We have added next static options:
StiOptions.Export.Pdf.Security.DefaultUserPassword = userPassword;
StiOptions.Export.Pdf.Security.DefaultOwnerPassword = ownerPassword;

They will be available in our next prerelease build on Friday.

Thank you.
Martin Hart Turner
Posts: 66
Joined: Wed Apr 04, 2007 3:32 am
Location: Spain

Re: How to set default PDF password

Post by Martin Hart Turner »

Wow, thanks!!!
Post Reply