Pdf - PdfPrinterMarkTargetBox

18 Nov 20261 minute to read

Defines the target page boxes used when positioning printer marks.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data);
// Access the first page
let page: PdfPage = document.getPage(0) as PdfPage;
// Create a printer mark annotation
let annotation: PdfPrinterMarkAnnotation = new PdfPrinterMarkAnnotation(
    { x: 0, y: 0, width: 100, height: 100 }
);
// Set the target box
annotation.targetBox = PdfPrinterMarkTargetBox.TrimBox;
// Add the annotation to the page
page.annotations.add(annotation);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • ArtBox - Specifies the art box.
  • BleedBox - Specifies the bleed box.
  • CropBox - Specifies the crop box.
  • MediaBox - Specifies the media box.
  • TrimBox - Specifies the trim box.