How do I convert PDF to PNG with transparency using PDFDraw.ExportAsPng?

103 views
Skip to first unread message

Support

unread,
Jan 4, 2011, 5:37:28 PM1/4/11
to PDFTron PDFNet SDK
Q: I was trying to export images from a PDF using ExportAsPng, and I
noticed that images that were partially transparent where being
exported with white as the background instead of transparent. Is there
a way to export them so that the transparency is correct?

------------------------------
A: If you are using ‘pdftron.PDF.PDFDraw’ to convert PDF to PNG you
can use pdfdraw.SetPageTransparent(true) to set the backdrop color of
the page to transparent. You can achieve the same effect with
PDF2Image using '--transparent_page' command-line switch.

By default, PDFDraw assumes that the page is imposed directly on an
opaque white surface. Some applications may need to impose the page on
a different backdrop. In this case any pixels that are not covered
during rendering will be transparent.
Reply all
Reply to author
Forward
0 new messages