タイプ'iTextSharp.text.pdf.PdfLiteral'のオブジェクトをタイプ'iTextSharp.text.pdf.PdfNumber'にキャストできません。
コード:
StringBuilder text = new StringBuilder();
SimpleTextExtractionStrategy strategy = new SimpleTextExtractionStrategy();
for (int p = 1; p <= reader.NumberOfPages; p++)
{
text.AppendLine(PdfTextExtractor.GetTextFromPage(reader, p, strategy));
}
reader.Close();
return text.ToString();
非常に少数のPDFでのみこのエラーが発生します。何か案は?
スタックトレース:
at iTextSharp.text.pdf.parser.PdfContentStreamProcessor.ShowTextArray.Invoke(PdfContentStreamProcessor processor, PdfLiteral oper, List`1 operands)
at iTextSharp.text.pdf.parser.PdfContentStreamProcessor.InvokeOperator(PdfLiteral oper, List`1 operands)
at iTextSharp.text.pdf.parser.PdfContentStreamProcessor.ProcessContent(Byte[] contentBytes, PdfDictionary resources)
at iTextSharp.text.pdf.parser.PdfReaderContentParser.ProcessContent[E](Int32 pageNumber, E renderListener)
at iTextSharp.text.pdf.parser.PdfTextExtractor.GetTextFromPage(PdfReader reader, Int32 pageNumber, ITextExtractionStrategy strategy)
at DCS.Common.PDF.Functions.GetTextPdf(PdfReader reader) in C:\Users\rmaldonado\Documents\Visual Studio 2008\Projects\DCS\Contract\Common\PDF\Functions.cs:line 35
at DCS.Common.PDF.Functions.ParsePDF(Byte[] bytes) in C:\Users\rmaldonado\Documents\Visual Studio 2008\Projects\DCS\Contract\Common\PDF\Functions.cs:line 23
at DCS.CAPPS.BLL.Common.Attachment.ReParseText() in C:\Users\rmaldonado\Documents\Visual Studio 2008\Projects\DCS\Contract\ContractBLL\Common\Common.cs:line 1120