Page 2 of 2
How I set the paper source
Posted: Thu Nov 29, 2007 3:56 am
by ChristianH
I thought I was knowing how to handel this issue but now I got the same problem:
I´ve a printer that is just ignoring the papersouce setting and always takes the standard tray. I can control number of copies, duplex print, ... but not the papersource !
From MS Word the printer accepts the diffrent papersources...
How I set the paper source
Posted: Thu Nov 29, 2007 4:14 am
by EDV Gradl
First you must check which trays are available:
Code: Select all
foreach (string Printer in PrinterSettings.InstalledPrinters)
{
Console.WriteLine("--- " + Printer + " ---");
PrinterSettings pSettings = new PrinterSettings();
pSettings.PrinterName = Printer;
for (int i = 0; i " + pSettings.PaperSources[i].SourceName);
Console.WriteLine();
}
Console.ReadKey();
Then you get the trays.
There are actually more number then trays. e.g for a printer with 3 trays I get:
0 - Tray 1
1 - Tray 2
2 - Tray 3
3 - Automatically Select
4 - Default
5 - Manual Feed
6 - Printer Select
So you have to check for the right number and then:
Code: Select all
StiReport MyReport = new StiReport();
PrinterSettings ps = new PrinterSettings();
ps.DefaultPageSettings.PaperSource = ps.PaperSources[x]; // x is the tray you want to use
MyPrint.Print(ps);
Works fine for me. :biggrin:
Marco
How I set the paper source
Posted: Thu Nov 29, 2007 8:00 am
by ChristianH
Thanks, Marco.
But this is what I´ve already tried so many times without success.
The Minolta technican told me when we set a different papertype for printing on a special tray it is important to set this papertype for this tray ON THE PRINTER before as well !
But it had noh (positiv) effect !
How I set the paper source
Posted: Thu Nov 29, 2007 8:32 am
by EDV Gradl
Hi Cristian,
first of all, controlling printers under windows is shit.
That said, with this code it worked for me on an HP printer, with 3 trays. Tte problem was that Tray 1 was not 1 as expected, but 4 (or something like that), whereas 1,2 and 3 were all some kind of automatically select.
The paper size is determend by the report definition. I work with A4 and as long as the tray I am printint to is set to A4 it works fine. When the tray is set to another size (via the printer driver), I get an error, that a wrong of type of paper is inserted and that I should insert it ot press ok.
For this are two different problems. First of all you should try to print to a specific tray and use the default paper size that is set in the printer driver. After that you could try changing the paper size (either in the report definion or via code).
The code I use to set the paper size in the print routine is something like that:
Code: Select all
int Height = (int)(this.Höhe / 0.254);
int Width = (int)(this.Breite / 0.254);
PaperSize MyPaperSize = new PaperSize("WGPNextGen", Width, Height);
StiPrintProvider.PaperSizeForUsing = MyPaperSize;
I hop that helps somehow.
Marco
How I set the paper source
Posted: Fri Dec 07, 2007 2:59 am
by ChristianH
Thanks for the hint, Marco.
But this doesn´t work for my printer.
After a lot of tests my summary is: Every printer reacts different !
In my case: I try to print on a Konica Minolta C250 Colorlaser and want to use the manual papertray and thicker paper (carton).
The papersource and -type on printer AND from dialogform has to match for a correct printout. But it seems that the properties from the printdialog aren´t passed right to the printer (maybe a problem caused by the report.print method ?)
Another problem seems to be the big printfile >5 MB , but this can be solved through other printer settings (spooling,...).
How I set the paper source
Posted: Fri Dec 14, 2007 4:21 am
by ChristianH
After another few hours of testing I was able to isolate my problem:
The papersource is passed correctly and the filesize isn´t a problem, too.
It seems that the different papertype (thick paper) isn´t passed to the printer correctly.
The Minolta printer compares the papertype to its predefined type (has to be done manually on the printer) and as the papertypes doesn´t match the printer starts a default program which fetches paper from standard papertray...