Pdf - Pdf3DProjectionType

18 Nov 20261 minute to read

Defines the projection types available for a 3D view.

// 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 3D annotation with U3D data
let annotation3D: Pdf3DAnnotation = new Pdf3DAnnotation(
    page,
    { x: 50, y: 350, width: 200, height: 200 }
);
// Set the projection type
annotation3D.projection.projectionType = Pdf3DProjectionType.Perspective;
// Add the annotation to the page
page.annotations.add(annotation3D);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • Orthographic - Specifies orthographic projection.
  • Perspective - Specifies perspective projection.