How can I help you?
PdfEmbeddedImage
6 Feb 20262 minutes to read
The class provides detailed metadata about an image that is embedded inside a PDF document.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Initialize a new instance of the `PdfDataExtractor` class
let extractor: PdfDataExtractor = new PdfDataExtractor(document);
// Extract collection of `PdfEmbeddedImage` from the PDF document.
let imageInfoCollection: PdfEmbeddedImage[] = extractor.extractImages({ startPageIndex: 0, endPageIndex: document.pageCount - 1});
let imageInfo: PdfEmbeddedImage = imageInfoCollection[0];
// Gets the raw image bytes of the embedded image.
let data: Uint8Array = imageInfo.data;
// Gets the image format.
let type: ImageFormat = imageInfo.type;
// Gets the page index of the image.
let pageIndex: number = imageInfo.pageIndex;
// Gets the index of the image occurrence within PDF page.
let index: number = imageInfo.index;
// Gets the bounds of the image.
let bounds: Rectangle = imageInfo.bounds;
// Gets the boolean flag indicating whether the image is interpolated or not.
let isImageInterpolated: boolean = imageInfo.isImageInterpolated;
// Gets the boolean flag indicating whether the image is masked or not.
let IsImageMasked: boolean = imageInfo.IsImageMasked;
// Gets the boolean flag indicating whether the image is soft masked or not.
let IsSoftMasked: boolean = imageInfo.IsSoftMasked;
// Destroy the documents
document.destroy();Properties
Get bounds Rectangle
Gets the bounds of the image.
Get data Uint8Array
Gets the raw image bytes of the embedded image.
Get index number
Gets the index of the image occurrence within PDF page.
Get isImageInterpolated boolean
Gets the boolean flag indicating whether the image is interpolated or not.
Get isImageMasked boolean
Gets the boolean flag indicating whether the image is masked or not.
Get isSoftMasked boolean
Gets the boolean flag indicating whether the image is masked or not.
Get pageIndex number
Gets the page index of the image.
Get physicalDimension Size
Gets the native pixel dimensions of the image.
Get resourceName string
Gets the XObject resource name for this image
Get type ImageFormat
Gets the image format of the embedded image.