The ‘PdfImage’ contains methods and properties to handle the images.
// 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, 10, 20, 400, 400);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
number
Gets the height of the PDF image.
number[]
Gets the physical dimension of the PDF image (Read only).
number
Gets the width of the PDF image.
Represents a method to draw a image on the PDF graphics.
Parameter | Type | Description |
---|---|---|
graphics | PdfGraphics |
value. |
Returns void
Represents a method to draw a image on the PDF graphics.
Parameter | Type | Description |
---|---|---|
graphics | PdfGraphics |
value. |
x | number |
The x-coordinate of the image |
y | number |
The y-coordinate of the image. |
Returns void