Hi,
I have the folowing to enable printing a simple text line with vision x panini check scanner:
if (OnLine(DeviceId)) { ... ... LOGFONT font = new LOGFONT();//struct in default (all to 0) if (!SendPrinterData(DeviceId, 0, font, "PRINTING TEST", 20, NULL, 0, 0)) { StringBuilder erStrPrinter = new(200); if (GetEngineApiErrorString(ref erStrPrinter, 200)) { SendScannerLog("PRINTER_EXCEPTION: " + erStrPrinter.ToString()); Trace.WriteLine(erStrPrinter.ToString()); } } if (!StartFeeding(DeviceId)) { ... ...
and here is the SendPrinterData() function signature with the font struct:
[DllImport("VisionAPI.dll", EntryPoint = "?SendPrinterData@@YGHKKUtagLOGFONTA@@PADK1KK@Z", CharSet = CharSet.Unicode)] public static extern bool SendPrinterData(uint DeviceId, uint Head, LOGFONT lf, string? strToPrint, uint strToPrintOffSet, string? imgPath, uint imgOffSet, uint imgSrcType); [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] public struct LOGFONT { public const int LF_FACESIZE = 32; public int lfHeight; public int lfWidth; public int lfEscapement; public int lfOrientation; public int lfWeight; public byte lfItalic; public byte lfUnderline; public byte lfStrikeOut; public byte lfCharSet; public byte lfOutPrecision; public byte lfClipPrecision; public byte lfQuality; public byte lfPitchAndFamily; [MarshalAs(UnmanagedType.ByValTStr, SizeConst = LF_FACESIZE)] public string lfFaceName; }
Things to know:
What have i done wrong?