问题
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