彩票走势图

如何使用Aspose.BarCode从多页面TIFF图像中读取条形码

原创|其它|编辑:郝浩|2012-10-18 15:57:56.000|阅读 420 次

概述:从多页Tiff文件中读取条形码,是我们经常会遇到的一个实际问题。下面就是使用Aspose.BarCode解决这一问题的示例代码:

# 慧都年终大促·界面/图表报表/文档/IDE等千款热门软控件火热促销中 >>

从多页Tiff文件中读取条形码,是我们经常会遇到的一个实际问题。下面就是使用Aspose.BarCode解决这一问题的示例代码:

[C#]

//Calculate the pages count
System.Drawing.Image img = Image.FromFile(@".\multi-page.tif");
Guid guid = img.FrameDimensionsList[0];
FrameDimension dimension = new FrameDimension(guid);
int totalFrame = img.GetFrameCount(dimension);

//Feed the pages to BarCodeReader one by one
BarCodeReader rd = new BarCodeReader(new Bitmap(img));
for (int i = 0; i < totalFrame; i++)
{
    // Set the active page and feed it to the BarCodeReader
    img.SelectActiveFrame(dimension, i);
    Console.Out.WriteLine("Page[" + i + "]");
    while(rd.Read())
    {
        Console.Out.WriteLine("BarCode Found. CodeText: " + rd.GetCodeText());
    }
}
rd.Close();

[VB.NET]

'Calculate the pages count
Dim img As System.Drawing.Image = Image.FromFile(".\multi-page.tif")
Dim guid As Guid = img.FrameDimensionsList(0)
Dim dimension As FrameDimension = New FrameDimension(guid)
Dim totalFrame As Integer = img.GetFrameCount(dimension)

'Feed the pages to BarCodeReader one by one
Dim rd As BarCodeReader = New BarCodeReader(New Bitmap(img))
Dim i As Integer = 0
Do While i < totalFrame
    ' Set the active page and feed it to the BarCodeReader
    img.SelectActiveFrame(dimension, i)
    Console.Out.WriteLine("Page[" & i & "]")
    Do While rd.Read()
        Console.Out.WriteLine("BarCode Found. CodeText: " & rd.GetCodeText())
    Loop
    i += 1
Loop
rd.Close()


标签:

本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@pclwef.cn

文章转载自:慧都控件网

为你推荐

  • 推荐视频
  • 推荐活动
  • 推荐产品
  • 推荐文章
  • 慧都慧问
扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP