So my concept is to use the luaprinter class to provide a way to save the bitmap from a driver that doesn't really need the lua parts, just the printing parts. The lua stuff is there, but the driver doesn't need to use them.
So we can inheirit from luaprinter:
class epson_lx810l_device :
public device_t,
public device_centronics_peripheral_interface,
public luaprinter
{
...
epson_lx810l_device::epson_lx810l_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) :
device_t(mconfig, type, tag, owner, clock),
device_centronics_peripheral_interface(mconfig, *this),
luaprinter(*this, 810),
...
and then we can do some things in the device_start:
void epson_lx810l_device::device_start()
{
m_online_led.resolve();
m_cr_timer = timer_alloc(TIMER_CR);
m_screen->register_screen_bitmap(m_bitmap);
m_bitmap.fill(0xffffff); /* Start with a clean white piece of paper */
// do the luaprinter stuff, I would like to do more in the constructor, but it seems to cause problems.
register_bitmap(m_bitmap); // register with luaprinter
luaprinterlist.emplace_back(static_cast<luaprinter *>(this));
setprintername(sessiontime()+std::string(" ")+tagname());
and then you can save the bitmap with:
MAME]> print(manager:machine().lp[3]:pageheight())
576
[MAME]> print(manager:machine().lp[3]:pagewidth())
1024
[MAME]> manager:machine().lp[3]:savepage()
[MAME]> print(manager:machine().lp[3]:getprintername())
2020-09-16 13-53-53 apple2p-sl4-parallel-pic_ctx-ap2000
[MAME]>
So here's the page saved out: