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.
[C#]
Doc theDoc = new Doc();
// Add some text
theDoc.FontSize = 196;
theDoc.TextStyle.HPos = 0.5;
theDoc.TextStyle.VPos = 0.3;
theDoc.AddText("Hello World");
// Render the PDF with alpha
theDoc.Rendering.SaveAlpha = true;
Bitmap alphaBitmap = theDoc.Rendering.GetBitmap();
// Create a blue PDF
theDoc = new Doc();
theDoc.Color.String = "0 0 255";
theDoc.FillRect();
// Add the transparent Bitmap into the PDF
// so that the underlying blue can show through
theDoc.AddImageBitmap(alphaBitmap, true);
// Save render of pdf
theDoc.Rendering.Save(Server.MapPath("RenderingSaveAlpha.png"));
theDoc.Clear();
[Visual Basic]
Dim theDoc As Doc = New Doc()
' Add some text
theDoc.FontSize = 196
theDoc.TextStyle.HPos = 0.5
theDoc.TextStyle.VPos = 0.3
theDoc.AddText("Hello World")
' Render the PDF with alpha
theDoc.Rendering.SaveAlpha = True
Dim alphaBitmap As Bitmap = theDoc.Rendering.GetBitmap()
' Create a blue PDF
theDoc = New Doc
theDoc.Color.String = "0 0 255"
theDoc.FillRect()
' Add the transparent Bitmap into the PDF
' so that the underlying blue can show through
theDoc.AddImageBitmap(alphaBitmap, True)
' Save render of pdf
theDoc.Rendering.Save(Server.MapPath("RenderingSaveAlpha.png"))
theDoc.Clear()
RenderingSaveAlpha.png
|