Image Transparency
Both PNG and TIFF image formats support transparency. To accomplish adding transparency to an image, define the appropriate ImageFormat with a ColorFormat of type RGBA. This produces a rasterized image that contains transparency.
Transparent PNG Example
The following example illustrates adding transparency to a PNG.
PdfRasterizer rasterizer = new PdfRasterizer(pdfFilePath);
PngImageFormat png = new PngImageFormat(PngColorFormat.RgbA);
rasterizer.Draw(pngFilePath, png, ImageSize.Dpi72);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer(pdfFilePath)
Dim MyPng As PngImageFormat = New PngImageFormat(PngColorFormat.RgbA)
MyRasterizer.Draw(pngFilePath, MyPng, ImageSize.Dpi72)
Transparent TIFF Example
The following example illustrates adding transparency to a TIFF.
PdfRasterizer rasterizer = new PdfRasterizer(pdfFilePath);
TiffImageFormat tiff = new TiffImageFormat(TiffColorFormat.RgbA);
rasterizer.Draw(tifFilePath.tif", tiff, ImageSize.Dpi150);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer(pdfFilePath)
Dim MyTiff As TiffImageFormat = New TiffImageFormat(TiffColorFormat.RgbA)
MyRasterizer.Draw(tifFilePath.tif, MyTiff, ImageSize.Dpi150)