Skip to main content

Image Transparency

Version: 1.0

Image Transparency

Currently, both the PNG and TIFF image formats can be output with transparency. To accomplish this the appropriate ImageFormat needs to be defined with a ColorFormat of type RgbA. This will produce a rasterized image that contains the transparency.

Transparent PNG Example​

PdfRasterizer rasterizer = new PdfRasterizer("C:\\DocumentA.pdf");
PngImageFormat png = new PngImageFormat(PngColorFormat.RgbA);
rasterizer.Draw("C:\\DocumentA_Transparent_Page.png", png, ImageSize.Dpi72);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer("C:\DocumentA.pdf
Dim MyPng As PngImageFormat = New PngImageFormat(PngColorFormat.RgbA)
MyRasterizer.Draw("C:\Temp\Document_Transparent_Page.png", MyPng, ImageSize.Dpi72)

Transparent TIFF Example​

PdfRasterizer rasterizer = new PdfRasterizer("C:\\DocumentA.pdf");
TiffImageFormat tiff = new TiffImageFormat(TiffColorFormat.RgbA, TiffCompression.Lzw);
rasterizer.Draw("C:\\DocumentA_Transparent_Page.tif", tiff, ImageSize.Dpi150);
Dim MyRasterizer As PdfRasterizer = New PdfRasterizer("C:\DocumentA.pdf")
Dim MyTiff As TiffImageFormat = New TiffImageFormat(TiffColorFormat.RgbA, TiffCompression.Lzw)
MyRasterizer.Draw("C:\Temp\DocumentA_Transparent\_Page.tif", MyTiff, ImageSize.Dpi150)