Cifrado y descifrado de PDF Your business is spending too much on yearly subscriptions for PDF security and compliance. Consider IronSecureDoc, the Comprehensive PDF Security Solution, which provides solutions for managing SaaS services like digital signing, redaction, encryption, and protection, all for a one-time payment. Explore IronSecureDoc Documentation PDF security is an important aspect of working with PDF files, and IronPDF takes PDF security seriously. With IronPDF, you can encrypt and decrypt PDF files by applying custom metadata and security settings to your PDF. IronPDF supports 128-bit encryption on your encrypted files, the ability to decrypt previously encrypted files (given you have the correct passwords needed to access the file), and apply password protection to your existing or newly created PDF documents. Steps to Convert URL to PDF in C# var pdf = PdfDocument.FromFile("sample.pdf", "password"); pdf.MetaData.Author = "Satoshi Nakamoto"; pdf.SecuritySettings.RemovePasswordsAndEncryption(); pdf.SecuritySettings.MakePdfDocumentReadOnly("secret-key"); pdf.Password = "my-password"; The first step to encrypting and decrypting your PDF files using IronPDF is to either create a new PDF file, or load an existing one as we have here. While loading our PDF file using PdfDocument.FromFile, we have passed two parameters to the FromFile method: the first is the PDF's file path and the second is the password to open the encrypted PDF. The next lines are editing the metadata for our encrypted PDF. pdf.MetaData.Author, for example, is used to edit the Author field with our custom string value. Each metadata field can be accessed using pdf.MetaData.field-key, where the field-key is replaced with the name of the field you want to edit, such as Author, Keywords, modifiedDate, etc. This is especially helpful for giving your PDF keywords, which make it easier to find, a customized modified date, a new author, or anything else you require to be customized within the MetaData properties. The next line removes any current passwords and encryptions from the PDF document. This decryption process allows you to save the PDF without any encryption on it or clears it for you to add new encryption settings for the PDF, which is what we'll do next. pdf.SecuritySettings.setting gives you the ability to customize the security settings for your PDF, where setting is replaced by the actual setting you wish to change. For example, pdf.SecuritySettings.MakePdfDocumentReadOnly sets the PDF to be read-only. The PdfSecuritySettings class contains numerous options allowing full customization of the security settings of your PDF, from disallowing user annotations to controlling the printing permission rights; this class ensures proper PDF security is handled securely and efficiently. The pdf.Password is used to change the password for your PDF or set a new one if there isn't already an existing one. This password encrypts the PDF file using strong 128-bit encryption, protecting it against unauthorized access. Once you are happy with the metadata and security settings, you can save the PDF document to the desired file location using SaveAs(). Learn to Set PDF Permissions and Passwords with IronPDF Ver en GitHub Código https://github.com/iron-software/IronPdf.Examples/tree/main/examples/encryption-and-decryption Descargar ZIP Tutorial Relacionado Guía de Cómo Hacer Relacionada Documentación de Clase Obtener Paquetes de Idiomas Descargar IronPDF DLL Reportar un problema en esta página ¿Listo para empezar? Nuget Descargas 16,154,058 | Versión: 2025.11 recién lanzado Descarga Gratis de NuGet Descargas totales: 16,154,058 Ver Licencias
Producto completamente funcional Obtén 30 días de producto completamente funcional.Instálalo y ejecútalo en minutos.
Soporte técnico 24/5 Acceso completo a nuestro equipo de soporte técnico durante tu prueba del producto
Producto completamente funcional Obtén 30 días de producto completamente funcional.Instálalo y ejecútalo en minutos.
Soporte técnico 24/5 Acceso completo a nuestro equipo de soporte técnico durante tu prueba del producto