Include printer language directly into SAP Smart Forms - printing

I am trying to print from SAP Smart Forms to an AUI BP9000 printer (Epson Emulation). As a test, we send an Epson barcode command to the printer:
[ESC][SI]123456789[ESC][SO]
The barcode (Code 39) prints fine if we send this string straight to the printer. The issue comes in when we try to print from Smart Forms. In Smart Forms, we "drag and drop" a barcode onto the form but when we try to print, the barcode doesn't print because of how the printer interprets the barcode sent from Smart Forms.
What I want to find out is if it is possible to create a "Hex Container" in Smart Forms so that when the form is printed, the printer sees the ESC command and prints the barcode.
Example:
Smart Form:
[HexContainer for ESC SI][barcode information][HexContainer for ESC SO]
What the printer sees:
[ESC SI]123456789[ESCP SO]

This can be achieved by including your hex code in a SAPscript text with HEX...ENDHEX and then include this SAPscript text in your smart form. But as pointed out by #Dirk, then the smart form won't be portable to other printer models, and so you should better opt to a "print control" at the device type level, and invoke it from the smart form (node of type command).

Related

After printer restart, settings are lost

I am using GX430t Zebra printer.
My problem is that after printer restart, printer is no longer printing special characters for Slovenia.
(example file for printing is below).
Example:
Printer is restarted and then we print example file from our application (we have our own app for printing labels). Slovenian characters are not printed:
Next step is to send that same file into printer via printer settings:
File is printed correctly:
What is even more interesting is that every file printed from our application is OK, after that step is done.
My question is: where does printer stores info about that? What I would like to do is include (if possible) this information into every file that I am printing, so regardless if printer was restarted or not, Slovenian characters will be printed correctly. Otherwise, we must use printer settings and sending example file to printer each time printer is restarted.
Example file with zebra language:
^XA^LH300,10^FO10,10^A0,20,20^FD Šazoćeđa gostinstvo d.o.o.^FS^FO10,20 ^A0,20,20^FDIme polizdelka: ^FS^FO10,40 ^A0,35,35^FDŠABAN ŠAULIĆ^FS^FO10,80 ^A0,30,30^FDDatum predpriprave: 25.04.2018^FS^FO10,120 ^A0,30,30^FDUporabno najmanj do: 25.04.2018^FS^FO10,160 ^A0,20,20^FDOddelek predpriprave: Centralna predpriprava^FS^FO10,190 ^A0,30,30^FDOddelek finalizacije: HKJ_topla kuhinja^FS^FO10,230 ^A0,30,30^FDKoličina: 7 (nar.); 0 (dos.); 7 (ned.); kg^FS^FO10,265 ^FB650,12,, ^A0,20,20^FDSestavine: MOKA PSENICNA T500 1KG (aler.: Gluten; psenica;); SOL KAMENA ; JAJCNI MELANZ (aler.: Jajca;); MLEKO SVEZE 10L (aler.: Mleko;)^FS^FO10,560 ^A0,20,20^FDPripravil: Šaban Šaulić^FS^XZ
Thanks to #banno - solution was to put proper encoding into .ZPL file. In my case, taken from this it was enough to add ^CI28 after ^XA

Send raw printer codes after writing a FlowDocument, but before automatically cutting

