Is there any example to generate pdf password?
-
I try to create a password for my pdf. The pdf generate succeed but with thout pass word.
Here is my code:var template = new Template()
{
Recipe = recipe,
Engine = engine,
Chrome = new Chrome
{
MarginTop = templateConfig.Chrome.MarginTop,
MarginLeft = templateConfig.Chrome.MarginLeft,
MarginRight = templateConfig.Chrome.MarginRight,
MarginBottom = templateConfig.Chrome.MarginBottom,
FooterTemplate = templateConfig.Chrome.FooterTemplate,
Format = templateConfig.Chrome.Format,
Landscape = templateConfig.Chrome.Landscape
},
PdfPassword = new PdfPassword
{
Password = "@123"
},};
var report = await _localReporting.RenderAsync(new RenderRequest()
{
Template = template});
Startup Class:
services.AddJsReport(new LocalReporting().UseBinary(RuntimeInformation.IsOSPlatform(OSPlatform.Windows) ? JsReportBinary.GetBinary() : jsreport.Binary.Linux.JsReportBinary.GetBinary()) .Configure(cfg => { cfg.AllowedLocalFilesAccess().FileSystemStore().BaseUrlAsWorkingDirectory(); cfg.Discover = true; return cfg; }) .AsUtility() .Create());