Ngx-extended-pdf-viewer: Unnecessary Console Log Statements

Created on 3 Feb 2020  路  11Comments  路  Source: stephanrauh/ngx-extended-pdf-viewer

Thank you for maintaining this very cool angular pdf viewer!

Is there a way to turn off the console.log statements for production? Unfortunately, when using the ngx-extended-pdf-viewer, my log is full of console.log statements that come from the library as it seems. Is there a way to turn them off?

Examples:

  • PDF viewer: ngx-extended-pdf-viewer running on pdf.js 2.3.200
  • PDF 4dc91a1875a6d707aec203bb021c93a0 [1.3 Acrobat Distiller 4.0 for Windows / Microsoft Word 8.0] (PDF.js: 2.3.200 modified by ngx-extended-pdf-viewer)
  • undefined
  • showUnverifiedSignatures false

Check this first

Yes, the console.log statements appear there too.

Describe the bug
Is there a way to turn off the console.log statements for production? Unfortunately, when using the ngx-extended-pdf-viewer, my log is full of console.log statements that come from the library as it seems. Is there a way to turn them off?

Version info

  • Version of ngx-extended-pdf-viewer: 1.8.4
  • Version of the JavaScript files pdf.js, pdf-worker.js and viewer.js (currently: default files vs. version 2.2 preview files)

Desktop (please complete the following information):

  • OS: mac OS 10.15.3
  • Browser: Chrome
  • Version: 79

To Reproduce
Just open https://pdfviewer.net/simple? and look into the console. It's full of "debug statements".

Solved nuisance

All 11 comments

image

You're right, at least three or four of these messages are unnecessary. I'll remove them. Thanks for the hint!

Thanks! In my application there are more warnings, like those for example:
Screen Shot 2020-02-04 at 09 03 19

Which language are you using? I've translated the find-ignore-accents messages to the few languages I know. I'm afraid that's not much. Here's the complete list of translations: https://github.com/stephanrauh/ngx-extended-pdf-viewer/tree/master/projects/ngx-extended-pdf-viewer/src/assets/additional-locale

I'm using the viewer like this:

<ngx-extended-pdf-viewer *ngIf="pdfContent"
                                 [base64Src]="pdfContent"
                                 useBrowserLocale="true"
                                 height="80vh"
                                 [showOpenFileButton]="false"
                                 [showBookmarkButton]="false"
                                 textLayer="true"></ngx-extended-pdf-viewer>

And the language of my browser is english.

That's strange. The showcase at https://pdfviewer.net doesn't complains about the missing translations. Just double-checking: did you add the translation file to the index.html? Or did you add the translations manually to your project?

Otherwise, the translations should have been updated by now. Obviously, they aren't, so I'm confused. My best guess is you're using an old i18n file.

It seems to be that the key "find_ignore_ascents" is missing in the viewer.properties file of version 1.8.4. I updated to the newest version ^2.0.0-alpha.2 like in your github example project and there the key is contained in the viewer.properties file for the locale en-US.

Oh, you're right. According to my changelog, I've probably added the translations to version 1.8.5 - but I've forgotten to publish that version.

BTW, I've just learned that the unpkg CDN is a good tool to find out things like this: https://unpkg.com/browse/[email protected]/assets/locale/en-GB/viewer.properties

I believe I've caught all the unnecesary log statements. But I haven't published the new version yet, so I don't close this ticket yet.

I close this ticket now that I've published the new version.

Was this page helpful?
0 / 5 - 0 ratings