ngx-extended-pdf-viewer not displaying text (wrong cmaps path)

1.6k views Asked by At

I am using the latest stable version of ngx-extended-pdf-viewer (4.1.2) and Angular 9.1. Everything work's great but after the application is built certain PDF-files don't show any text. It turns out that the reason was that the request for the .bcmap files fails.

Instead of requesting the bcmap files from: my-application/en/assets/cmaps/Adobe-CNS1-UCS2.bcmap

... the bcmap files are actually requested from: my-application/assets/cmaps/Adobe-CNS1-UCS2.bcmap

I don't understand that behaviour since the pdf.worker.min.js is correctly requested from my-application/en/assets/.

My angular.json assets setting looks like this:

"assets": [
   "src/favicon.ico",
   "src/assets",
   {
     "glob": "**/*",
     "input": "node_modules/ngx-extended-pdf-viewer/assets/",
     "output": "/assets/"
   }
]

Any tips what I am missing? Thanks in advance!

1

There are 1 answers

0
Stephan Rauh On BEST ANSWER

You've found a bug. Either you update to version 5.0.1 (which fixes the bug). Or you use the default options for a workaround:

import { pdfDefaultOptions } from 'ngx-extended-pdf-viewer';
pdfDefaultOptions.cMapUrl = () => './' + pdfDefaultOptions.assetsFolder + '/cmaps/';