I have been working on this code for the past few months in which I am attempting to take the byte array of a pdf document, pass it through a memory stream and eventually parse the stream using Aspose.Pdf in order to read it and make a comparison. However, any time I reach the part of the code that is writing the stream, I receive an error message stating that “timeouts are not supported on this stream”. Can you please assist with this or know anyone that can help?
Here is the portion of the code. The highlighted portion is the part where the steam1 is throwing the timeouts error.
// Load the PDF files
byte[] firstpdfbytes = System.Text.Encoding.UTF8.GetBytes(documentA);
MemoryStream stream1 = new MemoryStream(firstpdfbytes);
stream1.Write(firstpdfbytes, 0, firstpdfbytes.Length);
Document document = new Document();
document.Pages.Add();
document.Save(stream1);
var doc1 = stream1;
byte[] secondPdfBytes = System.Text.Encoding.UTF8.GetBytes(documentB);
MemoryStream stream2 = new MemoryStream();
stream2.Write(secondPdfBytes, 0, secondPdfBytes.Length);
Document document2 = new Document();
document2.Pages.Add();
document2.Save(stream2);
var doc2 = stream2;
// Extract text from the first PDF
Document pdfDocument1 = new Document(doc1);
TextAbsorber textAbsorber1 = new TextAbsorber();
pdfDocument1.Pages.Accept(textAbsorber1);
string text1 = textAbsorber1.Text;