How do I preserve transparency channel when converting PDF to PNG/TIF?

Q: When I generate a PNG image from a PDF that has transparent areas,
the PNG is white where it should be transparent.
A: Assuming that you would like to treat the page as transparent
backdrop instead of a opaque white color, call
PDFDraw.SetPageTransparent(true) before rendering the page. (by
default, PDFNet assumes opaque white color as a page backdrop). For

PDFDoc doc = new PDFDoc("in.pdf");
Page page = doc.GetPage(1);


// To export the image as PNG with transparency:

pdfdraw.Export(page, "my.png");

// or
// System.Drawing.Bitmap bmp = pdfdraw.GetBitmap(page);
// bmp.Save("my.png", System.Drawing.Imaging.ImageFormat.Png);

The following the relevant documentation for

* Sets the page color to transparent.
* @default 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.
* @param is_transparent Set to 'true' if the page's backdrop should
be transparent;
* If is_transparent is false, the page's backdrop will be a opaque
white surface.
* @note If page transparency is enabled, the alpha channel will be
preserved when
* the image is exported as PNG, TIFF, or RAW.
void SetPageTransparent(bool is_transparent)

You can download the latest version of PDFNet SDK from the downloads