Link Search Menu Expand Document

Decode page by page from TIFF - VBScript

BarCode Reader SDK sample in VBScript demonstrating ‘Decode page by page from TIFF’

BarcodesFromTIFF.vbs
'*******************************************************************************************'
'                                                                                           '
' Download Free Evaluation Version From:     https://bytescout.com/download/web-installer   '
'                                                                                           '
' Also available as Web API! Get free API Key https://app.pdf.co/signup                     '
'                                                                                           '
' Copyright � 2017-2020 ByteScout, Inc. All rights reserved.                                '
' https://www.bytescout.com                                                                 '
' https://www.pdf.co                                                                        '
'*******************************************************************************************'

Dim ReadFromPages
Dim PageNo

if (WScript.Arguments.Count < 1) Then

	MsgBox "Run with the file name as the argument" & vbCRLF & vbCRLF & "BarcodesFromTIFF.vbs <InputFileName>"
 	WScript.Quit 0
End If

Set reader = CreateObject("Bytescout.BarCodeReader.Reader")

reader.RegistrationName = "demo"
reader.RegistrationKey = "demo"

' Limit search to 1-dimensional barcodes only (exclude 2D barcodes to speed up the processing).
' Change to barcodeReader.BarcodeTypesToFind.SetAll() to scan for all supported 1D and 2D barcode types
' or select specific type, e.g. barcodeReader.BarcodeTypesToFind.PDF417 = True
reader.BarcodeTypesToFind.All1D = True

' Pages from which barcodes to be fetched
ReadFromPages = Array(1, 2, 4, 6)

For Each PageNo In ReadFromPages

	WScript.Echo "Reading barcodes from TIFF page " & PageNo & "..."
	
	' Decoding barcodes from TIFF on page-by-page basis, instead of reading whole page
	reader.ReadFromFilePage WScript.Arguments(0), PageNo - 1
	
	For i = 0 To reader.FoundCount - 1
	
		WScript.Echo "Found barcode, Type: " & reader.GetFoundBarcodeType(i) & ", Value: " & reader.GetFoundBarcodeValue(i) & ", Position: " & _ 
			"[" & reader.GetFoundBarcodeLeft(i) & ", " & reader.GetFoundBarcodeTop(i) & ", " & reader.GetFoundBarcodeWidth(i) & ", " & _
			reader.GetFoundBarcodeHeight(i) & "]"
	Next
Next


run.bat
REM running from the command line
cscript.exe BarcodesFromTIFF.vbs multipage.tif
pause

Download Source Code (.zip)

Return to the previous page Explore BarCode Reader SDK


Copyright © 2016 - 2021 ByteScout