Class PdfImageMask
Namespace: Syncfusion.Pdf.Graphics
Assembly: Syncfusion.Pdf.Imaging.NET.dll
Syntax
public class PdfImageMask : PdfMask
Constructors
PdfImageMask(PdfTiffImage)
Initializes a new instance of the PdfImageMask class from the specified PdfBitmap
Declaration
public PdfImageMask(PdfTiffImage imageMask)
Parameters
Type | Name | Description |
---|---|---|
PdfTiffImage | imageMask | The PdfBitmap which represents the image |
Remarks
This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the Tiff image
PdfBitmap image = new PdfBitmap("image.tif");
//Create masking image
PdfImageMask mask = new PdfImageMask(new PdfBitmap("mask.bmp"));
image.Mask = mask;
//Draw the image
graphics.DrawImage(image, 0, 0);
//Saves the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Load the Tiff image
Dim image As New PdfBitmap("image.tif")
'Create masking image
Dim mask As New PdfImageMask(New PdfBitmap("mask.bmp"))
image.Mask = mask
'Draw the image
graphics.DrawImage(image, 0, 0)
'Saves the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
Properties
Mask
Gets the image mask for the bitmap (Read only).
Declaration
public PdfTiffImage Mask { get; }
Property Value
Type | Description |
---|---|
PdfTiffImage | The PdfBitmap represents the image mask. |
Remarks
This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the Tiff image
PdfBitmap image = new PdfBitmap("image.tif");
//Create masking image
PdfImageMask mask = new PdfImageMask(new PdfBitmap("mask.bmp"));
//Get the mask image.
PdfBitmap maskedImage = mask.Mask;
image.Mask = mask;
//Draw the image
graphics.DrawImage(image, 0, 0);
//Saves the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Load the Tiff image
Dim image As New PdfBitmap("image.tif")
'Create masking image
Dim mask As New PdfImageMask(New PdfBitmap("mask.bmp"))
'Get the mask image.
Dim maskedImage As PdfBitmap = mask.Mask
image.Mask = mask
'Draw the image
graphics.DrawImage(image, 0, 0)
'Saves the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)
SoftMask
Gets the mask type for the bitmap (Read only).
Declaration
public bool SoftMask { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
Remarks
This property is not supported in WinRT, Windows Phone, Xamarin, Universal Windows Platform and Silverlight.
Examples
//Create a PDF document
PdfDocument doc = new PdfDocument();
//Add pages to the document
PdfPage page = doc.Pages.Add();
//Create PDF graphics for the page
PdfGraphics graphics = page.Graphics;
//Load the Tiff image
PdfBitmap image = new PdfBitmap("image.tif");
//Create masking image
PdfImageMask mask = new PdfImageMask(new PdfBitmap("mask.bmp"));
//Check soft mask.
bool isSoftMask = mask.SoftMask;
image.Mask = mask;
//Draw the image
graphics.DrawImage(image, 0, 0);
//Saves the document
doc.Save("Output.pdf");
//Close the document
doc.Close(true);
'Create a PDF document
Dim doc As New PdfDocument()
'Add pages to the document
Dim page As PdfPage = doc.Pages.Add()
'Create PDF graphics for the page
Dim graphics As PdfGraphics = page.Graphics
'Load the Tiff image
Dim image As New PdfBitmap("image.tif")
'Create masking image
Dim mask As New PdfImageMask(New PdfBitmap("mask.bmp"))
'Check soft mask.
Dim isSoftMask As Boolean = mask.SoftMask
image.Mask = mask
'Draw the image
graphics.DrawImage(image, 0, 0)
'Saves the document
doc.Save("Output.pdf")
'Close the document
doc.Close(True)