|
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("RenderingSaveAlpha.png");

RenderingSaveAlpha.png
Also see example code in: Page
GetBitmap Function.
|