Zidane
Zidane

Reputation: 1904

How to Remove or disable hyperlinks in syncfusion pdf viewer using angular and typescript

I am trying to remove or disable hyperlinks using syncfusion. I am not getting an error at compile time. I am however getting a runtime error that reads "core.mjs:9095 ERROR TypeError: Cannot read properties of undefined (setting'hyperlinkClick')"

  private getSingleTest() {
    if (!this.testId) return;
    this.testService.getUrl(`get-test-with-file/${this.testId}`)
      .subscribe((data) => {
        this.test = data.test;
        this.initForms(data.test);

        if (data.file) {
          const base64Url = 'data:application/pdf;base64,' + data.file;
          //this.pdfViewer.removeHyperlink();
          this.pdfViewer.hyperlinkClick = false; 
          this.pdfViewer.load(base64Url, '');
        }

        if (data.test) {
          this.onGradeChange(data.test.sectorId)
        }
      });
  }

Upvotes: 0

Views: 200

Answers (1)

CHINNAMUNIA KARTHIK C
CHINNAMUNIA KARTHIK C

Reputation: 11

To enable or disable the hyperlink, you can utilize the #enablehyperlink API. Please refer the code snippet and sample for this.

Code snippet:

viewer.enableHyperlink = false;

Angular Sample: https://stackblitz.com/edit/angular-njjwgs?file=src%2Fapp.component.html,src%2Fapp.component.ts,src%2Fapp.component.css

Typescript sample: https://stackblitz.com/edit/gvhkyr?file=index.ts,index.html

Upvotes: 0

Related Questions