如何使用 Windows 服务中的代码获取 tiff 文件中的页数
我有一个 Windows 服务,尝试使用 System.Drawing 命名空间中的 Image 类获取 TIFF 文件中的页数。
using System.Drawing;
private int GetNumberOfPagesFromTiffFile(string filePath)
{
int pageCount = 0;
Image Tiff = Image.FromFile(filePath);
pageCount = Tiff.GetFrameCount(FrameDimension.Page);
Tiff.Dispose();
return pageCount;
}
但微软文档 http://msdn.microsoft.com/en-us /library/system.drawing.aspx 表示不要在 Windows 服务中使用 System.Drawing。他们建议使用 Windows 成像组件。我下载它是为了看看它是否有办法获取 TIFF 文件中的页数,但安装时出错。所以我还没有答案。
我很好奇其他人使用什么来获取 Windows 服务中 TIFF 文件的页数。
I have a Windows service that tries to get the number of pages in a TIFF file using the Image class in the System.Drawing namespace.
using System.Drawing;
private int GetNumberOfPagesFromTiffFile(string filePath)
{
int pageCount = 0;
Image Tiff = Image.FromFile(filePath);
pageCount = Tiff.GetFrameCount(FrameDimension.Page);
Tiff.Dispose();
return pageCount;
}
But the Microsoft documentation http://msdn.microsoft.com/en-us/library/system.drawing.aspx says not to use System.Drawing in a Windows service. They suggested using Windows Imaging Component. I downloaded it to see if it has a way to get the number of pages in a TIFF file, but I got an error installing it. So I don't have my answer yet.
I'm curious what others use to get the number of pages in a TIFF file in a Windows service.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个通用的 C 函数,用于计算 TIFF 文件中的页数
Here's a generic C function to count the number of pages in a TIFF file