[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get page size for PRINTER device?



Phillip David (phillip_david@xontech.com) writes:

> So let me see if I understand correctly.  Are you saying that the
> printable edges of the paper differ between the left and right sides? 
> Or perhaps between the top and bottom?  If not, why not just calculate
> things to center them on the PRINTABLE page?  Wouldn't that also center
> them on the physical page?
> 
> Or perhaps I'm just not getting it.

Oh, I hate these public arguments that expose
my ignorance. :-(

Yes, I think you are right. Here is a program that
will center a square plot on the printer page:

  PRO center_plot
  xsize = 10
  ysize = 10
  thisDevice = !D.Name
  Set_Plot, 'Printer'
  Device, Get_Page_Size=pseudoPageSize
  xprintArea = pseudoPageSize[0] / !D.X_PX_CM
  yprintArea = pseudoPageSize[1] / !D.Y_PX_CM
  xoff = (xprintArea - xsize) / 2.0
  yoff = (yprintArea - ysize) / 2.0
  Device, XSize=xsize, YSize=ysize, XOffset=xoff, YOffset=yoff
  PlotS, [0,1,1,0, 0], [0, 0, 1, 1,0], /Normal
  Device, /Close_Document
  Set_Plot, thisDevice
  END

Sheesh. Back to the programming grind...

Cheers,

David

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155