SetPaperWidth 

Sets the dmPaperWidth member of the DevMode. (DM.dmPaperWidth member of the BlackIceDEVMODE ) This value represents the 'Actual paper width'.

 

Before using this function, enable custom paper sizes, by calling the SetPaperSize function with the 256 (DMPAPER_CUSTOM) value:

 

SetPaperSize(256, pDevMode);

 

The SetPaperWidth function expects the value in tenths of millimeters. To specify a value in pixels, use the GetXDPI function and the following formula:

 

SetPaperWidth((int)(WidthInPixels * 254.0 / (float)GetXDPI(pDevMode)), pDevMode);

 

The 256 (DMPAPER_CUSTOM) paper size is intended for custom printing applications. Regular applications may not handle this paper size correctly. To add a named paper size to the paper list of the printer that is handled correctly by all applications, use the AddPaperSize function. After changing the paper list or the selected paper size, most applications have to be restarted for the changes to take effect.

 

SetPaperWidth (PaperWidth As Long, pBlackIceDEVMODE As Long) As Boolean

 

Input value   - value of the new paper width

Input value   - handle to the BlackIceDEVMODE.

Return value            - TRUE on success, otherwise FALSE.

 

NOTE: For 32-bit applications , use pBlackIceDEVMODE as Integer, instead of Long.