We found another bug that could be reproduced on Aspose.PDF 21.1.0.0. Execution results are not consistent: execution fails in 10-20% of the cases.
Source document:
document.pdf (489.1 KB)
Processing code:
public static bool validate(Aspose.Pdf.Document pdfDocument)
{
bool result = true;
try
{
foreach (Aspose.Pdf.Page pdfPage in pdfDocument.Pages)
{
Aspose.Pdf.Text.TextBuilder builder = new Aspose.Pdf.Text.TextBuilder(pdfPage);
}
}
catch
{
result = false;
}
return result;
}
static void Main(string[] args)
{
for (int i = 0; i < 50; i++)
{
Aspose.Pdf.Document asposePDFDocument = new Aspose.Pdf.Document(@"document.pdf");
asposePDFDocument.Encrypt("", "AnyPassword", Aspose.Pdf.Facades.DocumentPrivilege.Print, Aspose.Pdf.CryptoAlgorithm.AESx128, false);
//Saving the document to the stream
System.IO.MemoryStream memoryStreamValidate = new System.IO.MemoryStream();
asposePDFDocument.Save(memoryStreamValidate);
// Reloading the document
asposePDFDocument = new Aspose.Pdf.Document(memoryStreamValidate);
bool isValid = validate(asposePDFDocument);
Console.WriteLine("Attempt {0} - {1}", i + 1, isValid ? "Success" : "Failure" );
}
Console.ReadLine();
}
Execution results:
image.png (3.3 KB)