Method CreateImage
- Namespace
- BitMiracle.Docotic.Pdf.Gdi
- Assembly
- BitMiracle.Docotic.Pdf.Gdi.dll
CreateImage(PdfDocument, Image)
public static PdfImage CreateImage(this PdfDocument doc, Image image)
Parameters
doc
PdfDocumentThe document
image
ImageThe image to create PDF image from.
Returns
Remarks
This method creates images from data in JPEG, BMP, GIF, PNG, and TIFF formats.
If the data contains an image with multiple frames (pages), like multi-page TIFF or GIF, the method creates a PdfImage object for the first frame only.
Use one of the PdfDocument.OpenImage methods to load more than one page of a multipage image. You can further process the frames created by the PdfDocument.OpenImage methods before creating PdfImage objects from them.
The Images section describes ways to add images to PDF documents.
You can make certain pixels of the created image transparent. Use the MakeTransparent(PdfColor) method to specify the color of pixels you would like transparent. To set a stencil or a soft mask for the image, use the Mask property.
Check out the sample code for the transparent pixels approach. There is another sample code that shows how to apply image masks.
Exceptions
- UnsupportedImageException
The library can not create a PDF image from the specified Image.
- ArgumentNullException
image
isnull
.