How to fix “Compression JPEG is only supported with a single strip” issue

半世苍凉 提交于 2020-02-08 07:42:12

问题


I'm working on a project in which I have to create a PDF file using itextsharp. However, I get the following error:

System.IO.IOException: Compression JPEG is only supported with a single strip. This image has 229 strips.
   at iTextSharp.text.pdf.codec.TiffImage.GetTiffImageColor(TIFFDirectory dir, RandomAccessFileOrArray s)
   at iTextSharp.text.pdf.codec.TiffImage.GetTiffImage(RandomAccessFileOrArray s, Int32 page, Boolean direct)
   at iTextSharp.text.Image.GetInstance(Uri url)
   at iTextSharp.text.Image.GetInstance(String filename)
   at TPDFG.Program.Main(String[] args) in f:\TPDF\TPDF\Program.cs:line 157

and the line no. 157 in my code is:

Image _Image = Image.GetInstance(di.FullName + "\\" + ImageUrl);

Everything works fine, I get this error only when the embedded image is TIFF and is compressed with JPEG Compression. If I use uncompressed TIFF or LZW compressed TIFF, everything works fine.

I'm no image expert, so I don't know what this error mean.

I'm using imagemagick command line utility for image manipulation and conversion.


回答1:


I just found this article but its for itext java version. It says multi-strip tiffs aren't supported in iText. So I think this holds true for itextsharp as well.

For more details:-

http://itext-general.2136553.n4.nabble.com/Compression-JPEG-is-only-supported-with-a-single-strip-This-image-has-220-strips-td4659864.html



来源:https://stackoverflow.com/questions/22754513/how-to-fix-compression-jpeg-is-only-supported-with-a-single-strip-issue

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!