PDFToImage / PDFImageWriter seem to work very well for converting
mainly text pdf documents to an image.

However, my goal is to convert mainly text pdf documents into a png with
multiple levels of alpha transparency and to retain the transparent
background in the original PDF.

It looks like the only thing preventing this is:

  graphics.setBackground( Color.WHITE );

Inside PDPage convertToImage(int, int);

I can get the desired result with:

  graphics.setBackground( new Color( 0, 0, 0, 0 ) );

Questions:

1. Should the pdfbox default to a transparent background, at least if
   the chosen color mode is rgba? I'd rather not have to maintain a
   patch on the source!

2. Is there a better way to accomplish this? I'm not sure if just
   settign the background to transparent is the right thing to do in
   all cases, but it does acheive the desired result whent the pdf is
   just text (including antialiased parts with more than one bit of
   alpha).

Thank you!
Armando

Reply via email to