|
THotPDF.AddImage
|
Top Previous Next |
|
Adds an image to the PDF document and returns an image index that CurrentPage.ShowImage can draw
Delphi syntax: function AddImage(Image: TGraphic; Compression: THPDFImageCompressionType; IsMask: boolean = False; MaskIndex: Integer = -1): Integer; overload;
function AddImageAsMask(FileName: TFileName; Compression: THPDFImageCompressionType = icFlate): Integer; overload; function AddImageWithMask(FileName: TFileName; MaskIndex: Integer; Compression: THPDFImageCompressionType = icJpeg): Integer; overload; function AddImageWithJpegQuality(FileName: TFileName; Quality: TJPEGQualityRange): Integer; overload; function AddMonochromeImageAuto(FileName: TFileName): Integer; overload;
function AddImage(FileName: TFileName; Compression: THPDFImageCompressionType; IsMask: boolean = False; MaskIndex: Integer = -1): Integer; overload;
Description Call AddImage to register an image and obtain an image handle that can later be drawn with CurrentPage.ShowImage. The file overload accepts BMP, JPEG and JPEG 2000 files, whilst the graphic overload accepts a loaded TGraphic instance. Compression selects the PDF image compression method. IsMask indicates whether the image is used as a mask, and MaskIndex identifies the associated mask image. With icJpeg a JPEG file or TJPEGImage is embedded without recompression and keeps its colour model: greyscale JPEGs become DeviceGray images, colour JPEGs DeviceRGB and CMYK JPEGs DeviceCMYK. JPEG files are identified by their content, so upper-case names and the .jpeg extension work as well. With icFlate, 1-bit, 4-bit and 8-bit palette bitmaps keep their bit depth and their own palette. The bilevel filters (icCCITT31, icCCITT32, icCCITT42, icJBIG2) treat the darker palette colour as black whichever order the palette lists Use AddImageAsMask and AddImageWithMask when you need explicit binary /ImageMask or /Mask wiring without manually passing the low-level IsMask argument. Use AddImageWithJpegQuality to override JpegQuality for one image whilst preserving the document default for later images. Use AddMonochromeImageAuto or icAutoMono to let HotPDF choose Flate, CCITT Group 4 or JBIG2 for 1-bit bitmap content based on image size and conformance constraints. When two AddImage calls produce identical encoded image data with the same mask relationship, HotPDF reuses the existing image XObject and returns the existing image index instead of embedding a duplicate stream
Code Example
See also: CurrentPage.ShowImage |