PdfAppearance
class represents the appearance of the annotation.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Get the first page
let page: PdfPage = document.getPage(0) as PdfPage;
// Create a new rubber stamp annotation
const annotation: PdfRubberStampAnnotation = new PdfRubberStampAnnotation(50, 100, 100, 50);
// Get the appearance of the annotation
let appearance: PdfAppearance = annotation.appearance;
// 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 as the custom appearance for the annotation
appearance.normal.graphics.drawImage(image, 0, 0, 100, 50);
// Add annotation to the page
page.annotations.add(annotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
PdfTemplate
Get the normal appearance of the annotation.