Can anyone tell me if they have had any success in using iText7 and was able to remove the protection level access in order to merge signed documents from Adobe Sign with other PDF documents? I have been trying this for days with no success. Adobe Support says it can't be done and iText requires payment for support. Here is my code:
ReaderProperties readerProperties = new ReaderProperties().SetPassword(new System.Text.UTF8Encoding().GetBytes("password"));
PdfReader pdfReader = new PdfReader(new System.IO.MemoryStream(response.RawBytes), readerProperties);
pdfReader.SetUnethicalReading(true);
//pdfReader = TryToUnlockPdf(pdfReader);
MemoryStream baos = new MemoryStream();
using (iText.Kernel.Pdf.PdfDocument pdfDoc = new iText.Kernel.Pdf.PdfDocument(pdfReader, new PdfWriter(baos)))
{
if (Configuration.GetValue<bool>("IsTestingLocally"))
{
CreateIfMissing(Path.GetDirectoryName("c:/tmp/" + doc.name));
if (System.IO.File.Exists("c:/tmp/" + doc.name)) System.IO.File.Delete("c:/tmp/" + doc.name);
System.IO.File.WriteAllBytes("c:/tmp/" + doc.name, baos.ToArray());
}
pdfReader.Close();
}
The response.RawBytes is the PDF bytes coming back from Adobe's Agreement.
Thanks in advance.
EDIT: The "password" value listed in here is a dummy value. I took out the password value.
The issue is as follows. I can download the PDF file from Adobe Sign fine. The file is locked, however, I have the password, so that's fine too. The issues is, even though the file is unlocked, when I write the file to my folder, it says it is corrupted. So it seems as if the password works fine, but the file will not write correctly.