В GDI+ в методе Bitmap.SelectActiveFrame произошла общая ошибка.
Я пытаюсь преобразовать многостраничное изображение TIFF в PDF. Эта ошибка возникает, когда я пытаюсь вызвать метод bitmap.SelectActiveFrames. Ниже приведен код
`using (PdfDocument pdfDocument = new PdfDocument(new PdfWriter(_pdfFinalLocation)))
{
Document document = new Document(pdfDocument);
Bitmap _bitMap = new Bitmap(srcImageFile);
int _totalpage = _bitMap.GetFrameCount(System.Drawing.Imaging.FrameDimension.Page);
_bitMap.Dispose();
_bitMap = null;
for (int i = 0; i < _totalpage; i++)
{
using(Bitmap _bitMapTemp = new Bitmap(srcImageFile))
{
_bitMapTemp.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Page, i);
using (var MemoryStream = new MemoryStream())
{
_bitMapTemp.Save(MemoryStream, System.Drawing.Imaging.ImageFormat.Tiff);
imageData = ImageDataFactory.Create(MemoryStream.ToArray());
iText.Layout.Element.Image image = new iText.Layout.Element.Image(imageData);
document.Add(image);
}
_bitMapTemp.Dispose();
}
}
if (!pdfDocument.IsCloseWriter())
pdfDocument.Close();
}`
Буду очень признателен, если кто-нибудь поможет мне в решении вопроса.