Some time ago I needed to print some Barcode.
Therefore I did a little research together with my friend Google.
This is what seems the easiest way to get the job done :
- Use PostScript code to generate the barcode.
- Download PrintFile to to handle the Printjob of the PostScript code : Printfile Tool
- IMORTANT Put a copy of the "prfile32.exe" in the scriptfolder and run it.
- Use AU3 to glue it together and make a nice GUI (if you want)
Barcode_Printer_Sample.au3 30.59K 1316 downloads
Image Printer Sample.au3 3.09K 349 downloads
For those of you who don't know what PostScript is :
A good start learning some basics is here : PS Tutorial
Postscript is a programming language that was designed to specify the layout of the printed page. Postscript printers and postscript display software use an interpreter to convert the page description into the displayed graphics.
In order to print the script you need to print it to PostScript printer.
But for those of you who don't have a PS printer. No worries, you can print it to a PDF printer to !!
Needles to say of course is that PS scripts are 100% compatible with PDF.
Since PostScript was developed by Adobe !!
This results in a nice side effect of this script.
Meaning that when runnng PS commands, you can create your own PDF documents as well.
Therefor I added some nice examples on how to, in the PS script example.
Give it a try and print it to a PDF printer.
(If you don"t have one, PDFCreator is a good one, see my signature somewhere)
Added a EAN13 checksum calculator
Dim $BarCode ; = "544900000043" Dim $length Dim $Odd, $Even, $CheckSum ; Initialize Vars $Odd = 0 $Even = 0 $CheckSum = 0 $BarCode = InputBox("EAN13 CheckSum", "Enter 12 Digit Barcode Value", "") $length = StringLen($BarCode) If mod($length,2) <> 0 Then MsgBox(0,"Error " ,"Not a correct number of digits entered !! ") Exit Elseif int($length) <> 12 Then MsgBox(0,"Error " ,"Not a correct number of digits entered !! ") Exit Else ; Calculate the Odd values For $i = 1 to $length Step 2 $Odd = $Odd + (int(StringMid($BarCode,$i,1)) * 1) Next ; Calculate the Even values For $i = 2 to $length Step 2 $Even = $Even + (int(StringMid($BarCode,$i,1)) * 3) Next ; Process result $Result = $Odd + $Even $CheckSum = 10 - mod($Result, 10) If $CheckSum = 10 Then $CheckSum = 0 EndIf MsgBox(0,"EAN Barcode Checksum",$barcode&$CheckSum ) EndIf
Edited by ptrex, 14 September 2012 - 09:26 AM.