I'm using SDK with DocumentExporter to export a document as a pdf. I want to put restrictions on the exported pdf so that it can't be printed/edited/copied/etc but can still be read. Here's an excerpt of code that I'm using to try to achieve this:
if (BoundEntryInfo.EntryType == EntryType.Document) {
DocumentInfo BoundDocumentInfo = (DocumentInfo)BoundEntryInfo;
DocumentExporter dExp = new DocumentExporter();
dExp.CompressionQuality = 10; // through experimentation, this seems like a good balance between quality and file size for the target documents
dExp.BlackoutRedactions = true;
var pdfExportOptions =
PdfExportOptions.IncludeText |
PdfExportOptions.RestrictCopying |
PdfExportOptions.RestrictPrinting |
PdfExportOptions.RestrictDegradedPrinting |
PdfExportOptions.RestrictModifyContents |
PdfExportOptions.RestrictDocumentAssembly |
PdfExportOptions.RestrictFillIn |
PdfExportOptions.RestrictModifyAnnotations;
MemoryStream ms = new MemoryStream();
dExp.ExportPdf(BoundDocumentInfo, BoundDocumentInfo.AllPages, pdfExportOptions, ms);
}
You can see I tried a "throw it all at the wall and see what sticks" approach to putting restrictions on the pdf, but none of them seem to do anything.
I noticed that DocumentExporter objects have an ExportEncryptedPdf method, which maybe all these restrictions work for...? I stopped exploring ExportEncryptedPdf though when I realized that the password is required to even read the pdf; It's got to be readable without a password but with no printing/copying/etc.
More Context: After exporting the pdf to the MemoryStream, it gets written into the request body of an HttpWebRequest object and posted to a web API to be published on our website. But I've also tried just exporting as a file on the workflow server's filesystem to check if that was making any difference on the how the restrictions are being applied and it's the same story there.
Thanks!