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 );