Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
-
- Posts: 13
- Joined: Fri Jan 08, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
Hello, could it be response?
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
I haven't used Stimulsoft Reports.JS for a while, but from what I remember, it might not have all those advanced PDF protection features built-in.
What I ended up doing in a similar situation was generating the PDF normally with Stimulsoft, and then using a separate PDF library (like PDFKit or jsPDF) to add the password protection and restrictions as a post-processing step.
What I ended up doing in a similar situation was generating the PDF normally with Stimulsoft, and then using a separate PDF library (like PDFKit or jsPDF) to add the password protection and restrictions as a post-processing step.
-
- Posts: 13
- Joined: Fri Jan 08, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
Answer to @Master600, but in Stimulsoft Report.JS already had feature to protected PDF. But it set in DocumentSecurity. And when i test, it works.
I just want could it be set when we generated in the javascript, not using viewer to set it in PDF for document security.
I just want could it be set when we generated in the javascript, not using viewer to set it in PDF for document security.
-
- Posts: 999
- Joined: Tue Sep 07, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
Hello,
You can use the following code to protect pdf from the code:
Thank you.
You can use the following code to protect pdf from the code:
Code: Select all
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
settings.passwordInputUser = "1234";
settings.passwordInputOwner = "12345";
// Export to PDF
report.exportDocumentAsync((pdfData) => {
// Converting Array into buffer
var buffer = Buffer.from(pdfData);
// File System module
var fs = require('fs');
// Saving string with rendered report in PDF into a file
fs.writeFileSync('./SVG-Example-Report.pdf', buffer);
console.log("Rendered report saved into PDF-file.");
}, Stimulsoft.Report.StiExportFormat.Pdf,
null,
settings);
-
- Posts: 13
- Joined: Fri Jan 08, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
If don't want allowed edit, print or anything else?
-
- Posts: 13
- Joined: Fri Jan 08, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
Hello Sir, could it help?
Thank you
Thank you
-
- Posts: 999
- Joined: Tue Sep 07, 2021 10:11 am
Re: Does Stimulsoft Reports.JS (v2023.1.1) Support PDF Protection?
Hello,
You can use this code to restrict editing or printing of the document, if you do not want to print the document you will need to remove Stimulsoft.Report.Export.StiUserAccessPrivileges.PrintDocument from the line below:
Thank you.
You can use this code to restrict editing or printing of the document, if you do not want to print the document you will need to remove Stimulsoft.Report.Export.StiUserAccessPrivileges.PrintDocument from the line below:
Code: Select all
var settings = new Stimulsoft.Report.Export.StiPdfExportSettings();
settings.userAccessPrivileges = Stimulsoft.Report.Export.StiUserAccessPrivileges.ModifyContents
| Stimulsoft.Report.Export.StiUserAccessPrivileges.PrintDocument
| Stimulsoft.Report.Export.StiUserAccessPrivileges.CopyTextAndGraphics
| Stimulsoft.Report.Export.StiUserAccessPrivileges.AddOrModifyTextAnnotations;