i updated from Version 23.2 to 23.8
and now i m getting an encrypted exception when i want to save to a new documentname
after deleting the embedded file collection. (worked before!)
here is my code:
try
{
if (string.IsNullOrWhiteSpace(pdfFullName)) return false;
var ok = SetAsposeLicense();
if (!ok)
{
Log.Error(“license error”);
return false;
}
var path = Path.GetDirectoryName(pdfFullName);
var tmpFile = Path.GetRandomFileName();
var tempfile = Path.ChangeExtension(Path.GetFileName(tmpFile), ".PDF");
var tempFileFullname = Path.Combine(path, tempfile);
if (File.Exists(tempFileFullname)) File.Delete(tempFileFullname);
var document = new Document(pdfFullName);
document.EmbeddedFiles.Delete();
**document.Save(tempFileFullname);**
document.Dispose();
if (File.Exists(pdfFullName)) File.Delete(pdfFullName);
File.Copy(tempFileFullname, pdfFullName);
File.Delete(tempFileFullname);
result = true;
}
catch (Exception ex)
{
Log.Error(“internal error”, ex);
}
sample file:
ZUGFeRD_1p0_BASIC_Einfach.pdf (85.8 KB)
we found out that it’s a file dependency… this is working:
Test-embedded.pdf (271.0 KB)