This is a migrated thread and some comments may be shown as answers.

How to set PDF password in reporting manually in code

3 Answers 651 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Senthil
Top achievements
Rank 1
Senthil asked on 14 Oct 2016, 06:43 AM

Hi,

 

You have added the new feature in PDF Security in latest version on Telerik reporting  R3 2016.

But do not have details regarding that how to set password?

Could please send the detail how to set the password in manual rendering pdf in code. 

 

Thanks,

Senthil

3 Answers, 1 is accepted

Sort by
0
Accepted
Stef
Telerik team
answered on 18 Oct 2016, 12:31 PM
Hello Senthil,

The PDf security settings can be applied through the deviceInfo parameters passed to the reportProcessor.Renderreport method - Password Protection.

All PDF device settings are listed here. An example how to export programmatically and pass device settings - here.


I hope this helps.

Regards,
Stef
Telerik by Progress
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Senthil
Top achievements
Rank 1
answered on 19 Oct 2016, 05:04 AM

Thank you for the  reply. Its working as expected now. 

 

Thanks,

Senthil

0
Rener Lemes
Top achievements
Rank 1
Iron
answered on 06 Aug 2022, 04:14 PM

@Senthil how to make this work. When I use this code the following erro apears:

System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
deviceInfo.Add("OwnerPassword", "1234567890");
deviceInfo.Add("OwnerPassword", "1234567890");

RenderingResult result = new ReportProcessor().RenderReport("PDF", reportSource, deviceInfo);

 

ERROR:

No data is available for encoding 1252. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method

Neli
Telerik team
commented on 10 Aug 2022, 01:35 PM

Hi Rener,

Can you please provide us with more details about your application? For example which framework it targets. One of our users has experienced this problem and this is the solution that was shared with us:

 

- Added Nuget System.Text.Encoding.CodePages

- Added Encoding.RegisterProvider(CodePagesEncodingProvider.Instance) to Main in Program.cs;

 

You can also attach Trace Listener and send it to us, so we can inspect the generated log file.

Tags
General Discussions
Asked by
Senthil
Top achievements
Rank 1
Answers by
Stef
Telerik team
Senthil
Top achievements
Rank 1
Rener Lemes
Top achievements
Rank 1
Iron
Share this question
or