Hi,
I have a PDF file which has following security document restrictions like
1.Changing the document
2.Document Assembly
Creation of Document Assembly
How can remove these document restrictions in PDF using PDFCreator Active X.
Regds
Anshuman
Removing document restrictions in PDF
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact:
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact:
Removing document restrictions in PDF
Hi Joan,
Thanks for reply.
I am using the below code for making a pdf a password protected file unprotected and removing the document restrictions as well.But the code is not working and file is not getting unprotected.. Could you please suggest what is wrong with code and how we can achieve the functionality?
acPDFCreatorLib.Initialize();
acPDFCreatorLib.SetLicenseKey("", "");
// Open a PDF document from file
string NewfileName = "ABC.pdf";
System.IO.FileStream file1 = new System.IO.FileStream(NewfileName, FileMode.Open, FileAccess.ReadWrite,
FileShare.ReadWrite);
using (IacDocument document = new IacDocument(null))
{
document.Open(file1, "pqr");
//Trying to assign empty user and owner passwords and setting no restrictions
document.Encrypt128("", "", 0);
// save modified document to a new file
Random number = new Random();
System.IO.FileStream file2 = new System.IO.FileStream(@"File_mod" + number.Next().ToString() + ".pdf", FileMode.CreateNew, FileAccess.Write,FileShare.Read);
document.Save(file2, IacFileSaveOption.acFileSaveAll); // save modified document
}
// terminate library to free resources
acPDFCreatorLib.Terminate();
Thanks for reply.
I am using the below code for making a pdf a password protected file unprotected and removing the document restrictions as well.But the code is not working and file is not getting unprotected.. Could you please suggest what is wrong with code and how we can achieve the functionality?
acPDFCreatorLib.Initialize();
acPDFCreatorLib.SetLicenseKey("", "");
// Open a PDF document from file
string NewfileName = "ABC.pdf";
System.IO.FileStream file1 = new System.IO.FileStream(NewfileName, FileMode.Open, FileAccess.ReadWrite,
FileShare.ReadWrite);
using (IacDocument document = new IacDocument(null))
{
document.Open(file1, "pqr");
//Trying to assign empty user and owner passwords and setting no restrictions
document.Encrypt128("", "", 0);
// save modified document to a new file
Random number = new Random();
System.IO.FileStream file2 = new System.IO.FileStream(@"File_mod" + number.Next().ToString() + ".pdf", FileMode.CreateNew, FileAccess.Write,FileShare.Read);
document.Save(file2, IacFileSaveOption.acFileSaveAll); // save modified document
}
// terminate library to free resources
acPDFCreatorLib.Terminate();
Anshuman
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact:
Removing document restrictions in PDF
Hi Joan,
As I explained in the code previous posts
I am opening the PDF with owner Id like
document.Open(file1, "pqr");
and then I am trying to assign empty user and owner passwords and set no restrictions
document.Encrypt128("", "", 0);
Please let me know what is wrong here or what else needs to be done
Regards
Anshuman
As I explained in the code previous posts
I am opening the PDF with owner Id like
document.Open(file1, "pqr");
and then I am trying to assign empty user and owner passwords and set no restrictions
document.Encrypt128("", "", 0);
Please let me know what is wrong here or what else needs to be done
Regards
Anshuman
Anshuman
-
- Posts: 21
- Joined: Mon Feb 12 2007
- Contact:
Removing document restrictions in PDF
Hi,
I have owner password of a PDF file and I am trying to make this file non password protected and remove document restrictions on it.
Please let me know what is wrong in the code explained in previous posts or please share a sample code which achieve the requirements as I explained above.
Thanks
Anshuman
I have owner password of a PDF file and I am trying to make this file non password protected and remove document restrictions on it.
Please let me know what is wrong in the code explained in previous posts or please share a sample code which achieve the requirements as I explained above.
Thanks
Anshuman
Anshuman
Hello,
Please find here a VB code that opens an Encrypted pdf file and remove restrictions and passwords.
Hope this helps.
Please find here a VB code that opens an Encrypted pdf file and remove restrictions and passwords.
Hope this helps.
Code: Select all
Private Sub Decrypt_Click()
On Error GoTo report_error
With CreatorRef
' Open a pdf file and remove passwords
.SetLicenseKey Licensee, ActivationCode
.Open App.Path & "Encrypt128.pdf", "owner"
.Encrypt "", "", -60
.Save App.Path & "\EncryptNoPassword.pdf", 0
MsgBox "Done"
End With
Exit Sub
report_error:
MsgBox Err.Description
MsgBox Err.Source
End Sub