PC SOFT

PROFESSIONAL NEWSGROUPS
WINDEVWEBDEV and WINDEV Mobile

Home → WINDEV 2024 → iConfigure label printer
iConfigure label printer
Started by Mark Crichton, Jul., 27 2016 5:51 AM - 3 replies
Posted on July, 27 2016 - 5:51 AM
Hi Folks
Appreciate some help with the following.

using Windev 21 - label printer is Brother QL-720NW

I have app with two printers. A4 and Label whose names are stored in data table.
When user selects [Print Label] I want to select the label printer, set number of copies and print. Should be straight forward, but unless I actually run IConfigure() that displays on screen for user to click [ok] It prints with wrong parameters.

Below is my code


// Step 1 - select printer as label printer

iDestination(iPrinter,"Job lbl-62mm")
IF iConfigure(dwrcompany.DWRPRNLBL) THEN // the name of the lable printer
iParameter(iOrientation, iOrientation_Portrait) // make sure set to portrait
iParameter(iPaperSize,"62mm") // label width set to size of continuous label used
iParameter(iCopies,gnCopies) // number of copies to print



Trace("---------------- A , B ----------------")
Trace("Orientation = " + iParameter(iOrientation))
Trace("PaperSize = " + iParameter(iPaperSize))
Trace("NbCopies = " + iParameter(iCopies)) // Trace shows "changed " values

iPreview(ipvZoom100) // Just for testing
iConfigure(iInfoPrinter(True)) // tried this, but does nothing
iConfigure() // USER CLICKS OK... DO THIS AND ALL PRINTS PERFECTLY. IF NOT THERE PRINTS WITHOUT CHANGING THE PARAMETERS. SEEMS I NEED TO "SAVE" THE PARAMETERS TO THE PRINTER SOMEHOW.

iInitReportQuery(lbl_stkLabel2,TABLE_StockIssue.COL_Stkid)
iPrintReport(lbl_stkLabel2,"Test1")
ELSE
Info("Error configuring label printer... ")
END

Any tips appreciated
Thanks Mark
Posted on July, 27 2016 - 7:55 AM
Hi

Try to use

iConfigure("Actual print Queue name defined in device and printer")

with quotes as above and it should go with your wanted printer then

and use iPreview to see if it works out and no need to use iconfigure() as

it always popup list of printQues asking to select the right one, then apply

iPreview(100) to see if it works out.

HTH

King
Posted on July, 31 2016 - 10:46 AM
Hi King

Thanks for advice. Tried your idea. Using my variable sets the printer ok.

Finally found the problem which is outlined below in case it helps others.. Do not set all the iParameter settings, as the report does that according to it's own settings. Rather make sure reports "Page Layout and format of labels" is set correctly and tests ok via just running the label report directly. I found there was a conflict between the "Paper" settings and the "Label" settings. By trying various options and previewing, I finally found a combination that worked ok. ie label smaller than page by margins plus a bit spare... some were self calculating, so shouldn't adjust. ( Brother QL-720NW )

Only iParameter I now pass is the number of copies.

Below is my code for a switching printers as store in a data file. ( I have to make sure that I set the printer before every report in the application or set it back to default printer after print job )

// Step 2 - Print A4 report on A4 printer as store in data file
iPreview(i100)
IF iConfigure(dwrcompany.DWRPRNA4) THEN
HExecuteQuery(QRY_Stock_CodeStatus,hQueryDefault,Null,Null,Null,1,Null)
iPrintReport(RPT_StkIssue)
ELSE
Info("Error configuring A4 printer... ")
END
....... further on...

// so also need to print a label on the LBL printer as stored in data file
iDestination(iPrinter,"Job lbl-62mm")
IF iConfigure(dwrcompany.DWRPRNLBL) THEN
iParameter(iCopies,gnCopies)
iInitReportQuery(lbl_stkLabel2,TABLE_StockIssue.COL_Stkid)
iPrintReport(lbl_stkLabel2,"Test1")
ELSE
Info("Error configuring label printer... ")
END


Regards
Mark
Posted on July, 31 2016 - 11:09 AM
Hi King

Thanks for help. Found the problem was 2 different problems I'll outline below in case it helps someone else

My problem was with the label format and with using iConfigure.

First I used th eBrother P-Touch Editor to check printer settings and get a label to print. That done I set Windev label up the same, and found that I needed to set paper size bigger than label size. I tested the label o ot's own and got that working.
Then ran it with no iConfigure and it worked fine. Then added no of copies an still worked fine.

Below is my code to change printers and print A4 then labels.


// Printer names are stored in data table

// Step 2 - Print report
iPreview(i100)
IF iConfigure(dwrcompany.DWRPRNA4) THEN
HExecuteQuery(QRY_Stock_CodeStatus,hQueryDefault,Null,Null,Null,1,Null)
iPrintReport(RPT_StkIssue)
ELSE
Info("Error configuring A4 printer... ")
END


// Step 3 - Print label
iDestination(iPrinter,"Job lbl-62mm")
IF iConfigure(dwrcompany.DWRPRNLBL) THEN
iParameter(iCopies,gnCopies) // global variable
iInitReportQuery(lbl_stkLabel2,TABLE_StockIssue.COL_Stkid)
iPrintReport(lbl_stkLabel2,"Test1")
ELSE
Info("Error configuring label printer... ")
END

Regards Mark