Quantcast
Channel: NAV Three Tier — mibuso.com
Viewing all articles
Browse latest Browse all 10032

Send string directly to a printer with interop

$
0
0
Hi guys,
I need to directly send a string to a printer (a zebra, but it's not that important) through .net interoperability. I dug internet but what i found is this c# that i am not able to translate into nav, because there's the PrintPage event that i don't know how translate in nav. Any clue?

public void Print(string PrinterName)
{
PrintDocument doc = new PrintDocument();
doc.PrinterSettings.PrinterName = PrinterName;
doc.PrintPage += new PrintPageEventHandler(PrintHandler);
doc.Print();
}

private void PrintHandler(object sender, PrintPageEventArgs ppeArgs)
{
Font FontNormal = new Font("Verdana", 12);
Graphics g = ppeArgs.Graphics;
g.DrawString("Your string to print", FontNormal, Brushes.Black, xpos, ypos, new StringFormat());
}

Just for the record (techy stuff): why doing this stuff instead of printing a report with a single textbox to the desired zebra printer?
because i need to get this work on a webclient. Althought i worked around the fact that "webclient only prints to pdf if there's no request page" through a STARTSESSION command, i found out that doing a "REPORT.PRINT(.....)" in a start session prints a pdf and then sends the pdf to the desired printer. This screws up the text in my textbox and my zebra prints zpl code instead of the correct label.

Viewing all articles
Browse latest Browse all 10032

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>