Sabryna Alves
Sabryna Alves

Reputation: 1

Pdfium Attempted to read or write protected memory. This is often an indication that other memory is corrupt

I'm having a problem with this code. When I dispose the pdfDocument, I receive this error message: 'Attempted to read or write protected memory. This is often an indication that other memory is corrupt.' I can see that this document has a certificate signature, and the PdfiumViewer is updated in my code.

for (int i = 1; i <= numberOfPages; i++)
{
    FileInfo fileinfo = new FileInfo(Path.Combine(tempFolder, string.Format(fileInfo.Name.Substring(0, fileInfo.Name.IndexOf(".")).Trim() + ".{0}.pdf", i)));

    using (var pdfDocument = PdfiumViewer.PdfDocument.Load(fileinfo.FullName))
    {
        var bitmapImage = pdfDocument.Render(0, 300, 300, true);
        bitmapImage.Save(pagesFolder + "\\" + fileinfo.Name.Substring(0, fileinfo.Name.LastIndexOf(".")) + ".tiff", System.Drawing.Imaging.ImageFormat.Tiff);
        bitmapImage.Dispose();
    }
}

Im having trying update Pdfium library, set a password empty for indicate archive does not need password

Upvotes: 0

Views: 159

Answers (0)

Related Questions