Reputation: 13887
Does the postscript programming language include a command that will place the dimensions of the paper on to the stack? This would allow postscript programs that handle arbitrary paper dimensions and gracefully adapt to the paper they are printing on.
If such a command does exist, is it likely to actually work effectively?
Upvotes: 1
Views: 901
Reputation: 605
Question about "the paper they are printing on"
Printers normally can print on a variety of paper sizes and even on envelopes. The user typically tells the postscript printer driver what size to print and then loads the printer with that size. The postscript can find that paper size by testing the currentpagedevice dictionary after that is set by the driver:
currentpagedevice /PageSize get
That leaves the paper size on the stack as an array so for letter size the stack has this:
[612 792]
You could write your postscript to scale the output to the PageSize found, for example, if the printer driver reliably tells the printer the size of the paper you select. This scaling might be done automatically by the driver when set to "fit to page".
Just decide the size of paper you want to print before beginning to write the program. Postscript files are not normally distributed to the public so writing for a variety of paper sizes sounds very hypothetical.
Upvotes: 3