How to send ESC commands to dymo label printer

I need to print label with barcode from dymo label printer on windows . For that purpose I used “winspool.drv” and writes raw data to the printer(esc commands). The result is printer is opened but does not print anything.
I tried with following code

  if printer.Open("DYMO LabelWriter 450 Turbo") then
    job= printer.StartDoc("my document")
    if job> 0 then
      if printer.StartPage then
         call printer.Write(chrb(29)+chrb(104)+chrb(255))    //barcode height
        call printer.Write(chrb(29)+chrb(119)+chrb(2))       //barcode width
        call printer.Write(chrb(29)+chrb(107)+chrb(4)+" **17 digits string **"+chrb(0)+chrb(10))   //barcode
        call printer.Write(EndOfLine)
        call printer.write("this is a test"+ EndOfLine+ "line 2 test")
        call printer.write(EndOfLine)
        call printer.write(chrb(27)+ "(s3B")
        call printer.write("bold line 3")

This code opens the printer but does not prints anything.
Can any one help me to understand how to give esc commands to “DYMO” printer

Try something simple first

Can you get

printer.write "Hello" printer.write chrb(27) + "E"

to produce Hello and eject the page?

Yes firstly I also tried to send only text , results it printed on label even when I seding chr(65) then “A” also printed .When I used chr(29) then printer does not print anything.

Are you sure it should be chr(29) and not chr(27)?

No, he’s right, the docs say the mnemonic for GS is chrb(29)

[quote]GS k Print Barcode
Prints a barcode at the current position in the current orientation. The n parameter
selects the symbology to be printed. (See the table below.) The m parameter specifies
how many characters are to be encoded as part of the barcode. If the number of
characters to be encoded is variable, the m parameters can be set to zero. This will cause
the printer to read the next character sent as a delimiter character. Further characters will
then be encoded into the barcode until a character is found that matches the start
ASCII GS k n m d1…dm
Decimal 29 107 n m d1…dm
Hex 1D 6B n m d1…dm
n Selects the barcode symbology to be used
Specifies the number of characters to be encoded. Also specifies which
EAN/UPC symbology will be used
d1…dm The data characters to be encoded.

so maybe you would be looking for something like

call printer.Write chrb(29)+chrb(107)+chrb(4) +chrb(17) + " **17 digits string **" ?