【发布时间】:2013-11-20 09:44:17
【问题描述】:
我正在尝试从磁盘读取TIFF 文件并使用iTextSharp 转换为PDF 格式
它工作正常,但除了一些 TIFF 将一些图像放入其中。在这一行出现Tiles are not supported 错误iTextSharp.text.Image.GetInstance(documentPath)
这是我使用的代码
string documentPath="somefile.TIFF";
try
{
Image myImage = Image.GetInstance(documentPath); //Error here
documentPDF.Add(myImage);
byte[] bytes= ms.GetBuffer();
}
catch (Exception ex)
{
// Error says tiles are not supported
}
堆栈跟踪:
在 iTextSharp.text.pdf.codec.TiffImage.GetTiffImage(RandomAccessFileOrArray s,Int32 页面,布尔直接)在 iTextSharp.text.pdf.codec.TiffImage.GetTiffImage(RandomAccessFileOrArray s,Int32 页面)在 iTextSharp.text.Image.GetInstance(Uri url) 在 iTextSharp.text.Image.GetInstance(字符串文件名)
有人可以帮我解决这个问题吗?新版本修复了吗?
查看代码 here 后,他们似乎检查了 TIFF 中存在的 Tiles。
是否有任何 pdf 创建者通过 TIFF with Tiles for C# 阅读?
【问题讨论】:
-
你是在循环运行上面的代码吗?
-
@Sudhakar,不,它不在循环中。只打开一个文档
-
你编辑的和我建议的一样。干得好我的朋友。你是一个很好的学习者。
-
几个思路:尝试转换tiff或者通过System.Drawing.Image使用GetInstance(System.Drawing.Image image,
标签: c# asp.net pdf itextsharp tiff