[WD18] Printer and iPaperSource

Startbeitrag von Markus K. am 15.01.2014 12:45

Hi,

i have a printer with several trays (Hewlett-Packard HP LaserJet P3010 Series) and i try to print to specific paper trays.

sDrucker is string = "Hewlett-Packard HP LaserJet P3010 Series"
iConfigure(sDrucker)
iParameter(iPaperSource, iPaperSource_Upper)
iDestination(iPrinter)
iPrintReport(RPT_Text)

Changing the constants to iPaperSource_Middle or iPaperSource_Lower doesnt work, paper always comes from the same tray.

Documentation says that i can test if the printer can handle specific values:

Modifying the print parameters via constants
If the requested setting is not accepted by the printer, the returned value will not be the one passed in parameter.
For example, to use the A3 format with a printer that does not support the A3 format:
// Switch to A3 format
IF iParameter(iPaperSize, iPaperSize_A3) = False THEN
// failure switching to A3 format
END


I tried many values (e.g. -1, "xy") for iPaperSource which should be wrong but there is never a result with value false:
if iParameter(iPaperSource, -1) = false then
info("falsch")
END

Can you tell me me what i am doing wrong?

Antworten:

Hi Markus

I'm not sure you are doing anything wrong, but here is what I find strange in your request...

You are talking both of changing trays, and of changing paper size...

Now, you are not saying that each paper tray contains a different size of paper, but if that is the case, and you try to change paper trays in order to print on A3 instead of A4 (by example) it may be that your printer is too smart, detects that the report is originally made for A4 and redirect to the A4 tray...

So if that is the case, you should try to change the paper size requested, and then see if the printer goes to the right tray (of course, just changing the paper size with iparameter may not be enough if your report has been defined as a specific paper size... the report printing system is probably sending a iparameter of its own for the correct paper size, so make sure that when you request A3, your report is defined in A3, or you are printing with code, not a report)


Best regards

von Fabrice Harari - am 15.01.2014 13:26
Hi Fabrice,

i need just changing trays, the code for changing paper size is from the documentation.

Both trays hold A4 paper. But i need to print on both trays. For example i print an invoice on tray 1 which holds white A4 paper. In tray 2 is a preprinted form for the the Swiss ESR (transfer voucher) which i need to complete with information from the invoice.
Two slots with same paper size but for different purposes.

If i choose the tray manually in printer properties in Word then it works.

von Markus K. - am 15.01.2014 14:58
Hi,

Maybe this can help

Set the printer to the disired tray under windows
In Windev do a Trace(iParameter(iPaperSource)) of that printer
This is the value you need

von Walter Dieltjens - am 15.01.2014 16:50
I think the Windev constant are not useable for this printer.
Like Walter says: get the value from the printer itself
I use this code to show the printer-window, select a papertray and save this value for later

// Don't save the specified settings
iConfigure(sPrinter,True)
// preset the window with the value choosen before
iParameter(iPaperSource,nPapertray)
// show the parameter window
IF iConfigureReport(RPT_RouteLijstKlant) THEN
// get the new paper source
nPapertray= iParameter(iPaperSource)
here I;m saving this value to the database for later use, when printing
END


nPapertray is int = read from the db
IF nPaperTray > 0 THEN
iParameter(iPaperSource, nPaperTray)
END

von Arie - am 15.01.2014 20:14
Hi Walter and Arie,

now it works, thank you very much!

Markus

von Markus K. - am 16.01.2014 09:52
Hi Markus,
I have same issue. I have a printer with 3 different trays. But when I try to print. Its printing only in the first tray.
Can you help me on how you did?

Thanks and regards,
ECH

von ech madriaga - am 09.12.2014 08:36
Hi,
sorry for late answer.

I use iParameter(iPaperSource) to get the correct tray.

von Markus K. - am 15.12.2014 13:23
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.