//// This code is part of Document Solutions for Word demos.// Copyright (c) MESCIUS inc. All rights reserved.//usingSystem.IO;usingGrapeCity.Documents.Word;usingGrapeCity.Documents.Word.Layout; namespaceDsWordWeb.Demos{// This example shows how to password protect the PDF document// when using GrapeCity.Documents.Word.Layout (GcWordLayout) to // save a DOCX as PDF.publicclassPasswordProtectPdf {publicGcWordDocumentCreateDocx() {GcWordDocument doc = newGcWordDocument(); doc.Load(Path.Combine("Resources", "WordDocs", "ProcurementLetter.docx"));return doc; } // Optional static method. If it is defined on a sample class,// these options are used when saving the document to PDF.publicstaticPdfOutputSettingsGetPdfOutputSettings() {var settings = newPdfOutputSettings();// This creates a security handler with both owner and user passwords// set to the passed string ("password" in this example):var sh = settings.CreateSecurityHandler("password");// Other SecurityHandler properties can be used to customize PDF protection,// e.g. here we protect the PDF content from copying, printing and editing: sh.CopyContent = false; sh.PrintingPermissions = GrapeCity.Documents.Pdf.Security.PrintingPermissions.Disabled; sh.EditingPermissions = GrapeCity.Documents.Pdf.Security.EditingPermissions.Disabled;return settings; } }}