Click or drag to resize
Pdftools logo

ImageCreate Method

Create an image object from image data.

Supported formats are:
  • BMP
  • DIB
  • JPEG
  • JPEG2000
  • JBIG2
  • PNG
  • GIF
The returned image object is not yet painted on any page, but it is associated with the given target document.

Namespace: PdfTools.Toolbox.Pdf.Content
Assembly: PdfTools.Toolbox (in PdfTools.Toolbox.dll) Version: 1.0.0+fdabb036503e9f99735634a6d4f5be875399e9f5
Syntax
C#
public static Image Create(
	Document targetDocument,
	Stream stream
)

Parameters

targetDocument  Document
the output document with which the returned object is associated
stream  Stream
the image data stream

Return Value

Image
the newly created image object
Exceptions
ExceptionCondition
IOExceptionError reading from the image or writing to the document
UnknownFormatExceptionThe image data has an unknown format
CorruptExceptionThe image data is corrupt
ArgumentExceptionif the targetDocument argument has already been closed
ArgumentExceptionif the targetDocument argument is read-only
ArgumentExceptionif the stream argument is
ArgumentNullExceptionif targetDocument is .
ArgumentNullExceptionif stream is .
See Also