How to get started with EPL, Visual Basic, and Zebra Printing? - vb.net
I can't really find anything on how to print through EPL with Visual Basic. Can anyone help me write some simple text to the printer? I found the Zebra EPL manual so I think I can go from there, I just don't know how to get it started.
The way I do it is using the FSO to do a filecopy from of the label text file to the UNC path of the printer. (i.e. FSO.copyfile filepath, UNCpath).
Create a string with the EPL raw file (text) in it. Save it to a temp file then do the copyfile I mentioned above.
What I have found is that the best way to learn what the EPL is doing is to take an existing string and just play with the settings. Here is a sample FedEx label in EPL for you to start with. Remember - its just text.
(between the 2 'N's)
N
OD10
q812
Q1624,24
D15
ZB
LO0,459,800,4
LO0,713,800,4
LO0,1048,800,4
A35,321,0,2,1,1,N,"From:"
A35,340,0,2,1,1,N,"SHIPPING DEPT"
A35,360,0,2,1,1,N,"Company INC."
A35,380,0,2,1,1,N,"1820 SMARKET BLVD"
A35,401,0,2,1,1,N,""
A35,441,0,2,1,1,N,"(800) 999-9997"
A490,381,0,2,1,1,N,"CAD: 12345/FXRS1060"
A43,500,0,4,1,1,N,"TEST"
A43,535,0,4,1,1,N,"123-45TH"
A43,570,0,4,1,1,N,""
A35,421,0,2,1,1,N,"CHANHASSEN, MN 55317"
A490,340,0,2,1,1,N,"Ship Date: 24NOV10"
A490,360,0,2,1,1,N,"ActWgt: 12.0 LB"
A43,465,0,4,1,1,N,"TEST"
A615,465,0,2,1,1,N,"(320) 555-1212"
A43,608,0,3,1,2,N,"ST CLOUD, MN 56301"
A530,608,0,2,2,2,N,"(US)"
LO670,550,105,10
LO670,560,10,112
LO765,560,10,112
LO670,672,105,10
LO476,315,4,145
A650,485,0,3,2,2,N,"FedEx"
A690,568,0,5,2,2,N,"G"
B80,1083,0,1E,4,2,290,N,"9612304400426670000014"
A135,1397,0,4,1,1,N,"(9612302) 4000266 70000014"
A783,700,3,1,1,1,N,"J10100912242124"
A10,470,0,3,1,1,N,"TO"
A25,1420,0,3,1,1,N,"GND"
A25,1445,0,3,1,1,N,"Prepaid"
A300,1425,0,3,1,1,N,"Hazmat"
A300,1447,0,3,1,1,N,"DIRECT SIGN"
b50,740,P,800,800,s5,f0,x2,y10,r80,o0,l12,"[)>010256301840302400426670000014FDEB40042663281/112.0LBN123-45THST CLOUDMNTEST0610ZGD00411ZTEST12Z320555121223ZN22ZN20Z0.0009KTEST99ZGHAZ028004249300 26Z822a"
A645,1400,0,5,1,1,R,"HAZ"
A580,1457,0,2,1,1,N,"Emergency Contact#"
A580,1477,0,2,1,1,N,"8004249300"
A16,670,0,1,1,1,N,"Ref: TEST"
A16,685,0,1,1,1,N,"INV: "
A16,700,0,1,1,1,N,"PO: TEST"
A406,700,0,1,1,1,N,"Dept: "
P1
N
As you can see the Coordinates are the first 2 sets per line.
A indicates text I believe.
b indicates barcode.
I dont know all the parameters off the top of my head, but you mentioned you had a manual so it should list those details for you.
Hope this helps.
Here's a great blog post by Nicholas Piasecki how to send EPL code to the printer:
Sending Raw EPL2 Directly to a Zebra LP2844 via C#
I was using Zebra printers before (so I already knew EPL), but when I had to print from .NET the first time, I managed to get it to work just with the information from this blog post.
Note that the example code is in C#, but you can translate that to VB.NET.
(the post also mentions an external class named RawPrinterHelper which you can download from Microsoft - if you don't want to translate this to VB, just put it into a separate C# assembly and reference that in your VB project)
If you need to print images too, here's another blog post by the same guy about this:
Using the EPL2 GW command to send an image to a Zebra thermal printer
Related
How to Implement Word Level in google / diff-match-patch C#
I am trying to implement word level matches in Google Diff Match Patch, but it is beating me up. The result I get is: =I've never been =|-a-|=t=|= th=|-e-|=se places=| =I've never been =|=t=|+o+|= th=|+o+|=se places=| The result I want is: =I've never been =|-at these-|= places=| =I've never been =|+to those+|= places=| The documentation says: make a copy of diff_linesToChars and call it diff_linesToWords. Look for the line that identifies the next line boundary: lineEnd = text.indexOf('\n', lineStart); In the c# version, I found the line to change in diff_linesToCharsMunge, which I changed to: lineEnd = text.Replace(#"/[\n\.,;:]/ g"," ").IndexOf(" ", lineStart); However, there is no change in granularity -it still finds differences at character level. I am calling: List<Diff> differences = diffs.diff_main(linepair.Original, linepair.Corrected, true); diffs.diff_cleanupSemantic(differences); I have stepped through to make sure that it is hitting the change I made (incidently, there is a hardcoded minimum of 100 characters before it kicks in).
I have created a sample dotnet project with diffmatch program. Its probably older version of DiffMatchPatch file but the word and lines work. DiffMatchPatchSample For your above sample text ,I get below output. at these | to those
Error while exporting TXTextControl as PDFA or XML
i gain a strange error: 'This feature is not available in the TX Text Control Standard or Professional version. The TX Text Control Enterprise version must be installed.' when I try to save the TXTextControl object with .Save function in .pdfa, .xml and other formats. The error comes when I explicit the StreamType parameter in the .Save function. It seems I have not all the format offered by TXTextControl. Error comes in this line for example: TXTextControl.Save(dir, TXTextControl.StreamType.XMLFormat) or TXTextControl.Save(dir, TXTextControl.StreamType.AdobePDFA) I searched online but I can't find references to this error and for TXTextControl enterprise or professional version. There 's actually different versions of TXTextControl? How can I verify what version I have? Thanks.
Using TXTextControl.GetVersionInfo().Level should tell you what level you have (as per ProductLevel property) If you look at the Features page and open up the Supported Formats section under "Features in Detail" then you can see which formats your product level supports.
ZeroBrane : Register APIs on a per file basis
I'm writing a ZeroBrane Studio plugin for our Solarus Game Engine and It works like a charm. Autocompletion included. I'm wondering now if it's do-able to register lua APIs for one file only. I need this to offer autocompletion/documentation on global symbols that may vary per-script but are deducible from annex files from the engine. To summary : Is it possible to register an api for a single file? For example in the onEditorLoad() event. Thanks. Greg EDIT: I tried the following without sucess: local function switch_editor(editor) if current_editor == editor then ide:Print("same editor") return end current_editor = editor if not editor then ide:Print("null ed") return end lua_file_path = ide:GetDocument(editor).filePath if lua_file_path:match('/data/maps/') then ide:Print("map file!",type(editor)) local map_api = make_map_api(lua_file_path) current_api = map_api ide:AddAPI('lua','solarus_map',map_api) else ide:Print('other file') if current_api then ide:RemoveAPI('lua','solarus_map') current_api = nil end end end api = {"baselib", "solarus", "solarus_map"}, --in interpreter table ... -- in the plugin table : onEditorFocusSet = function(self,editor) switch_editor(editor) end, Completion with the solarus api works fine but the on-fly registration of the solarus_map api seem not to be taken in account. EDIT2: Silly my, I must have done a typo, because after checking and rewriting some things pretty much as in the code pasted above... it works! Awesome! The only small gotcha is that when switching to a file where I don't want the solarus_map API... ide:RemoveAPI isn't sufficient. Instead I must do ide:AddAPI('lua','solarus_map',{}) to replace the API with an empty one. Which I can live with.
To summary, to achieve a custom api which change from file to file: Add the api name to the interpreter In the onEditorFocusSet event, update the API with ide:AddAPI(...), eventually setting it to {} if it needs to be empty/disabled. Code sample in the editions of my Question.
Easy way to get and modify a .vb file like a text file
I'm creating a vb.net application for converting a Data Access Layer classes from Oracle DB oriented to SQL Server DB oriented , And i must convert every Oracle oriented class like : OracleCommand , OracleDataAdapter , OracleDataReader ... to it's SQL Server equivalent . Is there any way to get methods list from .vb file and to get the body of each method from vb application to change it dynamically and create new version of each file ???
If you compile in debug mode, one of the output files is PROGRAMNAME.xml, which contains all the method signatures for the EXE. (Where PROGRAMNAME is the name of your EXE). You can write a program to edit the .vb files just like any other text file, because they are text files.
Download trial version of Resharper and it will help you to do it with no pain. One month trial should be enough. VS also has some tools - "Find all references" and "Find and Replace in Files". So, you can Find and replace Oracle... To Sql... On the other note, why not writing wrappers that will provide DB-agnostic providers for command, transaction, etc. For example, instead of Dim reader As OracleDataReader = OracleCommand.ExecuteReader... Do this Dim reader As IDataReader = MyAgnosticCommand.ExecuteReader... So, if the new boss is coming tomorrow and says, "Oh we need oracle" - you don't have to do it all over again.
How to convert certain C# code to VB.NET
I've been googling around around and read this article C# How to get SQL Server installation path programatically? and this is exactly what i need in VB.NET , however i'm not good in translating this code into VB.NET Code. So, any help would greatly appreciated. Thank you. Note : I'm using SQL Server 2005 and Visual Basic 2008
While the question was originally titled about retrieving SQL Server's installation path, I felt it was more about a code translation problem (the solution already existed, just not in the right language). But then I thought that the method in the original code was fairly blunt. Evan provided you with what I assume is a workable translation of the existing solution. But probably a much easier way to perform this specific task - assuming you just need to find the installation path for an instance you're already connected to, and assuming that a user who can read the registry will also have VIEW SERVER STATE permissions - is to issue this simple query against the DMV sys.dm_os_loaded_modules from your program: SELECT name FROM sys.dm_os_loaded_modules WHERE name LIKE '%sqlservr.exe'; This will give you something like this: C:\Program Files\Microsoft SQL Server\MSSQL11.SQL2012\MSSQL\Binn\sqlservr.exe You have some parsing to do, depending on exactly what you're after (e.g. do you want to stop at MSSQL, or Binn?), but this is much easier than reading the registry or other methods that are out there IMHO.
I just used a code converter ... There are only basic things that need to be changed .. Using sqlServerKey As RegistryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Microsoft SQL Server") For Each subKeyName As String In sqlServerKey.GetSubKeyNames() If subKeyName.StartsWith("MSSQL.") Then Using instanceKey As RegistryKey = sqlServerKey.OpenSubKey(subKeyName) Dim instanceName As String = instanceKey.GetValue("").ToString() If instanceName = "MSSQLSERVER" Then 'say Dim path__1 As String = instanceKey.OpenSubKey("Setup").GetValue("SQLBinRoot").ToString() path__1 = Path.Combine(path__1, "sqlserver.exe") Return path__1 End If End Using End If Next End Using If you were to just read a quick article on C#, you would notice that strings are declared differently, and minor syntax discrepancies exist such as foreach vs for each You can read here for some more common differences.
I use a very good (offline) tool, called Convert .NET Free It's from www.fishcodelib.com Here's a direct link to the latest release (as of 19/04/14) Size: 2.06MB, File: Zip : [Direct Link] Hope this is of some use ;) P.S. This software requires .NET Framework 4.5.
This almost never fails! :) Good Luck http://www.developerfusion.com/tools/convert/csharp-to-vb/