Delphi: I am not able to change the margins ...

This is a read only forum. It contains the most frequently asked questions about Amyuni products and licensing.
Post Reply
Dany
Amyuni Team
Posts: 113
Joined: Wed Sep 11 2002
Location: Montreal.
Contact:

Delphi: I am not able to change the margins ...

Post by Dany »

of the pdf file pragmatically form inside my Delphi application.

Under Delphi, this will work or not depending on when you are modifying the margins and calling SetDefaultConfig.
Delphi stores the default printer settings in an internal structure called DEVMODE. Even if we change the settings using CDINTF, Delphi might not take these into account.

Try to change the DEVMODE structure from within Delphi. You can get our Technical Note 2 – TN02 about the DEVMODE structure from http://www.amyuni.com/en/support/technotes.html and change the margins by calling the equivalent of:

LPDWORD lpdwMargins = (LPDWORD)((LPBYTE)m_lpDevMode + m_lpDevMode-dmSize + sizeof( DWORD ));

// horizontal margin
*lpdwMargins = MAKELONG( nNewValue, HIWORD( *lpdwMargins ) );

// Vertical margin
*lpdwMargins = MAKELONG( LOWORD( *lpdwMargins ), nNewValue );
Post Reply