Picture Class
Represents a picture.
- Inheritance:
- System.ObjectPicture
Remarks
Picture is a Shape that enables inserting a bitmap, which consists of the pixel data for a graphics image and its attributes, within a document content.
PictureStream and Format properties define a Picture and are mandatory in a Picture constructors, directly or indirectly.
Picture can be clipped to a specific shape. Clipping shape type is represented by ShapeType enumeration. It can be set only through Picture(DocumentModel, Stream, PictureFormat, Layout, ShapeType) constructor and retrieved from ShapeType property.
Picture can be filled with a Brush (which will be visible if picture has transparent pixel data) and outlined with a Pen.
Picture can be positioned in-line with the rest of the document content or floating within document content. For more information about picture positioning, see remarks for Layout property.
For more information, see pictures example.
Constructors
Picture(DocumentModel, Stream)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, Stream pictureStream)
Public Sub New(document As DocumentModel, pictureStream As Stream)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
Stream that contains the image.
Remarks
This constructor decodes image data (for getting PictureFormat and calculating width and height in points). This approach slightly impairs performance (decoding an image requires around 20-50ms for larger images) so, if performance is crucial or you need to insert a lot of images, use constructors that accept PictureFormat argument.
Picture(DocumentModel, Stream, Layout, ShapeType)
Initializes a new instance of the Picture class with specified layout (position and size), clipping geometry and picture's pixel data stream.
public Picture(DocumentModel document, Stream pictureStream, Layout layout, ShapeType shapeType)
Public Sub New(document As DocumentModel, pictureStream As Stream, layout As Layout, shapeType As ShapeType)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
The picture pixel data stream.
layout
- Layout
The picture layout (position and size).
shapeType
- ShapeType
The picture's shape type into which picture will be clipped.
Picture(DocumentModel, Stream, PictureFormat, Layout)
Initializes a new instance of the Picture class with specified layout (position and size) and picture's pixel data stream and format.
public Picture(DocumentModel document, Stream pictureStream, PictureFormat format, Layout layout)
Public Sub New(document As DocumentModel, pictureStream As Stream, format As PictureFormat, layout As Layout)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
The picture pixel data stream.
format
- PictureFormat
The picture stream format.
layout
- Layout
The picture layout (position and size).
Picture(DocumentModel, Stream, PictureFormat, Layout, ShapeType)
Initializes a new instance of the Picture class with specified layout (position and size), clipping geometry and picture's pixel data stream and format.
public Picture(DocumentModel document, Stream pictureStream, PictureFormat format, Layout layout, ShapeType shapeType)
Public Sub New(document As DocumentModel, pictureStream As Stream, format As PictureFormat, layout As Layout, shapeType As ShapeType)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
The picture pixel data stream.
format
- PictureFormat
The picture stream format.
layout
- Layout
The picture layout (position and size).
shapeType
- ShapeType
The picture's shape type into which picture will be clipped.
Picture(DocumentModel, Stream, PictureFormat, Double, Double)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, Stream pictureStream, PictureFormat format, double width, double height)
Public Sub New(document As DocumentModel, pictureStream As Stream, format As PictureFormat, width As Double, height As Double)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
Stream that contains the image.
format
- PictureFormat
The image file format.
width
- System.Double
The picture width (in points).
height
- System.Double
The picture height (in points).
Picture(DocumentModel, Stream, PictureFormat, Double, Double, LengthUnit)
Initializes a new instance of the Picture class positioned in-line with specified picture's pixel data stream and format and picture's size.
public Picture(DocumentModel document, Stream pictureStream, PictureFormat format, double width, double height, LengthUnit unit)
Public Sub New(document As DocumentModel, pictureStream As Stream, format As PictureFormat, width As Double, height As Double, unit As LengthUnit)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
The picture pixel data stream.
format
- PictureFormat
The picture stream format.
width
- System.Double
The picture width in units specified by unit
parameter.
height
- System.Double
The picture height in units specified by unit
parameter.
unit
- LengthUnit
The measurement unit for width
and height
.
Picture(DocumentModel, Stream, Double, Double)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, Stream pictureStream, double width, double height)
Public Sub New(document As DocumentModel, pictureStream As Stream, width As Double, height As Double)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
Stream that contains the image.
width
- System.Double
The picture width (in points).
height
- System.Double
The picture height (in points).
Picture(DocumentModel, Stream, Double, Double, LengthUnit)
Initializes a new instance of the Picture class positioned in-line with specified picture's pixel data stream and picture's size.
public Picture(DocumentModel document, Stream pictureStream, double width, double height, LengthUnit unit)
Public Sub New(document As DocumentModel, pictureStream As Stream, width As Double, height As Double, unit As LengthUnit)
Parameters
document
- DocumentModel
The owner document.
pictureStream
- System.IO.Stream
The picture pixel data stream.
width
- System.Double
The picture width in units specified by unit
parameter.
height
- System.Double
The picture height in units specified by unit
parameter.
unit
- LengthUnit
The measurement unit for width
and height
.
Picture(DocumentModel, String)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, string picturePath)
Public Sub New(document As DocumentModel, picturePath As String)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
Remarks
This constructor decodes image data (for getting PictureFormat and calculating width and height in points). This approach slightly impairs performance (decoding an image requires around 20-50ms for larger images) so, if performance is crucial or you need to insert a lot of images, use constructors that accept PictureFormat argument.
Picture(DocumentModel, String, PictureFormat, Double, Double, LengthUnit, Boolean)
Initializes a new instance of the Picture class linked to the external image.
public Picture(DocumentModel document, string picturePath, PictureFormat format, double width, double height, LengthUnit unit, bool isLink)
Public Sub New(document As DocumentModel, picturePath As String, format As PictureFormat, width As Double, height As Double, unit As LengthUnit, isLink As Boolean)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
format
- PictureFormat
The picture format.
width
- System.Double
The picture width in units specified by unit
parameter.
height
- System.Double
The picture height in units specified by unit
parameter.
unit
- LengthUnit
The measurement unit for width
and height
.
isLink
- System.Boolean
If set to true picture won't be embedded in the document, instead picturePath
will be a link to the external picture.
Remarks
If isLink
is true, this constructor results in a Picture element in which image data is lazily loaded on PictureStream getter.
Picture(DocumentModel, String, PictureFormat, Double, Double, Boolean)
Initializes a new instance of the Picture class linked to the external image.
public Picture(DocumentModel document, string picturePath, PictureFormat format, double width, double height, bool isLink)
Public Sub New(document As DocumentModel, picturePath As String, format As PictureFormat, width As Double, height As Double, isLink As Boolean)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
format
- PictureFormat
The picture format.
width
- System.Double
The picture width (in points).
height
- System.Double
The picture height (in points).
isLink
- System.Boolean
If set to true picture won't be embedded in the document, instead picturePath
will be a link to the external picture.
Remarks
If isLink
is true, this constructor results in a Picture element in which image data is lazily loaded on PictureStream getter.
Picture(DocumentModel, String, Boolean)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, string picturePath, bool isLink)
Public Sub New(document As DocumentModel, picturePath As String, isLink As Boolean)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
isLink
- System.Boolean
If set to true picture won't be embedded in the document, instead picturePath
will be a link to the external picture.
Remarks
This constructor decodes image data (for getting PictureFormat and calculating width and height in points). This approach slightly impairs performance (decoding an image requires around 20-50ms for larger images) so, if performance is crucial or you need to insert a lot of images, use constructors that accept PictureFormat argument.
Picture(DocumentModel, String, Double, Double)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, string picturePath, double width, double height)
Public Sub New(document As DocumentModel, picturePath As String, width As Double, height As Double)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
width
- System.Double
The picture width (in points).
height
- System.Double
The picture height (in points).
Picture(DocumentModel, String, Double, Double, LengthUnit)
Initializes a new instance of the Picture class positioned in-line with specified picture's pixel data file path and picture's size.
public Picture(DocumentModel document, string picturePath, double width, double height, LengthUnit unit)
Public Sub New(document As DocumentModel, picturePath As String, width As Double, height As Double, unit As LengthUnit)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The picture pixel data file path.
width
- System.Double
The picture width in units specified by unit
parameter.
height
- System.Double
The picture height in units specified by unit
parameter.
unit
- LengthUnit
The measurement unit for width
and height
.
Picture(DocumentModel, String, Double, Double, LengthUnit, Boolean)
Initializes a new instance of the Picture class positioned in-line with specified picture's pixel data file path and picture's size.
public Picture(DocumentModel document, string picturePath, double width, double height, LengthUnit unit, bool isLink)
Public Sub New(document As DocumentModel, picturePath As String, width As Double, height As Double, unit As LengthUnit, isLink As Boolean)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The picture pixel data file path.
width
- System.Double
The picture width in units specified by unit
parameter.
height
- System.Double
The picture height in units specified by unit
parameter.
unit
- LengthUnit
The measurement unit for width
and height
.
isLink
- System.Boolean
If set to true picture won't be embedded in the document, instead picturePath
will be a link to the external picture.
Picture(DocumentModel, String, Double, Double, Boolean)
Initializes a new instance of the Picture class.
public Picture(DocumentModel document, string picturePath, double width, double height, bool isLink)
Public Sub New(document As DocumentModel, picturePath As String, width As Double, height As Double, isLink As Boolean)
Parameters
document
- DocumentModel
The owner document.
picturePath
- System.String
The file path to the image.
width
- System.Double
The picture width (in points).
height
- System.Double
The picture height (in points).
isLink
- System.Boolean
If set to true picture won't be embedded in the document, instead picturePath
will be a link to the external picture.
Properties
ElementType
public sealed override ElementType ElementType { get; }
Public NotOverridable Overrides ReadOnly Property ElementType As ElementType
Property Value
The Picture value.
Overrides
Format
Gets the image file format.
Property Value
The image file format.
Link
Gets or sets the link to the external picture.
Property Value
- System.String
The link to the external picture.
OnlineVideo
Gets or sets the properties for displaying an online video to the user.
Property Value
The properties for displaying an online video to the user.
PictureStream
Gets or sets the stream that contains the image.
public MemoryStream PictureStream { get; set; }
Public Property PictureStream As MemoryStream
Property Value
- System.IO.MemoryStream
The stream that contains the image.
Methods
Clone()
Clones this Picture instance.
Returns
Remarks
Document content element instance can exist only in a one place in the document.
If you want to insert document content element into some other part of the same document, then clone the element and insert its clone.
If you want to insert document content element into another document, then you should first import it into another document with Import<T>(T, Boolean, Boolean) method and then insert the imported element.
For more information, see cloning example.
Inherited Properties
AdjustValues | Gets the shape's adjust values. (Inherited from Shape) |
CharacterFormat | Gets or sets the character format. (Inherited from DrawingElement) |
Content | Gets the content of the current Element. (Inherited from Element) |
Document | Gets the owner document. (Inherited from Element) |
Fill | Gets the Brush that specifies how the shape's interior is filled. (Inherited from Shape) |
Hidden | Gets or sets a value indicating whether this DrawingElement is hidden. Default value is false. (Inherited from DrawingElement) |
Layout | Gets or sets the DrawingElement layout (position and size). (Inherited from DrawingElement) |
Metadata | Gets the metadata (non-visual properties) of this DrawingElement instance. (Inherited from DrawingElement) |
Outline | Gets the Pen that specifies the shape's outline. (Inherited from Shape) |
Parent | Gets the parent of this Element instance. (Inherited from Element) |
ParentCollection | Gets the InlineCollection that contains this Inline instance. (Inherited from Inline) |
Revision | Gets or sets the revision information for the inline. (Inherited from Inline) |
ShapeType | Gets the type of the shape. (Inherited from Shape) |
Inherited Methods
Clone(System.Boolean) | Clones this Shape instance. (Inherited from Shape) |
FormatDrawing() | Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed. (Inherited from DrawingElement) |
FormatDrawing(System.Double, System.Double, LengthUnit) | Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed. (Inherited from DrawingElement) |
FormatDrawing(System.Double, System.Double, LengthUnit, PaginatorOptions) | Formats this DrawingElement to specified size so it can be exported to PDF, XPS, image or be printed. (Inherited from DrawingElement) |
FormatDrawing(PaginatorOptions) | Formats this DrawingElement to its default size so it can be exported to PDF, XPS, image or be printed. (Inherited from DrawingElement) |
GetChildElements(System.Boolean) | Gets the child elements. (Inherited from Element) |
GetChildElements(System.Boolean, ElementType[]) | Gets the child elements filtered by ElementType. (Inherited from Element) |
GetParentElements() | Gets the parent elements. (Inherited from Element) |
GetParentElements(ElementType[]) | Gets the parent elements. (Inherited from Element) |