1. Printing graphics question
- Posted by don cole <doncole at pacbell.net> Dec 17, 2004
- 465 views
junk=getPrinter() if startDoc( "My Print Job" ) then-- start up the document end if junk=startPage()
drawEllipse(id,False, 10, 10, 100, 100)
if endDoc() then releasePrinter() end if </eurcode>
The above code works fine if id is a window, but prints nothing if it is Printer.
Is there an easy of doing this or do I have to make bitmaps? don cole SF }}}
2. Re: Printing graphics question
- Posted by Jonas Temple <jtemple at yhti.net> Dec 17, 2004
- 419 views
don cole wrote: > > > }}} <eucode> > junk=getPrinter() > if startDoc( "My Print Job" ) then-- start up the document > end if > junk=startPage() > > drawEllipse(id,False, 10, 10, 100, 100) > > if endDoc() then > releasePrinter() > end if > </eurcode> > > The above code works fine if id is a window, > but prints nothing if it is Printer. > > Is there an easy of doing this or do I have to make bitmaps? > don cole > SF > Don, In your drawEllipse what is "id"? Is this a handle to the printer? Jonas Jonas Temple http://www.yhti.net/~jktemple
3. Re: Printing graphics question
- Posted by don cole <doncole at pacbell.net> Dec 17, 2004
- 441 views
Jonas Temple wrote: id is either Printer or CWindow_Print_Preview > > don cole wrote: > > > > > > }}} <eucode> > > junk=getPrinter() > > if startDoc( "My Print Job" ) then-- start up the document > > end if > > junk=startPage() > > > > drawEllipse(id,False, 10, 10, 100, 100) > > > > if endDoc() then > > releasePrinter() > > end if > > </eurcode> > > > > The above code works fine if id is a window, > > but prints nothing if it is Printer. > > > > Is there an easy of doing this or do I have to make bitmaps? > > don cole > > SF > > > Don, > > In your drawEllipse what is "id"? Is this a handle to the printer? > > Jonas > > Jonas Temple > http://www.yhti.net/~jktemple >
4. Re: Printing graphics question
- Posted by Derek Parnell <ddparnell at bigpond.com> Dec 17, 2004
- 476 views
- Last edited Dec 18, 2004
don cole wrote: > > > }}} <eucode> > junk=getPrinter() > if startDoc( "My Print Job" ) then-- start up the document > end if > junk=startPage() > > drawEllipse(id,False, 10, 10, 100, 100) > > if endDoc() then > releasePrinter() > end if > </eurcode> > > The above code works fine if id is a window, > but prints nothing if it is Printer. > > Is there an easy of doing this or do I have to make bitmaps? Yes it is this easy. However I can see two things you might need to do. You need an EndPage() call, plus you need to scale it correctly. The size of a screen pixel is not the same as a printer pixel. For a 100x100 screen ellipse, you need to calculate the how big that is needed to be on your printer. Calculate FacX = (w32Func(xGetDeviceCaps(Printer, LOGPIXELSX) / w32Func(xGetDeviceCaps(Screen, LOGPIXELSX) ) Calculate FacY = (w32Func(xGetDeviceCaps(Printer, LOGPIXELSY) / w32Func(xGetDeviceCaps(Screen, LOGPIXELSY) ) To scale, multiply the screen X values by FacX and the Screen Y values by FacY to get the pixel sizes for your printer. Another factor to look out for, if you are using a color printer, is to make sure that the screen color will be still suitable for the page. -- Derek Parnell Melbourne, Australia
5. Re: Printing graphics question
- Posted by don cole <doncole at pacbell.net> Dec 18, 2004
- 441 views
Derek Parnell wrote: > > don cole wrote: > > > > > > }}} <eucode> > > junk=getPrinter() > > if startDoc( "My Print Job" ) then-- start up the document > > end if > > junk=startPage() > > > > drawEllipse(id,False, 10, 10, 100, 100) > > > > if endDoc() then > > releasePrinter() > > end if > > </eurcode> > > > > The above code works fine if id is a window, > > but prints nothing if it is Printer. > > > > Is there an easy of doing this or do I have to make bitmaps? > > Yes it is this easy. However I can see two things you might need to do. > > You need an EndPage() call, plus you need to scale it correctly. The size > of a screen pixel is not the same as a printer pixel. > > For a 100x100 screen ellipse, you need to calculate the how big that is > needed to be on your printer. > > Calculate FacX = (w32Func(xGetDeviceCaps(Printer, LOGPIXELSX) / > w32Func(xGetDeviceCaps(Screen, LOGPIXELSX) ) > > Calculate FacY = (w32Func(xGetDeviceCaps(Printer, LOGPIXELSY) / > w32Func(xGetDeviceCaps(Screen, LOGPIXELSY) ) > > To scale, multiply the screen X values by FacX and the Screen Y values by > FacY to get the pixel sizes for your printer. > > Another factor to look out for, if you are using a color printer, is to > make sure that the screen color will be still suitable for the page. > > -- > Derek Parnell > Melbourne, Australia > I think you meant:
FacX = w32Func( xGetDeviceCaps, {Printer, LOGPIXELSX})/ w32Func(xGetDeviceCaps,{Screen, LOGPIXELSX} ) FacY = w32Func(xGetDeviceCaps,{Printer, LOGPIXELSY}) / w32Func(xGetDeviceCaps,{Screen, LOGPIXELSY} )
How ever if I try: FacX = w32Func( xGetDeviceCaps, {Printer, LOGPIXELSX}) or FacX = w32Func( xGetDeviceCaps,{Screen, LOGPIXELSX})
I get 0 for FacX. Can't divide by 0 error.
The missing EndPage() was the problem.
I would still like to get formula down. Shouldn't it be CWindow_Print_Preview not Screen?
Don Cole SF }}}
6. Re: Printing graphics question
- Posted by Derek Parnell <ddparnell at bigpond.com> Dec 18, 2004
- 438 views
- Last edited Dec 19, 2004
don cole wrote: > I think you meant: Yes, my syntax was wrong. I was coding from the hip Now I've got some time to actually run it before posting, here is what I really meant ...
atom pdc atom sdc pdc = getDC(Printer) sdc = getDC(Screen) FacX = w32Func( xGetDeviceCaps, {pdc, LOGPIXELSX})/ w32Func(xGetDeviceCaps,{sdc, LOGPIXELSX} ) FacY = w32Func(xGetDeviceCaps,{pdc, LOGPIXELSY}) / w32Func(xGetDeviceCaps,{sdc, LOGPIXELSY} ) releaseDC(Screen) releaseDC(Printer)
This code above is to be run *after* you have chosen the printer.
You scale you video pixels thus ...
PrinterX = floor(VideoX * FacX) PrinterY = floor(VideoY * FacY)
The missing EndPage() was the problem.
Oh good. I really should do that automatically when the endDoc() is called.
Shouldn't it be CWindow_Print_Preview not Screen?
It doesn't matter. Both get the device capabilities of the *video* card being used.
Derek Parnell Melbourne, Australia }}}
7. Re: Printing graphics question
- Posted by don cole <doncole at pacbell.net> Dec 19, 2004
- 432 views
Derek Parnell wrote: > > atom pdc > atom sdc > pdc = getDC(Printer) > sdc = getDC(Screen) > FacX = w32Func( xGetDeviceCaps, {pdc, LOGPIXELSX})/ > w32Func(xGetDeviceCaps,{sdc, LOGPIXELSX} ) > > FacY = w32Func(xGetDeviceCaps,{pdc, LOGPIXELSY}) / > w32Func(xGetDeviceCaps,{sdc, LOGPIXELSY} ) Both FacX and FacY work out to 6.25. If this is normal why have 2 factors? > This code above is to be run *after* you have chosen the printer. > I assume you mean junk=getPrinter()? Don Cole SF