Is there a way to programmatically enable Adobe PDF usage rights from .net code? I use the ITextSharp library to populate the XFA form with XML data (generated from the application), but the output PDF does not have permission to use, so users cannot interact with it (which would normally not be a problem, BUT the original PDF is provided, and the user must click a few check buttons, and this process depends on the user / company)
This can be done manually from Adobe Reader, but you must have a professional Adobe Acrobat license.
Google says that "only Adobe products can do this" .. ( http://old.nabble.com/Enable-Adobe-Reader-usage-rights-td14276927.html )
string pathPDF = @"C:\original.pdf"; string pathCreated = @"C:\created.pdf"; string pathXml = @"C:\data.xml"; using (PdfStamper stamper = new PdfStamper(new PdfReader(pathPDF), System.IO.File.OpenWrite(pathCreated))) { stamper.FormFlattening = false; stamper.AcroFields.Xfa.FillXfaForm(pathXml); stamper.Close(); }
source share