DJENDER Ali

DJENDER Ali

  • NA
  • 28
  • 1.5k

printing in panini vision x check scanner

Dec 19 2024 9:28 AM

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: 

  • The use of the function SendPrinterData() is done according to the documentation from Panini VISION X company.
  • When executed, SendPrinterData() returns true, so it should work normally (the text in the function should be printed on one face on the check), but here nothing happens and no error rising.
  • The rest of my app works correctly (a wpf app).
  •  There is a demo app provided by Panini VISION X company and it works with it.

What have i done wrong?