stephanrauh / ngx-extended-pdf-viewer

A full-blown PDF viewer for Angular 16, 17, and beyond
https://pdfviewer.net
Apache License 2.0
486 stars 184 forks source link

Building with custom version of pdf.js not working #792

Closed adambeer closed 3 years ago

adambeer commented 3 years ago

I have followed the steps listed here: https://github.com/stephanrauh/ngx-extended-pdf-viewer/blob/main/projects/ngx-extended-pdf-viewer/how-to-build.md

But my changes are not taking affect. Specifically I made a change in mypdf.js/web/pdf_find_controller.js and confirmed it worked by running gulp server (step 7 of the bottom task). However after copying the newly compiled ngx-extended-pdf-viewer folder from the dist folder to my node_modules folder in my project, the changes I made wernt working anymore.

Am I missing something here?

adambeer commented 3 years ago

As a reference, I posted an issue on the pdf.js repo about the change I was trying to make:

https://github.com/mozilla/pdf.js/issues/13496

stephanrauh commented 3 years ago

Weird. The walk-through seems to be pretty up-to-date. Usually I use npm run showcase or npm run issue, which copy the library to another project. You could modify one of these scripts to copy the library to your project. Alternatively, you can use npm link (and tell me how to do that - for some reason, I've been to lazy to examine that, although I'm sure it'd make my life easier).

Currently, this boils down to three steps:

stephanrauh commented 3 years ago

I haven't made up my mind yet, but I guess adding a programmatic API to highlight search results without scrolling is a good idea.

adambeer commented 3 years ago

@stephanrauh The files that are in the mypdf.js\build\minified\build folder dont contain version numbers like this library is looking for and it doesnt seem the es5 versions are generated either. After manually copying and replacing the new pdf.js files, adding the version number to them, I have now hit a snag where assets/viewer.js is trying to load the pdf.worker.js from the /build folder. Is this something new in 2.9.335 of pdf.js or am I missing a step somwehere?

adambeer commented 3 years ago

I was able to get it to work finally. I re-tried it with your pdf.js repo, made the code changes, ran the updateMozillasPdfViewer.bat file and win-package. Then I had to manually replace all the files in /assets with these new files and append -2.9.149 to all of the file names and it worked!

Ultimately I would prefer to use mozillas pdf.js v2.9.335 repo but I was running into that issue of pdf.worker.js being looked for in a build folder.

stephanrauh commented 3 years ago

I'm afraid ngx-extended-pdf-viewer isn't compatible with the original Mozilla pdf.js library. My fork features roughly 100 bug fixes and improvements. For example, I've added additional fuzzy search.

stephanrauh commented 3 years ago

I'm confused you had to rename the files. They are renamed automatically by add-version-number.js. Which files did you copy? The correct set of files to copy is in the directory projects/ngx-extended-pdf-viewer/assets and projects/ngx-extended-pdf-viewer/bleeding-edge.

image