FAQ TBarCode .NET
How Can I Use TBarCode .NET within Powershell?
How Can I Use TBarCode .NET within Powershell?
You can use TBarCode .NET within Microsoft PowerShell like any other .NET class. Below is a sample with default bar code type (Code-128):
Add-Type -Path 'C:\Program Files\Common Files\TEC-IT\TBarCode\11.15\TECIT.TBarCode.dll'
$tbc = New-Object -TypeName TECIT.TBarCode.Barcode
$tbc.Data="12345"
$tbc.BoundingRectangle = New-Object -TypeName System.Drawing.Rectangle (0, 0, 138, 75)
$tbc.Draw('c:\\temp\\test.bmp', [TECIT.TBarCode.ImageType]::Bmp)
$tbc.CopyToClipboard(138, 75)
For saving bitmaps, the code above can be extended with the CalculateNumberOfModules function to determine the optimal bitmap width. For static size bar codes (like EAN 13 P2) you can use a precalculated size.