Class Image
Image class provides common methods for working with PDF images.
Implements
Inherited Members
Namespace: pdftron.PDF
Assembly: PDFNet.dll
Syntax
public class Image : IDisposable
Remarks
PDF::Element contains a similar interface used to access image data. To create the Image object from image PDF::Element, pass the Element's SDF/Cos dictionary to Image constructor (i.e. Image image(element->GetXObject()) )
Constructors
Image(Obj)
Create an image from an existing image represented as a SDF/Cos object.
Declaration
public Image(Obj image_xobject)
Parameters
Type | Name | Description |
---|---|---|
Obj | image_xobject | the image_xobject |
Remarks
To create the Image object from image PDF::Element, pass the Element's SDF/Cos dictionary to Image constructor (i.e. Image image(element->GetXObject()))
Methods
Create(SDFDoc, byte[])
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, byte[] image_data)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, byte[], int, int, int, ColorSpace)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
int | width | The width of the image, in samples. |
int | height | The height of the image, in samples. |
int | bpc | The number of bits used to represent each color component. |
ColorSpace | color_space | The color space in which image samples are specified. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, byte[], int, int, int, ColorSpace, InputFilter)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Image.InputFilter input_format)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
int | width | The width of the image, in samples. |
int | height | The height of the image, in samples. |
int | bpc | The number of bits used to represent each color component. |
ColorSpace | color_space | The color space in which image samples are specified. |
Image.InputFilter | input_format | Image::InputFilter describing the format of pre-compressed image data. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, byte[], int, int, int, ColorSpace, Obj)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, byte[] image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
int | width | The width of the image, in samples. |
int | height | The height of the image, in samples. |
int | bpc | The number of bits used to represent each color component. |
ColorSpace | color_space | The color space in which image samples are specified. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, byte[], Obj)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, byte[] image_data, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, Bitmap)
Create and embed an Image. Embed the raw image data.
Declaration
public static Image Create(SDFDoc doc, Bitmap bitmap)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
Bitmap | bitmap | The bitmap containing image data. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
PDFNetException | InterruptedException the interrupted exception |
Create(SDFDoc, Bitmap, Obj)
Create and embed an Image. Embed the raw image data taking into account specified compression hints.
Declaration
public static Image Create(SDFDoc doc, Bitmap bitmap, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
Bitmap | bitmap | The bitmap containing image data. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
PDFNetException | InterruptedException the interrupted exception |
Create(SDFDoc, Stream)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, Stream stream)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
Stream | stream | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, Stream, Obj)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, Stream stream, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
Stream | stream | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, string)
Create and embed an Image from an external file.
Declaration
public static Image Create(SDFDoc doc, string filename)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
string | filename | The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image::Create(...) method. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Remarks
By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, string, Obj)
Create and embed an Image from an external file taking into account specified compression hints.
Declaration
public static Image Create(SDFDoc doc, string filename, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
string | filename | The name of the image file. Currently supported formats are JPEG, PNG, GIF, TIFF, BMP, EMF, and WMF. Other raster formats can be embedded by decompressing image data and using other versions of Image::Create(...) method. |
Obj | encoder_hints | An optional SDF::Obj containing a hint (or an SDF::Array of hints) that could be used to select a specific compression method and compression parameters. For a concrete example of how to create encoder hints, please take a look at JBIG2Test and AddImage sample projects. The image encoder accepts the following hints: - /JBIG2; SDF::Name("JBIG2"), An SDF::Name Object with value equal to "JBIG2". If the image is monochrome (i.e. bpc == 1), the encoder will compress the image using JBIG2Decode filter. Note that JBIG2 compression is not recommended for use on scanned text/financial documents or equivalent since its lossless nature can lead to similar looking numbers or characters being replaced. - [/JBIG2 /Threshold 0.6 /SharePages 50] - Compress a monochrome image using lossy JBIG2Decode compression with the given image threshold and by sharing segments from a specified number of pages. The threshold is a floating point number in the rage from 0.4 to 0.9. Increasing the threshold value will increase image quality, but may increase the file size. The default value for threshold is 0.85. "SharePages" parameter can be used to specify the maximum number of pages sharing a common 'JBIG2Globals' segment stream. Increasing the value of this parameter improves compression ratio at the expense of memory usage. - /CCITT; Compress a monochrome (i.e. bpc == 1) image using CCITT Group 4 compression. This algorithm typically produces larger output than JBIG2, but is lossless. This makes it much more suitable for scanned text documents. CCITT is the best option for more general monochrome compression use cases, since JBIG2 has potential to change image content. - [/JPEG] - Use JPEG compression with default compression. - [/JPEG /Quality 60] - Use JPEG compression with given quality setting. The "Quality" value is expressed on the 0..100 scale. - [/JPEG2000] - Use JPEG2000 compression to compress a RGB or a grayscale image. - [/JP2] - Use JPEG2000 compression with JP2 encoding. JP2 does not support CMYK images. - [/Flate] - Use Flate compression with maximum compression at the expense of speed. - [/Flate /Level 9] - Use Flate compression using specified compression level. Compression "Level" must be a number between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). - /RAW or [/RAW] - The encoder will not use any compression method and the image will be stored in the raw format. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Remarks
By default the function will either pass-through data preserving the original compression or will compress data using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, BitmapSource)
Create and embed an Image. Embed the raw image data.
Declaration
public static Image Create(SDFDoc doc, BitmapSource bitmapSource)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
BitmapSource | bitmapSource | The bitmap source containing image data. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
PDFNetException | InterruptedException the interrupted exception |
Create(SDFDoc, BitmapSource, Obj)
Create and embed an Image. Embed the raw image data taking into account specified compression hints.
Declaration
public static Image Create(SDFDoc doc, BitmapSource bitmapSource, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. To obtain SDF::Doc from PDFDoc use PDFDoc::GetSDFDoc() or Obj::GetDoc(). |
BitmapSource | bitmapSource | The bitmap source containing image data. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
PDFNetException | InterruptedException the interrupted exception |
Create(SDFDoc, Filter)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, Filter stream)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
Filter | stream | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, Filter, Obj)
Directly embed the image that is already compressed using the Image::InputFilter format. The function can be used to pass-through pre-compressed image data.
Declaration
public static Image Create(SDFDoc doc, Filter stream, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
Filter | stream | The stream or buffer containing compressed image data. The compression format must match the input_format parameter. |
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, FilterReader, int, int, int, ColorSpace)
Create and embed an Image. Embed the raw image data taking into account specified compression hints.
By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
int | bpc |
|
ColorSpace | color_space |
|
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, FilterReader, int, int, int, ColorSpace, InputFilter)
Create and embed an Image. Embed the raw image data taking into account specified compression hints.
By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Image.InputFilter input_format)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
int | bpc |
|
ColorSpace | color_space |
|
Image.InputFilter | input_format |
|
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Remarks
see the above method for details.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Create(SDFDoc, FilterReader, int, int, int, ColorSpace, Obj)
Create and embed an Image. Embed the raw image data taking into account specified compression hints.
By default the function will compress all images using Flate compression. It is possible to fine tune compression or to select a different compression algorithm using 'encoder_hints' object.
Declaration
public static Image Create(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, ColorSpace color_space, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
int | bpc |
|
ColorSpace | color_space |
|
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateImageMask(SDFDoc, byte[], int, int)
Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.
Declaration
public static Image CreateImageMask(SDFDoc doc, byte[] image_data, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
byte[] | image_data |
|
int | width |
|
int | height |
|
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded ImageMask. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateImageMask(SDFDoc, byte[], int, int, Obj)
Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.
Declaration
public static Image CreateImageMask(SDFDoc doc, byte[] image_data, int width, int height, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
byte[] | image_data |
|
int | width |
|
int | height |
|
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded ImageMask. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateImageMask(SDFDoc, FilterReader, int, int)
Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.
Declaration
public static Image CreateImageMask(SDFDoc doc, FilterReader image_data, int width, int height)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded ImageMask. |
Remarks
see Image::CreateImageMask for details.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateImageMask(SDFDoc, FilterReader, int, int, Obj)
Create and embed an ImageMask. Embed the raw image data taking into account specified compression hints. The ImageMask can be used as a stencil mask for painting in the current color or as an explicit mask specifying which areas of the image to paint and which to mask out. One of the most important uses of stencil masking is for painting character glyphs represented as bitmaps.
Declaration
public static Image CreateImageMask(SDFDoc doc, FilterReader image_data, int width, int height, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
Obj | encoder_hints | The encoder hints |
Returns
Type | Description |
---|---|
Image | PDF::Image object representing the embedded ImageMask. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateSoftMask(SDFDoc, byte[], int, int, int)
Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.
Declaration
public static Image CreateSoftMask(SDFDoc doc, byte[] image_data, int width, int height, int bpc)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | the doc |
byte[] | image_data | the image_data |
int | width | the width |
int | height | the height |
int | bpc | the bpc |
Returns
Type | Description |
---|---|
Image | the image |
Remarks
see Image::CreateSoftMask for details.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateSoftMask(SDFDoc, byte[], int, int, int, Obj)
Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.
Declaration
public static Image CreateSoftMask(SDFDoc doc, byte[] image_data, int width, int height, int bpc, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | A document to which the image should be added. The 'Doc' object can be obtained using Obj::GetDoc() or PDFDoc::GetSDFDoc(). |
byte[] | image_data | The stream or buffer containing image data represented in DeviceGray color space (i.e. one component per sample). The image data must not be compressed and must follow PDF format for sample representation (please refer to section 4.8.2 'Sample Representation' in PDF Reference Manual for details). |
int | width | The width of the image, in samples. |
int | height | The height of the image, in samples. |
int | bpc | The number of bits used to represent each color component. |
Obj | encoder_hints | An optional parameter that can be used to fine tune compression or to select a different compression algorithm. See Image::Create() for details. |
Returns
Type | Description |
---|---|
Image | the image |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateSoftMask(SDFDoc, FilterReader, int, int, int)
Create and embed a Soft Mask. Embed the raw image data taking into account specified compression hints.
Declaration
public static Image CreateSoftMask(SDFDoc doc, FilterReader image_data, int width, int height, int bpc)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc |
|
FilterReader | image_data |
|
int | width |
|
int | height |
|
int | bpc |
|
Returns
Type | Description |
---|---|
Image | the image |
Remarks
this feature is available only in PDF 1.4 and higher.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
CreateSoftMask(SDFDoc, FilterReader, int, int, int, Obj)
Creates the soft mask.
Declaration
public static Image CreateSoftMask(SDFDoc doc, FilterReader image_data, int width, int height, int bpc, Obj encoder_hints)
Parameters
Type | Name | Description |
---|---|---|
SDFDoc | doc | the doc |
FilterReader | image_data | the image_data |
int | width | the width |
int | height | the height |
int | bpc | the bpc |
Obj | encoder_hints | the encoder_hint |
Returns
Type | Description |
---|---|
Image | the image |
Remarks
see Image::CreateSoftMask for details.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
DeleteObject(IntPtr)
Declaration
public static extern bool DeleteObject(IntPtr hObject)
Parameters
Type | Name | Description |
---|---|---|
IntPtr | hObject |
Returns
Type | Description |
---|---|
bool |
Dispose()
Releases all resources used by the Image
Declaration
public override sealed void Dispose()
Dispose(bool)
Declaration
[HandleProcessCorruptedStateExceptions]
protected virtual void Dispose(bool A_0)
Parameters
Type | Name | Description |
---|---|---|
bool | A_0 |
Export(string)
Saves this image to a file.
The output image format (TIFF, JPEG, or PNG) will be automatically selected based on the properties of the embedded image. For example, if the embedded image is using CCITT Fax compression, the output format will be TIFF. Similarly, if the embedded image is using JPEG compression the output format will be JPEG. If your application needs to explicitly control output image format you may want to use ExportAsTiff() or ExportAsPng().
Declaration
public int Export(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename | string that specifies the path name for the saved image. The filename should not include the extension which will be appended to the filename string based on the output format. |
Returns
Type | Description |
---|---|
int | the number indicating the selected image format: (0 - PNG, 1 - TIF, 2 - JPEG). |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Export(FilterWriter)
Saves this image to the output stream.
Declaration
public int Export(FilterWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FilterWriter | writer | A pointer to FilterWriter used to write to the output stream. If the parameter is null, nothing will be written to the output stream, but the function returns the format identifier. |
Returns
Type | Description |
---|---|
int | the number indicating the selected image format: (0 - PNG, 1 - TIF, 2 - JPEG). |
Remarks
see the overloaded Image::Export method for more information.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
ExportAsPng(string)
Saves this image to a PNG file.
Declaration
public void ExportAsPng(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename | string that specifies the path name for the saved image. The filename should include the file extension |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
ExportAsPng(FilterWriter)
Saves this image to a PNG output stream.
Declaration
public void ExportAsPng(FilterWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FilterWriter | writer | FilterWriter used to write to the output stream. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
ExportAsTiff(string)
Saves this image to a TIFF file.
Declaration
public void ExportAsTiff(string filename)
Parameters
Type | Name | Description |
---|---|---|
string | filename | string that specifies the path name for the saved image. The filename should include the file extension |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
ExportAsTiff(FilterWriter)
Saves this image to a TIFF output stream.
Declaration
public void ExportAsTiff(FilterWriter writer)
Parameters
Type | Name | Description |
---|---|---|
FilterWriter | writer | FilterWriter used to write to the output stream. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
~Image()
Declaration
protected ~Image()
GetBitmap()
Gets the bitmap.
Declaration
public Bitmap GetBitmap()
Returns
Type | Description |
---|---|
Bitmap | the bitmap |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetBitmapSource()
Gets the bitmapSource.
Declaration
public BitmapSource GetBitmapSource()
Returns
Type | Description |
---|---|
BitmapSource | the bitmapSource |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetBitsPerComponent()
Gets the bits per component.
Declaration
public int GetBitsPerComponent()
Returns
Type | Description |
---|---|
int | the number of bits used to represent each color component. Only a single value may be specified; the number of bits is the same for all color components. Valid values are 1, 2, 4, 8, and 16. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetComponentNum()
Gets the component number.
Declaration
public int GetComponentNum()
Returns
Type | Description |
---|---|
int | the number of color components per sample. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetDecodeArray()
Gets the decode array.
Declaration
public Obj GetDecodeArray()
Returns
Type | Description |
---|---|
Obj | Decode array or NULL if the paramter is not specified. A decode object is an array of numbers describing how to map image samples into the range of values appropriate for the images color space . If ImageMask is true, the array must be either [0 1] or [1 0]; otherwise, its length must be twice the number of color components required by ColorSpace. Default value depends on the color space, See Table 4.36 in PDF Ref. Manual. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageColorSpace()
Gets the image color space.
Declaration
public ColorSpace GetImageColorSpace()
Returns
Type | Description |
---|---|
ColorSpace | The SDF object representing the color space in which image samples are specified or NULL if:
The returned color space may be any type of color space except Pattern. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageData()
Gets the image data.
Declaration
public Filter GetImageData()
Returns
Type | Description |
---|---|
Filter | A stream (filter) containing decoded image data |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageDataSize()
Gets the image data size.
Declaration
public int GetImageDataSize()
Returns
Type | Description |
---|---|
int | the size of image data in bytes |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageHeight()
Gets the image height.
Declaration
public int GetImageHeight()
Returns
Type | Description |
---|---|
int | the height of the image, in samples. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageRenderingIntent()
Gets the image rendering intent.
Declaration
public GState.RenderingIntent GetImageRenderingIntent()
Returns
Type | Description |
---|---|
GState.RenderingIntent | The color rendering intent to be used in rendering the image. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetImageWidth()
Gets the image width.
Declaration
public int GetImageWidth()
Returns
Type | Description |
---|---|
int | the width of the image, in samples. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetMask()
Gets the mask.
Declaration
public Obj GetMask()
Returns
Type | Description |
---|---|
Obj | an image XObject defining an image mask to be applied to this image (See 'Explicit Masking', 4.8.5), or an array specifying a range of colors to be applied to it as a color key mask (See 'Color Key Masking'). If IsImageMask() return true, this method will return NULL. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
GetSDFObj()
Gets the SDFObj.
Declaration
public Obj GetSDFObj()
Returns
Type | Description |
---|---|
Obj | the underlying SDF/Cos object |
GetSoftMask()
Gets the soft mask.
Declaration
public Obj GetSoftMask()
Returns
Type | Description |
---|---|
Obj | an image XObject defining a Soft Mask to be applied to this image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual), or NULL if the image does not have the soft mask. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
IsImageInterpolate()
Checks if is image interpolate.
Declaration
public bool IsImageInterpolate()
Returns
Type | Description |
---|---|
bool | a boolean indicating whether image interpolation is to be performed. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
IsImageMask()
Checks if is image mask.
Declaration
public bool IsImageMask()
Returns
Type | Description |
---|---|
bool | a boolean indicating whether the inline image is to be treated as an image mask. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
IsValid()
Checks if is valid.
Declaration
public bool IsValid()
Returns
Type | Description |
---|---|
bool | whether this is a valid raster image. If the function returns false the underlying SDF/Cos object is not a valid raster image and this Image object should be treated as null. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
Set(Image)
Sets value to the given image value
Declaration
public void Set(Image p)
Parameters
Type | Name | Description |
---|---|---|
Image | p | image object |
SetMask(Image)
Set an Explicit Image Mask.
Declaration
public void SetMask(Image image_mask)
Parameters
Type | Name | Description |
---|---|---|
Image | image_mask | the new mask |
Remarks
image_mask must be a valid image mask (i.e. image_mask.IsImageMask() must return true.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetMask(Obj)
Set a Color Key Mask.
Declaration
public void SetMask(Obj mask)
Parameters
Type | Name | Description |
---|---|---|
Obj | mask | is an Cos/SDF array specifying a range of colors to be masked out. Samples in the image that fall within this range are not painted, allowing the existing background to show through. The effect is similar to that of the video technique known as chroma-key. For details of the array format please refer to section 4.8.5 'Color Key Masking' in PDF Reference Manual. |
Remarks
the current document takes the ownership of the given SDF object.
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
SetSoftMask(Image)
Set a Soft Mask.
Declaration
public void SetSoftMask(Image soft_mask)
Parameters
Type | Name | Description |
---|---|---|
Image | soft_mask | is a subsidiary Image object defining a soft-mask image (See section 7.5.4 'Soft-Mask Images' in PDF Reference Manual) to be used as a source of mask shape or mask opacity values in the transparent imaging model. The alpha source parameter in the graphics state determines whether the mask values are interpreted as shape or opacity. |
Exceptions
Type | Condition |
---|---|
PDFNetException | PDFNetException the PDFNet exception |
op_Assign(Image)
Assignment operator
Declaration
public Image op_Assign(Image r)
Parameters
Type | Name | Description |
---|---|---|
Image | r | an given |
Returns
Type | Description |
---|---|
Image | an |