SetPaperLength

#include “BlackIceDEVMODE.h”

 

BOOL            SetPaperLength(int paperlength, BlackIceDEVMODE* pDevMode);

Description

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

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

SetPaperSize(256, pDevMode);

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

SetPaperLength((int)(HeightInPixels * 254.0 / (float)GetYDPI(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.

Parameters

int paperlength                                             - Actual paper length (integer number).

BlackIceDEVMODE* pDevMode               - pointer to the BlackIceDEVMODE structure.

Return value

TRUE if the member was successfully set, otherwise FALSE.

Programming Notes

None

Code Example

None