Forums

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF Generator for .NET (v9.x)  /  Open pdf Documents

Forum Thread - Open pdf Documents

 Jun 08 2018 7:29 AM
Hello,

is it possible to open a document
encrypt this pdf-doc
and save it with a new name

I thought I read something like this, but I can't find it.

-bernhard
 Jun 08 2018 12:31 PM
Posted by a ceTe Software moderator
Hello,

Yes, you can dynamically load the PDF, encrypt it and save the final output PDF with desired name using DynamicPDF Merger product. Please refer to the documentation on security here. Also below is the code sample.

            //Load the PDF.
            PdfDocument pdf = new PdfDocument(@"Path for PDF document");
            MergeDocument document = new MergeDocument(pdf);
            //Encrypt the PDF using security classes.
            Aes128Security securityObj = new Aes128Security();
            securityObj.OwnerPassword = "owner";
            securityObj.UserPassword = "user";
            document.Security = securityObj;
            //Save the PDF to disk using desired file name.
            document.Draw(@"C:\Temp\MyDocument.pdf");

Thanks,
ceTe Software Support Team.

All times are US Eastern Standard time. The time now is 7:40 AM.