1

I have the problem of converting PDFs that may contain images which use transparency. In those documents, after conversion, the images will show black in place of the transparent areas. The target of the conversion is not to have transparent areas, but rather the actual page color - usually white.

As I'm using the GhostscriptRasterizer to allow conversion directly into an Image object and subsequent in-memory encoding to either JPEG or PNG, I can't use the recommended workaround of using GhostscriptPngDevice, or at least I'd rather not use that method and write temporary PNGs just for some on-demand PDF conversion.

I already played around in the GhostScript.NET source, trying different ways to inject a BackgroundColor or influencing the value of MaxBitmap, to no avail. Although the default BackgroundColor is already white, and Ghostscript.NET already configures MaxBitmap to 1g by itself.

Right now I'm working around the problem by opening offending documents in Acrobat, and applying the "Fix transparency" Inflight option to flatten any transparent objects inside the PDF, although I do want a more permanent solution that wouldn't require manual intervention.

If anyone has ideas, I'd be glad to hear them.

Alexander Gräf
  • 511
  • 1
  • 3
  • 10

0 Answers0