Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabling the textLayer in PDFjs #85

Closed
vishnu-dev opened this issue Apr 6, 2020 · 6 comments
Closed

Disabling the textLayer in PDFjs #85

vishnu-dev opened this issue Apr 6, 2020 · 6 comments

Comments

@vishnu-dev
Copy link

vishnu-dev commented Apr 6, 2020

I need to disable the textLayer that is rendered above the canvas to reduce memory.
In PDFjs it is done with the code below,

PDFJS.disableTextLayer = false

How to do it using ng2-pdfjs-viewer?

@vishnu-dev
Copy link
Author

Just figured it out, For people needing this,

@ViewChild('pdfViewerOnDemand', {static: false}) pdfViewer;

loadComplete() {
    this.pdfViewer.PDFViewerApplicationOptions.textLayer = false;
}

@Paul75
Copy link

Paul75 commented Apr 22, 2020

Hello,

For me that provoque error in console : PDFViewerApplicationOptions is not defined...

thanks

@vishnu-dev
Copy link
Author

@Paul75 Load complete function should be called after document is loaded.

(onDocumentLoad)="loadComplete()"

@Avejack
Copy link

Avejack commented Jun 1, 2021

This is not working for me...

It did not change anything.

my html:

<ng2-pdfjs-viewer #pdfViewer [pdfSrc]="data.pdfSrc" viewerId="anyId" (onDocumentLoad)="loadComplete()"></ng2-pdfjs-viewer>

my component:

  @ViewChild('pdfViewer', { static: false }) pdfViewer: PdfJsViewerComponent;
  
  loadComplete() {
    console.log('loadComplete');
    this.pdfViewer.PDFViewerApplicationOptions.textLayer = false;
    this.cdr.markForCheck();
  }

As you can see I am even trying to call "markForCheck()" to hopefully fire any change but nothing changes... The console.log gets logged to the console, but the textLayer is still rendered above the canvas.

@tigrenok00
Copy link

@Avejack Same here... Did you find a solution?

@Avejack
Copy link

Avejack commented Jun 23, 2021

@tigrenok00 For my use case - yes. But not for this problem - sorry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants