How to print labels using Smart label printer

I want to print labels (barcodes) using xojo windows application.

i am using Smart label Printer 420.

Please suggest me how can i do this. It will be very useful if i get sample code.

  1. Download the SDK from https://www.smart-label-printer.com/en/software/
  2. Install SDK
  3. Extract SampleCode.zip from install directory
  4. View SlpSdk7x.h in VCSampleUnicode folder from 3) above
  5. Create declares for all calls
  6. Place SlpApi7x32.dll next to xojo test app
  7. Reference files in VCSampleUnicode for examples on how to use SDK
  8. Run and test

Hello Julian,
Thanks for reply. But still i am not able to do this.
Is there any sample program you have?
Can you please attach small sample program?

[quote=454032:@JulianS]1) Download the SDK from Software
2) Install SDK
3) Extract SampleCode.zip from install directory
4) View SlpSdk7x.h in VCSampleUnicode folder from 3) above
5) Create declares for all calls
6) Place SlpApi7x32.dll next to xojo test app
7) Reference files in VCSampleUnicode for examples on how to use SDK
8) Run and test[/quote]

I have installed SDK then placed SlpApi7x32.dll at exe location system32 and syswow64 directory but i am getting exception as method not found.
i have checked methods by System.IsFunctionAvailable but it returns false.
so what i missed ?

You’d need a Build Step that copies the dll into the Libs folder of your app so when you click Run and it creates your exe in its temp folder, the dll is in the correct place.

I can’t really help any further as I can’t test the dll as I don’t have one of those label printers, sorry.

[quote=454527:@JulianS]You’d need a Build Step that copies the dll into the Libs folder of your app so when you click Run and it creates your exe in its temp folder, the dll is in the correct place.

I can’t really help any further as I can’t test the dll as I don’t have one of those label printers, sorry.[/quote]

ok, no problem Julian.

Hello Julian,
I am successful with label printing on my machine with created build.
But when i copy entire Build folder to another machine its not working.
i have installed SDK on that machine but still not working .
Can you please tell do i need any additional step while creating build for another machine?

Would be nice if you could share how you are doing it if others want to do the same …

i have followed the steps which Julian stated above, then created declares as below

soft Declare Function SlpOpenPrinter Lib “SlpApiLab.dll” (szPrinterName as CString, nID as integer, fPortrait as Boolean) as boolean
soft Declare Function SlpDrawBarCode Lib “SlpApiLab.dll” (nLeft as Integer, nTop as Integer, nRight as Integer, nBottom as Integer, lpText as CString) as boolean
soft Declare Function SlpGetErrorCode Lib “SlpApiLab.dll” () As Integer
soft Declare Function SlpStartLabel Lib “SlpApiLab.dll” () As Boolean
soft Declare Function SlpEndLabel Lib “SlpApiLab.dll” () As Boolean
soft Declare Sub SlpDrawTextXY Lib “SlpApiLab.dll” ( x As Integer, y As Integer, iFont As Integer, lpText As CString)
soft Declare Sub SlpClosePrinter Lib “SlpApiLab.dll” ()
soft Declare Function SlpDeleteFont Lib “SlpApiLab.dll” (hFont as integer) as integer
soft Declare Function SlpCreateFont Lib “SlpApiLab.dll” ( lpName as CString, nPoints as integer, nAttributes as integer) As Integer

then just need to give call for these functions,
dim b as boolean =SlpOpenPrinter(Printername, 1 ,FALSE)
b= SlpStartLabel
dim font as integer = SlpCreateFont(“Tahoma”, 10, 0)
SlpDrawTextXY(210, 3, font, CmbPatientFirstName.Text+ " "+ CmbPatientLastName.Text)
dim e as boolean= SlpDrawBarCode(80, 35, 510, 145,CmbJobNumber.text)
b = SlpEndLabel
SlpClosePrinter

Note: This is not my exact code, just showing what i did.
and it worked only from Build folder

1 Like

I’m glad to see you got this working Chetana.

Have you installed the driver software including on the target machine and tested that you can print to the device from notepad?

If you soft declare you should check that your target function is available using System.IsFunctionAvailable if they are not available you need to check if the dll’s are in the correct folders and also check that you’re not trying to use a 64bit dll on a 32bit version of windows (rare but it can happen).