The Good: I'm building a FlowDocument in my app and sending it to a Star Micronics TSP100 thermal receipt printer, and I can print bar codes as well by sending ESC codes to the printer directly.
The Bad: It's automatically cutting the paper after the FlowDocument, before the bar codes have had a chance to print.
The Question: Is there a better way to print the FlowDocument so it doesn't tell the printer it's done printing? Or to have the some part of that trigger an event handler so I can squeeze my bar code commands in before it tells the printer it's done?
Here's where I am now:
The flow document is called, creatively enough, "doc".
FlowDocument doc
Then of course, I add a whole bunch of stuff to the FlowDocument. Then I grab the printer and print the FlowDocument:
string printerName = "Star TSP100 Cutter (TSP143)";
LocalPrintServer local = new LocalPrintServer();
PrintQueue rcptpq = local.GetPrintQueue(printerName);
Xps.XpsDocumentWriter xpsdw = PrintQueue.CreateXpsDocumentWriter(rcptpq);
IDocumentPaginatorSource dps = doc;
If that all worked without errors (error handling not copied--this is what I'm stepping through), I write out the receipt:
// print MOST of the receipt
xpsdw.Write(dps.DocumentPaginator);
The printer cuts here automatically. I don't want it to. I want it to cut after the bar code.
// print the bar code
RawPrinterHelper.SendStringToPrinter(printerName,"\x1b\x62\x2\x2\x30" + "MyUPC123\n");
// Cut the paper
RawPrinterHelper.SendStringToPrinter(printerName,"\x1b\x64\x02");
(RawPrinterHelper is from the Star Micronics SDK sample, and what it does is pretty self explanatory, at least with my comments to describe the specific codes being used.)
I've tried some settings in TSP100's Configuration tool regarding "Page end detection", but so far all I've succeeded in doing is turning off all cutting, or turning off the explicit "cut the paper" command at the end. I can't just turn off the first cut.
You should wait until the printer is done processing the FlowDocument print job before sending the raw escape codes. This could possibly be done by polling the PrintQueue.IsPrinting or by checking PrintQueue.QueueStatus.

How to send text file to printer

As i read in some fingerprint manual we can send text file to the printer. Means we can write the program in the text editor and send the whole program as a text file to the printer using the communication program using some transfer commands.
for in my host there is a file called myfile.txt in D:/ with the fallowing data
10 PRPOS 200,200
20 DIR 3
30 ALIGN 5
40 PRIMAGE “GLOBE.1”
50 PRINTFEED
RUN
How can i send this file to printer and execute the instrucations to print the image.
Please give me some code reference.
There are several ways to do this from the command line. For example:
type foo.txt > lpt1:
Or
copy foo.txt lpt1:
Or
print foo.txt
Or
notepad /p foo.txt
If you need to do it programmatically, you can execute any of those commands using the system() function or CreateProcess().
If you're on an Intermec handheld and you're connected to a Bluetooth printer, you should be able to open a serial port to COM6 and send your file over. What programming language? There should be plenty of Serial Port communication code examples out there.
My experience with Intermec PM4i label printer was a roller coaster but know I have a working app.
I tried Windows printer pipeline through generictext driver. It does work from Notepad but with few corner cases.
Printing directly from Notepad works fine until I tried QRCODE image with a very long text line. Image did not print out. Made qrcode text a short few characters and same script worked fine.
INPUT OFF
NASC 1252
BF OFF
FT "Swiss 721 Bold BT",12,0,100
PP 50,500:PT "Text line goes here"
PP 400,400:AN 7:BARSET "QRCODE",1,1,7,2,4
PB "ABC123 aabbcc....very long text goes here...I mean about 200 chars or more"
PRINTFEED
It was like Notepad cut text to a right side border and command string was broken. I made a printing preferences A3-landscape and it accepted longer text but still was not enough for all use cases.
All printers have a physical max printing width but it should not be considered in a fingerprint/directprotocol script files. After all we are not printing this text as-is but submitting commands to the printer.
My solution was to create Java application which opens a raw TCP socket to 11.22.33.44:9100 address and writes text lines, lines terminated by NL(#10). Works fine. Another helper tool I did was Delphi app.exe to read IP address from Windows printer object. I can submit label printouts "directly" from Excel application.
End users edit Excel data rows and click PRINT LABELS button
vba macro parses a fingerprint template file with ${FIELD1} find-and-replace substitutes
file is written to %wintemp%/intermec_script.txt folder
call app.exe to read IP address of user chosen printer
call java app to submit intermec_script.txt to IP:PORT socket
I should create same socket submit app in Delphi to drop javavm dependency but this solution was faster for my use case. I am more familiar with Java than my Delphi skill level.

what esc code sends tear off in Epson fx-1170

what is esc code to to send manual TEAR OFF command in Epson ?
There is no ESC code for the Tear OFF option, when the printer receives [FF] (Form Feed control character) and the page length is set correctly, the printer will feed the page to the Tear Off position.

Sending the return key to an emulated console application

I'm using delphi to add an graphical interface to a console application.
The problem is when the console application asks for input.
I would normally type in my input and press enter to make it accept my string, but I don't know how to do this.
I'm using this library as a "wrapper" over the console application, it uses pipes for the input and output streams.
http://koders.com/delphi/fidDB05C6361540F62D532FC7C960D4111CE3AAEDB3.aspx?s=proxy
I've tried things like WriteToConsoleApp(#04); to send an EOT, which is Control-D. This would normally work but in this case it doesn't do anything.
I've also tried WriteToConsoleApp(#13); WriteToConsoleApp(#13#10);, but none of these solutions work.
If you have any advice I would be grateful.
You can use SendMessage or PostMessage function to send string/key to console application.
For example;
SendMessage(WindowHandle, WM_CHAR, Ord('A'), 0);//sends 'A' to the window
or
PostMessage(WindowHandle, WM_KEYDOWN, VK_RETURN, 0);//sends Return to the window

Resources