当前位置:   article > 正文

pdf签名无效红叉_无效pdfexception未找到pdf标头签名

pdf签名无效红叉

I have some code that reads pdf files. The code fails at the line :

iTextSharp.text.pdf.PRTokeniser.CheckPdfHeader() at

iTextSharp.text.pdf.PdfReader.ReadPdf()

I know from other entries that this issue is coming from some invalid formatting in the pdf. However I'm not in a position to tell my users to redo their pdfs. Is there some other way around this issue, that can allow reading of the pdf despite this problem?

解决方案

If a file doesn't start with %PDF- then there's nothing to fix: the file isn't a PDF file.

However, there may be another problem: maybe you're trying to access a file that has zero length due to some problem while creating the InputStream. Another context in which I've seen this happen, is a PDF loaded from a server, where the server returned a 404 message in HTML instead of a PDF file ;-)

Whenever that exception happens, you should store the bytes somewhere, and examine them. Without those bytes, nobody will be able to give you useful advice.

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家小花儿/article/detail/141753
推荐阅读
相关标签
  

闽ICP备14008679号