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

Re: How to get page size for PRINTER device?




Liam Gumley <Liam.Gumley@ssec.wisc.edu> wrote in message
90gni1$e5a$1@news.doit.wisc.edu">news:90gni1$e5a$1@news.doit.wisc.edu...
> According to the IDL 5.4 documentation:
>
> "The DIALOG_PRINTERSETUP function opens a native dialog for setting the
> applicable properties for a particular printer."
>
> Let's say I've selected the PRINTER graphics device, and I've called
> DIALOG_PRINTERSETUP to change the paper size from Letter to A4, e.g.
>
> IDL> set_plot, 'PRINTER'
> IDL> result = dialog_printersetup()
>
> Is there any way to return the new page size to an IDL application? I'm
> talking about the actual width and height of the paper (i.e. 21.0 x 29.7
cm
> for A4), not the dimensions of the drawable area on the page (17.78 x 12.7
> cm by default).
> Even if one uses a printer object, I don't see how the paper size can be
> obtained.

Well apparently you can get the page size from the PRINTER device. But the
results are not what I expected. The following example shows the result of a
test I did in IDL 5.4 for Windows. The default printer is an Epson Stylus
Color 600.

IDL Version 5.4 (Win32 x86). (c) 2000, Research Systems, Inc.

The default PRINTER device settings:

IDL> set_plot, 'PRINTER'
IDL> help, /device
Available Graphics Devices: CGM HP METAFILE NULL PCL PRINTER PS WIN Z
Current graphics device: PRINTER
    Printer : EPSON Stylus COLOR 600
    Orientation: Portrait
    Scale Factor: 1
    Resolution: 361 dots per inch
    Current Font: Courier New, Current TrueType Font: <default>
    Size (X,Y): (17.78,12.7) cm., (7,5) in.
    Offset (X,Y): (1.905,12.7) cm., (0.75,5) in.
IDL> device, get_page_size=page_size    ; This command gets the page size
IDL> print, page_size[0] / !d.x_px_cm, page_size[1] / !d.y_px_cm
      20.9000      26.2000

Now I call the printer configuration dialog, and select 'Letter 8.5 x 11'
explicitly:

IDL> result = dialog_printersetup()
IDL> device, get_page_size=page_size
IDL> print, page_size[0] / !d.x_px_cm, page_size[1] / !d.y_px_cm
      20.9000      26.2000

8.5 x 11 in. converts to 21.59 x 27.94 cm. Hmmm.

For the next case, I selected 'Legal 8.5 x 14':

IDL> result = dialog_printersetup()
IDL> device, get_page_size=page_size
IDL> print, page_size[0] / !d.x_px_cm, page_size[1] / !d.y_px_cm
      20.9000      33.8000

8.5 x 14 in. converts to 21.59 x 35.56 cm. Curiouser.

For the final case, I selected 'A4 210 x 297 mm':

IDL> result = dialog_printersetup()
IDL> device, get_page_size=page_size
IDL> print, page_size[0] / !d.x_px_cm, page_size[1] / !d.y_px_cm
      20.4000      28.0000

Once again, the page size returned differs from the actual page size.
Perhaps the returned value is a printer-dependent 'printable area' of the
page.

Any comments?

Cheers,
Liam.