How to set font family of annotation added progamatically in PSPDFKit using JavaScript

42 Views Asked by At

I want to set the font-family of a new annotation as "Times New Roman". This is my code from documentation of PSPDFKit.


    let annotation = new PSPDFKit.Annotations.TextAnnotation({
      id: option.id,
      pageIndex: option.pageIndex,
      text: { format: "plain", value : option.text },
      font: "Times New Roman",
      fontSize: option.fontSize ?? 12,
      isBold: option.isBold ?? false,
      horizontalAlign: option.horizontalAlign ?? "left",
      verticalAlign: option.verticalAlign ?? "top",
      boundingBox: new PSPDFKit.Geometry.Rect(option.boundingBox),
      backgroundColor: option.backgroundColor ?? Color.TRANSPARENT,
      fontColor: option.fontColor ?? Color.BLACK
    });

    if(option.fitSizing) {
      annotation = await instance.calculateFittingTextAnnotationBoundingBox(annotation)
    }

And following image is the result in pdf. enter image description here

As you can see, the font-family is Arial - this is default font-family. Is there any solution to solve this problem?

0

There are 0 best solutions below