[Gambas-user] printer problem
Doriano Blengino
doriano.blengino at ...1909...
Fri Feb 5 10:09:13 CET 2010
Charlie Reinl ha scritto:
> Am Donnerstag, den 04.02.2010, 09:48 +0100 schrieb Doriano Blengino:
>
>> Charlie Reinl ha scritto:
>>
>>> If you open the printer-setup the first time, the 'Print to printer' is
>>> chosen, and the target-file behind 'Print to file' is empty.
>>>
>>> If you check 'Print to file' and fill the target-file and then you
>>> switch back to 'Print to printer', the target-file field is disabled.
>>> (Setup Printer.png)
>>>
>>> Everything seems to be alright.
>>>
>>> But, and there is my new problem, in my code I can't see what should be
>>> done. (printing 5 times to file, makes no sense)
>>>
>>> Where is the magic pointer, which shows me the chosen device?
>>> (Printer Properties.png)
>>>
>>>
>> For what I know about printing in gambas, things are as following.
>>
>> You can set by code printer.file to print to a file (a postscript is
>> generated), or set printer.name to direct the printing to an actual
>> printer. If printer.file is non-empty, the printing will go to a file.
>> The same is true if those properties are set by the interactive setup
>> panel. After that, you don't have to worry about the destination, the
>> code is the same: you draw() on the printer, and the underlying software
>> will do what is appropriate.
>>
>> Other properties let you to define other printing aspects, like page
>> format, b/w or color, and so on.
>>
>> The properties Copies, FromPage and ToPage are different, because they
>> don't do anything - you should read them and do things accordingly. To
>> be more precise, FromPage and ToPage are exactly so (if you read that
>> the user has set FromPage=2 and ToPage=2, then your printing routine
>> should only print the page number 2, and then terminate). "Copies"
>> sometimes works, sometimes not, so I decided to read the number of
>> copies, reset it to 1, and print several copies myself. I mean: "Copies"
>> was sometimes working, sometimes was ignored, and sometimes messed up
>> the printing. If you choose to do multiple copies by code, don't forget
>> to reset Copies to 1.
>>
>> About printing several copies to a file, I see nothing strange... a
>> postscript file should be generated, containing two or more identical
>> pages. If you feed that file to a printer, multiple identical pages get
>> out. But in the first attempt, I did it differently, and I crashed into
>> rewriting the same file several times, as you are arguing. Can't
>> remember if it was my fault or gambas or qt one. I solved all together
>> by invoking multiple times the subroutine which prints a single page,
>> inside a "draw.begin()" and "draw.end()".
>>
>
> Salut Doriano,
>
> letting a part the tab-Problem, the printer problem is not the existing
> properties of the gambas2-printer.
> The problem is you have no information about the output device, after
> printer.setup().
> With a bit of luck, the target-file (printer.file) is empty, so it is
> sure the device is a printer (checked "Print to file" with an empty
> target-file, disables the OK-Button ).
>
> Knowing the output device is important for "Copies", because printing
> the same "output" x-times to the same file makes no sense.
>
> So I repeat my question, where/how can I see/test the output device,
> after printer.setup.
>
Printer.name.
This name identifies a CUPS device, and has little to do with the
physical device.
And about printing several copies to a file, I repeat after you that I
see nothing strange... if you think at a PDF or PS file which describes
a complete document. When you submit jobs to a shared printer, may be
that your job will be completed after other, already scheduled jobs by
some other users; but when the printer will do your job, it will do it
completely - no matter how many copies you requested. So a single
printer job may be thought as a single file, even if it contains
multiple copies. The only care is that when requesting multiple copies,
you must start the printing (Draw.Begin) only once, use newPage()
properly, and end the printing (Draw.End) only once. It does not matter
if output goes to a file or to a printer; actually, even if you direct
output to a printer, internally the printing job is a single file...
> By that way, if somebody can tell me, how/where "Print first page first"
> and "Print last page first" can be read out, and/or what is to do, for
> make it working.
>
There is no mention of that in the documentation on my PC. I went to the
online documentation, and the site asks me to authenticate. I really
don't know...
Regards,
Doriano
More information about the User
mailing list