Hi all,
I'm trying to print to a Brother label printer from my PB App. Everything is fine until I execute iDoc.PrintOut() function (iDoc is the OLEObject). The function keeps returning the same error (Error 11 - Printer not supported). But I can print a label from Brother's own PTouch Editor Software. I'm sure the ole objects are working right because prior to the PrintOut, I loop through all the objects on the ole document and fill in variables as needed.
Here's my code:
// Set all of the fields, then print
li_max = iDoc.Objects.Count()
// Change the text values
for li_count = 1 to li_max
ls_name = iDoc.Objects[ li_count - 1 ].Name
CHOOSE CASE upper(ls_name)
CASE "WO#"
iDoc.Objects[ li_count - 1 ].Text = string(dw_label.GetItemNumber(1,"workorder_id"))
CASE "INST ID"
iDoc.Objects[ li_count - 1 ].Text = dw_label.GetItemString(1,"instrument_id")
CASE "CAL'D"
iDoc.Objects[ li_count - 1 ].Text = string(dw_label.GetItemDateTime(1,"cal_date"), "mm/dd/yyyy")
CASE "DUE"
if NOT IsNull( dw_label.GetItemDateTime(1,"cal_due") ) then
iDoc.Objects[ li_count - 1 ].Text = string(dw_label.GetItemDateTime(1,"cal_due"), "mm/dd/yyyy")
else
iDoc.Object[ li_count - 1 ].Text = "NPCR"
end if
... MORE CASES
next
// Set the printer
idoc.SetPrinter(is_printer, FALSE)
// Print setting start
if ( idoc.StartPrint("Cal Label", 0) = false) then
MessageBox("idoc.StartPrint", "Failure", Information!)
istr_parms.canceled = true
end if
lb_rc = idoc.PrintOut(1,0) --- Error here
if lb_rc = false then
MessageBox("Print Out", "Failure", Information!)
MessageBox("Print Out", "Document Error Code: " + string(idoc.ErrorCode) ) --- Code 11, Printer not supported
MessageBox("Print Out", "Printer Error Code: " + string(iPrinter.ErrorCode ) )
MessageBox("Print Out", "Printer Error string: " + string(iPrinter.ErrorString ) )
istr_parms.canceled = true
end if
idoc.EndPrint()
I don't know what driver it's calling, or even how to find out what driver is installed on my machine. Could this be related to the fact the fact that my operating system is Windows 10 64-bit and PB21 is 32-bit? I'm also wondering if I'm supposed to define a Global Function? If so, what function? Total confusion over here in developer land...
TIA,
~~~Tracy