This is a concise sample to help get Solid Framework up and running. It has been tested with the Free Developer License for Solid Framework using different versions of Microsoft's Visual Studio.
Use the Solid Framework Permissions property to set user permission in a PDF File.
- Import the trial Developer License:
License.Import(new StreamReader(@"C:\Users\Joe\license.xml"));
- Locate the PDF files to using OpenFileDialog:
OpenFileDialog OpFile = new OpenFileDialog();
//show only PDF Files
OpFile.Filter = "PDF Files (*.pdf)|*.pdf";
if (OpFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
...
- Create a new PDFDocument object:
PdfDocument document = new PdfDocument();
- Add the file the user selected to the new PDFDocument:
document.Path = OpFile.FileName;
- Open the File:
document.Open();
...
- Create a new Security Handler object:
PdfPasswordSecurityHandler securityHandler = new PdfPasswordSecurityHandler();
...
- Assign the Permissions to the PDF Using the Security Handler:
securityHandler.Permissions = AccessPermissions.Printing;
securityHandler.Permissions = AccessPermissions.ExistingFormFieldFilling;
...
- Write the changes back into the document:
document.SaveProtected(securityHandler, OverwriteMode.ForceOverwrite);
...