import ctypes


dll = ctypes.windll.LoadLibrary("./TLXLabelPaint.dll")
print('Init library:', dll.TLXInitLibrary())

labelHandle = ctypes.c_int(0)
pHandle = ctypes.pointer(labelHandle)

lpszFileName = ctypes.c_wchar_p(
    'E:\\LabelPrinter\\silver\\zebra_silver_general_3010.lsdx')

ret = dll.TLXOpenDocumentW(lpszFileName, pHandle)
print('Open document:', ret)
m_labelHandle = labelHandle.value
print('label handle:', m_labelHandle)

level = ctypes.c_int()
pLevel = ctypes.pointer(level)
authRet = dll.TLXGetDocumentLevel(m_labelHandle, pLevel)
print('auth:', authRet)
print('DocumentLevel', level.value)


lpszPrnName = ctypes.c_wchar_p()
print(dll.TLXGetPrinterNameW(m_labelHandle, ctypes.pointer(lpszPrnName)))

print(lpszPrnName.value)


dll.TLXSetPrinterNameW(m_labelHandle, ctypes.c_wchar_p(lpszPrnName.value))
dll.TLXEnablePrintStatus()
# qty = ctypes.c_int(1)
copy = ctypes.c_int(1)
# err = ctypes.c_int(2)
bAutoClose = ctypes.c_bool(False)
print(dll.TLXOutputLabel(m_labelHandle, copy, bAutoClose))
# print(dll.TLXOutputDocument(m_labelHandle, qty, copy, err))