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;
using var 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"));
' Add some text
Dim doc As 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
Dim alphaBitmap As Bitmap = 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"))