ADC Home > Reference Library > Technical Q&As > Legacy Documents > Printing >
Important: This document is part of the Legacy section of the ADC Reference Library. This information should not be used for new development.
Current information on this Reference Library topic can be found here:
|
Q: I want my application to do its own scaling during printing,
so the information that I put around the outside of the page is at a 1:1 ratio. I also
need to retrieve the scaling factor from the A: When using classic QuickDraw (not QuickDraw GX), the process you describe is not supported. Since the original API was developed when there were only two printers available for the Macintosh, driver developers needed to find a way to store the settings they needed in the print record. Since Apple did not provide an API for this, a multitude of unapproved techniques were used to insert various settings into the print record. As a result, each driver stores information in the print record in a different place. You can't get the information you need from the edit-text item of the driver - in fact, you should never assume an edit-text item in a dialog is the scaling field, since you have no way of knowing what the field contains. Don't assume anything about the items or the order of the dialog boxes, because printer-driver developers are free to do whatever they want, and many of them have. The ImageWriter, for example, only allows a 50-percent reduction, so it has a checkbox instead of a numerical field. In some drivers, options like this may even be in the job dialog for "user convenience." Drivers can and do store scaling values, if they support them, anywhere at all
in the print record. You can't compare the page rectangle to that returned by
There is no API in classic QuickDraw printing to allow you to set the scaling, although QuickDraw GX does support this. For more information about the way you can do this in QuickDraw GX, see Inside Macintosh: QuickDraw GX Printing. There is one way you can circumvent this shortcoming in classic QuickDraw, at
least partially: You can store a print record in your application resource fork
and use it when you print, but bear in mind that this may not work for other
versions of the same driver (if the driver's developer chooses to store the
scaling information elsewhere in the print record). Thus, you can store a
print record in your application that you can validate by calling Of course, you need to find the place in the print record where the scaling is
stored (one way to do this is with an application called You need to save the resources in such a way that you can find them based on
the high byte of the print record's You now have a print record stored with the scaling set to 100 percent for
every driver. You cannot change the print handle between There are some drawbacks to this approach that you need to be aware of. First,
this method doesn't work if a driver is released that has a Another drawback is that the user won't be able to choose settings such as landscape-mode printing. Only the settings that are active when you save your print handles can be used, and this may frustrate users. If you decide to use this method, don't save your print handles as ' When you encounter a new device, you can force the print-style dialog to come
up, ask the user to select landscape, and save a print record for the device.
This is a bit clumsy, but it works, and you're able to use |
|