[Gambas-user] printer problem

Charlie Reinl Karl.Reinl at ...2345...
Fri Feb 5 23:15:32 CET 2010


Am Freitag, den 05.02.2010, 12:39 +0100 schrieb Rolf-Werner Eilert:
> Am 04.02.2010 20:59, schrieb Charlie Reinl:
> > Am Donnerstag, den 04.02.2010, 09:48 +0100 schrieb Doriano Blengino:
> >> Charlie Reinl ha scritto:
> >>> Salut,
> >>>
> >>> I still haven't solved the Draw.Text tab problem, but I'v a new one (a
> >>> problem).
> >>>
> >>> 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.
> >
> > 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.
> >
> 
> Benoit gave me the advice to print into a file and send the result to 
> the device (kprinter on my system) rather than using the printing system 
> of Gambas itself. So I changed everything in a way that I have my own 
> dialog for the printer and you can click on "Properties" there which 
> pops up the official printer dialog. My own dialog will then read out 
> for example if a file is set or the file string is empty.
> 
> The program then prints all pages into one or more files and calls 
> kprinter via a SHELL and with --no-dialog, if necessary file after file. 
> This causes a small message to pop up for half a second, just the way my 
> Thunderbird and Firefox are doing it, but there is no kprinter dialog. 
> It prints directly then.
> 
> If you wanted, you could print a standard file with all pages in a 
> standard sorted row and then call kprinter enabling the user to decide 
> which pages to print etc. This is the way Acroread does it on my system.
> 
> CUPS has many advantages of an independent printing system, but it wants 
> ready-made files to process. So you have to distinguish clearly between 
> program-related and printer-related properties.
> 
> Rolf

Salut Rolf,

does kprinter still exists ?

Yes I know about all that things, and we do in that project a preview
like in Acrobat Reader, also a range of pages can be defined and only
these pages will be print, the Numbers of Copies are managed by the
program, and while testing that, I found that behave, or should I say
bug!

And while talking about the printer object, I asked also the other
questions. 

Thanks
Charlie







More information about the User mailing list