@syncfusion/ej2-pdf
Version:
Feature-rich JavaScript PDF library with built-in support for loading and manipulating PDF document.
114 lines (113 loc) • 4 kB
TypeScript
import { _ImageDecoder } from './../../graphics/images/image-decoder';
import { PdfImage } from './pdf-image';
/**
* The 'PdfBitmap' contains methods and properties to handle the Bitmap images.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Gets the graphics of the PDF page
* let graphics: PdfGraphics = page.graphics;
* // Create new image object by using JPEG image data as Base64 string format
* let image: PdfImage = new PdfBitmap('/9j/4AAQSkZJRgABAQEAkACQAAD/4....QB//Z');
* //Draw the image.
* graphics.drawImage(image, {x: 10, y: 20, width: 400, height: 400});
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
export declare class PdfBitmap extends PdfImage {
/**
* Indicates whether the image is currently valid/usable.
*
* @private
*/
_imageStatus: boolean;
/**
* Internal code indicating detected image type.
*
* @private
*/
_checkImageType: number;
/**
* Decoder instance used to parse this bitmap image.
*
* @private
*/
_decoder: _ImageDecoder;
/**
* Create an instance for `PdfBitmap` class.
*
* @param {string} encodedString Image as Base64 string.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Gets the graphics of the PDF page
* let graphics: PdfGraphics = page.graphics;
* // Create new image object by using JPEG image data as Base64 string format
* let image: PdfImage = new PdfBitmap('/9j/4AAQSkZJRgABAQEAkACQAAD/4....QB//Z');
* //Draw the image.
* graphics.drawImage(image, {x: 10, y: 20, width: 400, height: 400});
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(encodedString: string);
/**
* Create an instance for `PdfBitmap` class.
*
* @param {Uint8Array} encodedString Image data as byte array.
* ```typescript
* // Load an existing PDF document
* let document: PdfDocument = new PdfDocument(data, password);
* // Access first page
* let page: PdfPage = document.getPage(0);
* // Gets the graphics of the PDF page
* let graphics: PdfGraphics = page.graphics;
* // Create new image object by using JPEG image data as array of bytes
* let image: PdfImage = new PdfBitmap(array);
* //Draw the image.
* graphics.drawImage(image, {x: 10, y: 20, width: 400, height: 400});
* // Save the document
* document.save('output.pdf');
* // Destroy the document
* document.destroy();
* ```
*/
constructor(encodedString: Uint8Array);
/**
* Initializes the bitmap by decoding the input Base64 string or byte array,
* selecting the appropriate image decoder, and caching the image dimensions
* and bits-per-component from the decoder.
*
* @private
* @param {string | Uint8Array} encodedString The image content as a Base64 string or a byte array.
* @returns {void}
*/
_initializeAsync(encodedString: string): void;
_initializeAsync(encodedString: Uint8Array): void;
/**
* Finalizes the image for embedding by creating the PDF image stream via the decoder,
* applying any PNG-specific mask stream, and normalizing the color space in the
* image dictionary.
*
* @private
* @returns {void}
*/
_save(): void;
/**
* Sets the PDF image dictionary's `ColorSpace` and `Decode` entries based on the
* decoders detected color model (RGB/Gray/CMYK) or indexed palette (for PNG).
*
* @private
* @returns {void}
*/
_setColorSpace(): void;
}