How to Retrieve FORM_INFO_2 Structs for a Specific Printer Using Win32 API?
The documentation for EnumForms
indicates that it enumerates each of the forms supported by a printer, but this appears to be misleading since it returns all forms registered on the system. Regardless of the printer used in the EnumForms
call, a fixed number of 173 FORM_INFO_1
or FORM_INFO_2
structs are returned.
When the DeviceCapabilities
function is called for DC_PAPERNAMES
, DC_PAPERSIZE
, or DC_PAPERS
, only the actual paper sizes supported by the printer are provided. However, this still does not yield all the form information, such as margins. Additionally, the names returned by DC_PAPERNAMES
, even with English locales, do not match the names in the FORM_INFO_x
structs. The sizes from DC_PAPERSIZE
do not consistently correspond with those in the FORM_INFO_2
structs, and the FORM_INFO_2
structs do not align with the values returned by DC_PAPERS
.
What is the correct approach to obtain FORM_INFO_2
structs specifically for the paper sizes supported by a particular printer?