ptrex Posted March 30, 2008 Share Posted March 30, 2008 (edited) Barcode Printing in AU3 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 Sample Barcode_Printer_Sample.au3 Image Sample Image Printer Sample.au3 For those of you who don't know what PostScript is : 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. A good start learning some basics is here : PS Tutorial 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 expandcollapse popupDim $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 Enjoy !! regards Edited September 14, 2012 by ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
icadea Posted March 31, 2008 Share Posted March 31, 2008 thanks for the example, this is great. Link to comment Share on other sites More sharing options...
ptrex Posted April 6, 2008 Author Share Posted April 6, 2008 @all Added a EAN13 checksum calculator. See first post. Regards, ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
faustf Posted January 13, 2012 Share Posted January 13, 2012 hi guy i have a question i use your Barcode_Printer_Sample.au3 ( is very best )but i have little problem when i print i use in printer only a4 and the program have margin for letter (i suppose) how is possible change the paper format ?? thankzzz Link to comment Share on other sites More sharing options...
water Posted January 13, 2012 Share Posted January 13, 2012 "/PageSize [595 842]"? My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
faustf Posted January 13, 2012 Share Posted January 13, 2012 where i try to find , but tell me pagesize dont exist Link to comment Share on other sites More sharing options...
faustf Posted January 13, 2012 Share Posted January 13, 2012 hi insert pagesize here $PS = '%!PS-Adobe-2.0' $PS = $PS & @CRLF & '% --BEGIN TEMPLATE--' $PS = $PS & @CRLF $PS = $PS & @CRLF & '% --BEGIN ENCODER ean13--' $PS = $PS & @CRLF & '% --DESC: EAN-13' $PS = $PS & @CRLF & '% --EXAM: 977147396801' $PS = $PS & @CRLF & '% --EXOP: includetext guardwhitespace' $PS = $PS & @CRLF & '% --RNDR: renlinear' $PS = $PS & @CRLF & '/ean13 {' $PS = $PS & @CRLF $PS = $PS & @CRLF & ' 0 begin' $PS = $PS & @CRLF & '/PageSize [297 420]' but don go print blank page Link to comment Share on other sites More sharing options...
ptrex Posted January 13, 2012 Author Share Posted January 13, 2012 @faustfBy my knowledge you don't specify any page size in EPS.http://ds.dial.pipex.com/quite/eps1.htmThe PostScript in an EPS has to follow certain rules. For instance, it shouldn't erase the page since that would affect the whole page, not just its own part. Another forbidden thing is selecting a page size,because this would both change the size of, and erase, the whole page.Where to print has to be calculated, starting from the 0,0 coordinates.The units for the graphical operations are measured in points, with 72 points per inch.The PostScript coordinate system defines the 0 0 position to be at the lower left corner of the page,so 72 72 is one inch from the left, and one inch up from the bottom. For a standard 8.5x11" letter-sized sheet of paper,the upper right corner is therefore 612 792.An A4 is W 21 x H 29.7 cm or 8.26771654 x 11.6929134 inches = W = 595,27559088 Units x H = 841,8897648 UnitsRgds,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
faustf Posted January 16, 2012 Share Posted January 16, 2012 how is possble move rectangle ??? Link to comment Share on other sites More sharing options...
faustf Posted January 16, 2012 Share Posted January 16, 2012 and is possble insert little jpg ??? Link to comment Share on other sites More sharing options...
ptrex Posted January 16, 2012 Author Share Posted January 16, 2012 @faustfBest start reading here : http://paulbourke.net/dataformats/postscript/Rgds,ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ptrex Posted January 18, 2012 Author Share Posted January 18, 2012 @faustf Add Image Printer Sample.au3 to the first post. Someone might find it usefull Rgds ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
faustf Posted March 7, 2012 Share Posted March 7, 2012 hi guy i have a little problem i want insert a variable X and Y in place of dim $di = '20 750 moveto' how can do ?? i tryed in this mode but dont go dim $di = ''&$x&$y&' moveto' and dim $di = ''&$x&''&$y&' moveto' but dont go Link to comment Share on other sites More sharing options...
AdamUL Posted March 8, 2012 Share Posted March 8, 2012 You have an extra "&" at the beginning. Try: $di = $x & ' ' & $y & ' moveto' Adam Link to comment Share on other sites More sharing options...
Myicq Posted May 21, 2012 Share Posted May 21, 2012 I work with barcodes professionally, it is a much more complex topic than just EAN13. Just thought I would mention this resource, since it has not been linked in the thread: http://code.google.com/p/postscriptbarcode/ It can't make all barcodes, but most of the common and then some. Perhaps useful to some people. I am just a hobby programmer, and nothing great to publish right now. Link to comment Share on other sites More sharing options...
automaker332 Posted September 5, 2013 Share Posted September 5, 2013 (edited) I have several years of creating barcodes. This barcode site may be of great help: <snip> Edited September 5, 2013 by Melba23 Removed URL Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 5, 2013 Moderators Share Posted September 5, 2013 automaker332,We do not accept adverts for payware apps here. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now