Re: Printing graphics question

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 }}}

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu