sungaila / PDFtoImage

A .NET library to render PDF files into images.
https://www.sungaila.de/PDFtoImage/
MIT License
144 stars 14 forks source link

Opening Pdfs with Password fails #43

Closed kumar-vasan closed 9 months ago

kumar-vasan commented 9 months ago

09 September 15 th July PW 6BA065200.pdf While making a call to ToImage method in Conversion with the correct password as shown below

using var inputStream = new FileStream(pdfFilePath, FileMode.Open, FileAccess.Read); var image = Conversion.ToImage(inputStream, password, page: 0);

the code fails with the an Exception PDFtoImage.PdfiumViewer.PdfException: 'Password required or incorrect password'

at line 30 in file PDFtoImage\PdfiumViewer\PdfFile as after call to NativeMethods.FPDF_LoadCustomDocument in line 28

var document = NativeMethods.FPDF_LoadCustomDocument(stream, password, _id); if (document == IntPtr.Zero) throw new PdfException((PdfError)NativeMethods.FPDF_GetLastError());

*Attached a PDF file with password to test. Please use password 6BA065200 to test

sungaila commented 9 months ago

Hi @kumar-vasan, thank you for reporting this! I could reproduce this issue and am working on a bugfix.

sungaila commented 9 months ago

@kumar-vasan PDFtoImage 2.4.1 is available now, please give it a try!

kumar-vasan commented 9 months ago

Thanks a lot @sungaila .