Printing an External Area with Win-64 bits fails

Printing an external area through a 4D-layout is done with the three events

- 	eAE_TestPrintSize					= 27,
- 	eAE_GetPrintSize					= 28,
-	eAE_PrintBand						= 29,

This has worked with 4D-Win-32-Bit and 4D-Mac-32-Bit through the last 10 years and more and is working now with 4D v17.2. Also printing works correctly for the current Mac-64-Bit version of 4D (17.1 & 17.2 and 17Rx), but not for the Win-64-Bit version of 4D-17.0 - 17.2.


If you are printing a 4D-layout with an external area, the external area gets called with the “eAE_TestPrintSize”-Event. If the area wants to do printing, it returns the message “ZoneVariableFrame” (=104) in the fMessage-field of the given “PA_Event”-record. 4D then calls the area with one ore more calls of “eAE_GetPrintSize”- and “eAE_PrintBand”-events for doing the real printing-work.

The 4D-Mac-32-bit, 4D-Mac-64-Bit and the 4D-Win-32-Bit versions work exactly as described above.
But with the 4D-Win-64-Bit-Version, after you get the “eAE_TestPrintSize”-Event and returning the value “ZoneVariableFrame” (=104) in the fMessage-field of the given “PA_Event”-record, nothing happens… you never get a call with an event of “eAE_GetPrintSize” and “eAE_PrintBand”…

What’s going on?

Tested versions:

Mac: 4D 17.0-32-bit, 4D 17.1-32-bit, 4D 17.2-32-bit -> all works fine
Mac: 4D 17.0-64-bit, 4D 17.1-64-bit, 4D 17.2-64-bit -> all works fine
Win: 4D 17.0-32-bit, 4D 17.1-32-bit, 4D 17.2-32-bit -> all works fine

Win: 4D 17.0-64-bit, 4D 17.1-64-bit, 4D 17.2-64-bit -> nothing works !!!


4D Windows 64 bits use D2D for printing, your plugin use GDI.
In order to print an external area on windows, you have to switch 4D print layer to GDI mode.

SET PRINT OPTION (Legacy printing layer option;0)


Hi Patrick,

your answer has worked nearly perfect!!

Thanks a lot


Here is more information about Legacy printing layer option.

  • This setting is global.
  • This setting cannot be changed during a print job, always test ok variable, to check if the settings was changed or not.
  • There may be text-level rendering differences between D2D and GDI


But why does the D2D-mode does NOT support printing with external areas?

Because there is no bridge between Direct2D and GDI in printing mode.

And can I print using D2D with the HDC provided by 4D? I didn’t test it, yet…

No, it’s not possible.

D2D and GDI are not interoperable in a printing context

At this time, the only solution is to use Set Print Option, to switch in gdi mode.

Will there be API to get D2D context? Like ability to get HDC in 4D v14.4+…


It’s in the backlog, but i can’t tell you when it will be available