WIN32 C Printing API (Setting printer properties)
I'm having difficulties setting some of the printing properties, in particular custom paper sizes, using DocumentProperties() from a C application (WIN32 API). For example, the driver indicates support for forms (i.e. sets the DM_FORMNAME bit in the dmFields member of the DEVMODE structure), but setting a form appears to have no effect, at least in the drivers I've tested. I'm using the procedure described in the DocumentProperties documentation ( http://msdn.microsoft.com/en-us/library/dd183576%28v=vs.85%29.aspx ), which works fine for DM_ORIENTATION, DM_DUPLEX, and DM_PAPERSIZE. But I haven't had much success with custom paper sizes. It seems like the DM_PAPERLENGTH and DM_PAPERWIDTH settings would be straightforward, but no printer driver I've tested so far indicates support for them, except for some PDF writers. So I tried the DM_FORMNAME approach, but even though the drivers I've tested do indicate support for it, requesting a form name by setting dmFormName to one of the available values (confirmed using EnumForms()) has no effect. The DocumentProperties() function does not return any error, but the subsequent GetDeviceCaps() returns whatever paper size was the default for the printer. Since forms appear to be handled by the common print server logic, rather than by the printer driver, it would seem that the behavior would be fairly standard between drivers, and thus it seems unlikely that my problem is specific to the drivers I've tested with. But I've been unable to find any examples of setting a custom paper size via this method. Note that I'm not trying to define the form from the application, merely select it. (If the user requires a custom form size, they can define it in the print server standard dialogs; my intent is to provide the user a way to specify the official/standard papersize or the name of the custom form, and my application will merely select it.) Any suggestions would be appreciated! p.s. I'm not sure this is the best place to post such a question, but was directed here by the 'which forum' forum.
March 8th, 2011 12:18am

p.s. I'm not sure this is the best place to post such a question, but was directed here by the 'which forum' forum. as programming question in the MSDN Forums: http://social.msdn.microsoft.com/Forums/en-us/categories"A programmer is just a tool which converts caffeine into code" Want to install RSAT on Windows 7 Sp1? Check my HowTo: http://www.msfn.org/board/index.php?showtopic=150221
Free Windows Admin Tool Kit Click here and download it now
March 8th, 2011 10:04am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics