Free Support Forum - aspose.com

Locking down the output PDF

I am hoping to convert a number of Word docs to PDF. The trick is that I need the resulting PDF to be locked down (i.e., the user can save the file, but the file must not be editable in any form, including the Adobe Typewriter tool within Adobe Reader). I believe there are a few ways to accomplish this manually with the Acrobat tool (Disable comments and sign with usage restrictions are a couple).

<?xml:namespace prefix = "o" ns = "urn:schemas-microsoft-com:office:office" />

I'm not finding the information I need in the documentation regarding the PDF save features of the Aspose.Words class library. All of the online examples use trivial save parameters for PDF. Is there an example of using the more advanced aspects of the save as PDF functionality of the Aspose.Words library?

Regards,

Colby

Hi Colby,


Thanks for your inquiry. Sure, the lastest version of Aspose.Words allows you to specify permissions on an output PDF document e.g printing, editing allowed etc. Please see this page here for details. Also, please take a look at the following code snippet that demonstrates how to set permissions on a PDF document generated by Aspose.Words:

Document doc = new
Document(@“C:\Temp\in.docx”);

PdfSaveOptions saveOptions = new PdfSaveOptions();

// Create encryption details and set owner password.

PdfEncryptionDetails encryptionDetails = new PdfEncryptionDetails(string.Empty, "password", PdfEncryptionAlgorithm.RC4_128);

// Start by disallowing all permissions.

encryptionDetails.Permissions = PdfPermissions.DisallowAll;

// Extend permissions to allow editing or modifying annotations.

encryptionDetails.Permissions = PdfPermissions.ModifyAnnotations | PdfPermissions.DocumentAssembly;

saveOptions.EncryptionDetails = encryptionDetails;

// Render the document to PDF format with the specified permissions.

doc.Save(@"C:\temp\Rendering.SpecifyPermissions Out.pdf", saveOptions);


I hope, this will help.

Best Regards,