We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

DOC to PDF and send to browser

Hi all,
one of our workflows generates word document which needs then to be converted to PDF and then sent to browser without a possibility to print it.
We were able to achieve it using older Aspose.Words and Aspose.Pdf libraries and Aspose.Pdf.Generator.Security object:

var fileSecurity = new Security {IsPrintingAllowed = false};

Today we work with Aspose.Words and:

  • we want to change our code according to - but we have a problem how to prohibit the printing

Can you advice how to do it with Aspose.Words

Hi Mirek,

Thanks for your inquiry. I would suggest you please read the following article that outlines ‘how to send a document to client’s browser’:

The PdfEncryptionDetails class contains details for encrypting and access permissions for a PDF document. The PdfEncryptionDetails.Permissions property specifies the operations that are allowed to a user on an encrypted PDF document. The default value is DisallowAll. Please read the Pdf Permissions from here:

Following code example demonstrates how to set permissions on a PDF document generated by Aspose.Words.

Document doc = new Document(MyDir + "Rendering.doc");
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(MyDir + "Rendering.SpecifyPermissions Out.pdf", saveOptions);

Hope this helps you. Please let me know if I can be of any further assistance.