Re: How to get page size for PRINTER device? [message #22676] |
Wed, 06 December 2000 00:00 |
Phillip David
Messages: 36 Registered: April 1999
|
Member |
|
|
David Fanning wrote:
>
> Phillip David (phillip_david@xontech.com) writes:
>
>> Now that you know how to get the exact page size (as returned by the
>> printer), can't you just use that to size your printout? You also know
>> how to position it to center it by putting the center of your plot at
>> the center of the page, whose size you now know.
>
> The problem is not *sizing* the printout. The problem
> is *locating* the printout in the middle of the page.
> The only tools you really have to do that are the offsets,
> but the offsets are calculated from the *printable*
> edge of the paper, not from the real edge of the paper
> (as they are, for example, in PostScript output).
> ...
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.
Phillip
|
|
|
Re: How to get page size for PRINTER device? [message #22691 is a reply to message #22676] |
Tue, 05 December 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Phillip David (phillip_david@xontech.com) writes:
> Now that you know how to get the exact page size (as returned by the
> printer), can't you just use that to size your printout? You also know
> how to position it to center it by putting the center of your plot at
> the center of the page, whose size you now know.
The problem is not *sizing* the printout. The problem
is *locating* the printout in the middle of the page.
The only tools you really have to do that are the offsets,
but the offsets are calculated from the *printable*
edge of the paper, not from the real edge of the paper
(as they are, for example, in PostScript output).
Of course, it is possible to know what size your paper
is, get the "page size" from the printer, subtract the
reported page size from the known page size, and then
calculate the fudge factors automatically. This is probably
what I should do. I choose the FUDGE keyword mostly
to call attention to the problem. :-)
I'll leave it as an exercise for the reader (or Liam,
more likely) to write it as it *ought* to be written.
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
|
|
|
Re: How to get page size for PRINTER device? [message #22693 is a reply to message #22691] |
Tue, 05 December 2000 00:00  |
Phillip David
Messages: 36 Registered: April 1999
|
Member |
|
|
David Fanning wrote:
>
> ... it is impossible to center output on the
> printer in a device-independent way.
>
> For example, I like to have graphic output with the same
> aspect ratio as the window on the display, but as large
> as possible, and centered on the page. I use my PSWINDOW
> program to calculate the proper size and offset values
> to position the "window" on the page. But to get the
> graphic exactly in the center of the page, I have to
> use a printer-specific "fudge factor" to account for
> the unprintable area on the page. On my printer, the
> fudge factor is 0.25 inches in both X and Y. So my
> code looks like this:
>
> position = PSWindow(Fudge=0.25, /Printer)
> thisDevice = !D.Name
> Set_Plot, 'PRINTER'
> Device, _Extra=position
> Plot, data, .....
> Device, /Close_Document
> Set_Plot, thisDevice
David;
Now that you know how to get the exact page size (as returned by the
printer), can't you just use that to size your printout? You also know
how to position it to center it by putting the center of your plot at
the center of the page, whose size you now know.
Phillip
|
|
|
Re: How to get page size for PRINTER device? [message #22696 is a reply to message #22691] |
Tue, 05 December 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Phillip David (phillip_david@xontech.com) writes:
> I do seem to recall a discussion a few months ago about printers in
> which someone indicated that they were unable to position something in a
> printer-independent way. If they specified the upper-left corner, they
> got the upper-left corner inside the printable area on the page, and
> couldn't position a plot in the center of the page. I may have the
> details incorrect, but the gist of the message certainly implied that
> the printer object only returns the printable area of the page rather
> than the actual page size.
That's right, it is impossible to center output on the
printer in a device-independent way.
For example, I like to have graphic output with the same
aspect ratio as the window on the display, but as large
as possible, and centered on the page. I use my PSWINDOW
program to calculate the proper size and offset values
to position the "window" on the page. But to get the
graphic exactly in the center of the page, I have to
use a printer-specific "fudge factor" to account for
the unprintable area on the page. On my printer, the
fudge factor is 0.25 inches in both X and Y. So my
code looks like this:
position = PSWindow(Fudge=0.25, /Printer)
thisDevice = !D.Name
Set_Plot, 'PRINTER'
Device, _Extra=position
Plot, data, .....
Device, /Close_Document
Set_Plot, thisDevice
You can find PSWINDOW on my web page:
http://www.dfanning.com/programs/pswindow.pro
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
|
|
|
Re: How to get page size for PRINTER device? [message #22697 is a reply to message #22691] |
Tue, 05 December 2000 00:00  |
Phillip David
Messages: 36 Registered: April 1999
|
Member |
|
|
Liam Gumley wrote:
> 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?
I do seem to recall a discussion a few months ago about printers in
which someone indicated that they were unable to position something in a
printer-independent way. If they specified the upper-left corner, they
got the upper-left corner inside the printable area on the page, and
couldn't position a plot in the center of the page. I may have the
details incorrect, but the gist of the message certainly implied that
the printer object only returns the printable area of the page rather
than the actual page size.
Phillip
|
|
|
Re: How to get page size for PRINTER device? [message #22698 is a reply to message #22691] |
Tue, 05 December 2000 00:00  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Liam Gumley <Liam.Gumley@ssec.wisc.edu> wrote in message
news:90gscj$nfq$1@news.doit.wisc.edu...
>
> Liam Gumley <Liam.Gumley@ssec.wisc.edu> wrote in message
> 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.
According to RSI technical support:
"The printer device can not print on the entire page. There is a small
margin (which varies from printer to printer) on each side of the page. The
GET_PAGE_SIZE keyword returns the full area the printer device is capable of
using.
For example, when your paper size was 8.5 X 11 inches (21.59 X 27.94 cm) the
entire printing area was 8.23 X 10.32 inches (20.9 X 26.2 cm). So your
right/left margin is approximately 0.14 inches and your top/bottom margin is
approximately 0.34 inches."
This may be of interest to anyone trying to configure the PRINTER device for
different page sizes.
Cheers,
Liam.
http://cimss.ssec.wisc.edu/~gumley
|
|
|
|
Re: How to get page size for PRINTER device? [message #22726 is a reply to message #22724] |
Mon, 04 December 2000 00:00  |
Liam E. Gumley
Messages: 378 Registered: January 2000
|
Senior Member |
|
|
Liam Gumley <Liam.Gumley@ssec.wisc.edu> wrote in message
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.
|
|
|