Type Default Value Read Only Description

[Visual Basic]
false No Whether to save the alpha channel into the output.




This property determines whether the Save method includes an alpha channel in the rendered output.

Only some types of output support alpha. These are:

  • PNG
  • BMP
  • TIFF (Grayscale, RGB and CMYK only)
  • PSD (Photoshop)
  • Bitmap (via the GetBitmap function)

By including an alpha channel in your output you can identify areas which are transparent and areas on which no drawing has taken place.




The following example shows the effect that this parameter has on PDF rendering. We create a PDF with some text on it. We then render the PDF with an alpha channel and add the transparent image into a new PDF with a blue background. The blue background shows through where the image is transparent.


// Add some text Doc doc = new Doc(); doc.FontSize = 196; doc.TextStyle.HPos = 0.5; doc.TextStyle.VPos = 0.3; doc.AddText("Hello World"); // Render the PDF with alpha doc.Rendering.SaveAlpha = true; Bitmap alphaBitmap = doc.Rendering.GetBitmap(); // Create a blue PDF doc = new Doc(); doc.Color.String = "0 0 255"; doc.FillRect(); // Add the transparent Bitmap into the PDF // so that the underlying blue can show through doc.AddImageBitmap(alphaBitmap, true); // Save render of pdf doc.Rendering.Save(Server.MapPath("RenderingSaveAlpha.png"));