Right, dug in to the Ghostscript ImageWriter driver code today (contrib/gdevadmp.c) to figure out the blank page thing properly, and it turns out it's not really transparency's fault at all, that just happens to be what tips it over.
The actual problem is their band/clist handling is just totally broken. The interleaved row reads are fine while Ghostscript has the whole page sitting in memory, but it'll quietly switch to rendering in strips once the bitmap goes over MaxBitmap, and in that mode you're meant to work top to bottom and never seek backwards. This one does neither - it seeks back for the odd rows and it never tells Ghostscript to keep the page in memory - so as soon as strip mode kicks in it gets handed rows it didn't ask for and just bails
Transparency is just the easiest way to set it off because the pdf14 buffer counts against MaxBitmap and that on its own is enough to push a bog standard Letter page over. Minimal PDF with nothing in it but a /ca 0.5 and a rectangle gives me 1103 bytes out with not one byte of actual graphics data in it, and the
exact same file with -dMaxBitmap=200000000 gives 25731 bytes and prints perfectly. Same on iwhic.
Which makes me think this bit in their header comment is describing exactly this:
- Rarely, some input files produce blank output unexpectedly. I only ever
saw it once in the course of many varied test prints, so probably an
issue with the input file, rather than the driver.
Also found a second one while I was poking about - the end of page check at line 756 is (lnum + ltmp) > pdev->height when rows are numbered 0..height-1, so any page height that doesn't come out as a whole number of bands ends up asking for a row past the end and kills the job (works out as needing the height to be a multiple of 8pt, which is why Letter and Legal have always been fine and A4 never has). That one happens either way though, forcing it in memory doesn't help there.
Have you ever contributed anything to that driver
@NJRoadfan? Kinda curious how open they are to taking fixes, or whether I'm better off just carrying the workaround on our side.