intbot / ng2-pdfjs-viewer

An angular component for PDFJS and ViewerJS (Supports all versions of angular)
Apache License 2.0
225 stars 113 forks source link

Angular 14 compatibility #190

Closed sgabb closed 1 year ago

sgabb commented 1 year ago

Hello, any plan to update compatibility and dependency to Angular 14?

codehippie1 commented 1 year ago

Soon, Will do in next couple of weeks

MotassemJa commented 1 year ago

Any updates on this? :)

Kreash commented 1 year ago

really want support for angular 14 =)

dereekb commented 1 year ago

This is the last dependency I need for upgrading a project to Angular 14, so I'll probably start on a PR here soon. I don't believe there will be any particular changes between 13 and 14 that would cause any issues.

codehippie1 commented 1 year ago

I am out of country till school opening. But I should be able to merge changes from your PR. Please let me know once it is ready.

dereekb commented 1 year ago

PR is created. Double check the changes, but all I did was bump the versions, create an ng-package.json file since they're required now apparently, merged those module declaration together, and ran build.

In the meantime if anyone is blocked by this you can pull down a special branch I've got that hosts the dist files directly:

"ng2-pdfjs-viewer": "git+https://git@github.com/dereekb/ng2-pdfjs-viewer#82b994d49db5406f64bc39229a04b3871b33d0b5",

Example of it working on my project:

Screen Shot 2022-08-14 at 12 34 45 AM
hemant-parmar commented 1 year ago

Awaiting for the update .. need it badly.. 4 apps affected.. Please help.

npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! While resolving: cops@0.0.0 npm ERR! Found: @angular/common@14.1.3 npm ERR! node_modules/@angular/common npm ERR! @angular/common@"^14.1.0" from the root project npm ERR! npm ERR! Could not resolve dependency: npm ERR! peer @angular/common@"^13.2.2" from ng2-pdfjs-viewer@13.2.2 npm ERR! ng2-pdfjs-viewer@"*" from the root project

hemant-parmar commented 1 year ago

@dereekb

In the meantime if anyone is blocked by this you can pull down a special branch I've got that hosts the dist files directly:

You mean the given reference "ng2-pdfjs-viewer": "git+...." should be added to the package.json file under dependencies?

MotassemJa commented 1 year ago

@dereekb

In the meantime if anyone is blocked by this you can pull down a special branch I've got that hosts the dist files directly:

You mean the given reference "ng2-pdfjs-viewer": "git+...." should be added to the package.json file under dependencies?

Yes you can add it to your package.json. But this is a temporary solution

hemant-parmar commented 1 year ago

@dereekb I used your link as a temp solution in package.json. But got the below error: Error: NG04002: Cannot match any routes. URL Segment: 'assets/pdfjs/web/viewer.html'

Note that I have the below in the angular.json file's options-assets (it was there for the prev version's implementation) { "glob": "**/*", "input": "node_modules/ng2-pdfjs-viewer/pdfjs", "output": "/assets/pdfjs" }

Then I manually copied the the node_modules/ng2-pdfjs-viewer/pdfjs folder to the assets folder and then it worked. But is this the right way? I was not required to do this manual copy-paste earlier. Did I miss anything in implementing the temp solution?

dereekb commented 1 year ago

Edit: Misread. The README states you need to manually copy this folder. So yes, you are correct.

https://github.com/intbot/ng2-pdfjs-viewer/blob/25973eb38d3676666c09f38b045fd85334a18f41/README.MD#step-2-copy-task-for-pdfjs

## Step 2: Copy task for pdfjs
For several advanced options to work, you need a copy of pdfjs from this npm package.
Edit your project's `angular.json` file and use `ng build` as described here https://angular.io/guide/workspace-config#project-asset-configuration 
```json
"assets": [
  { "glob": "**/*", "input": "node_modules/ng2-pdfjs-viewer/pdfjs", "output": "/pdfjs" },
]

_Please note, you may manually Copy `node_modules\ng2-pdfjs-viewer\pdfjs` to your `public` or `asset` folder or use any copy script as part of your build process.

I change the word "may" to "must" in my PR to hopefully reduce confusion in the future.

Laurens-makel commented 1 year ago

Any updates on when this will be released?

codehippie1 commented 1 year ago

I will return from vacation on Sep 12th. I could merge this the same week. Anyone interested in being a maintainer, let me know, would be happy to share the responsibilities.

NotTheSamAdamsGuy commented 1 year ago

Any updates on the release for this? Thank you!

Toso82 commented 1 year ago

When exit new release?

codehippie1 commented 1 year ago

@dereekb @Toso82 @NotTheSamAdamsGuy @Laurens-makel @hemant-parmar @sgabb @MotassemJa @Kreash New version is released with Angular 14. Also - Sample app and local deployment scripts are updated.

I am extremely sorry about the delay, I was out of country for a while and got back last week. On a side note @dereekb - Would you like to have permission to merge pull requests? From the looks of it - You went through the code already. I could certainly use a backup in my absence.

sgabb commented 1 year ago

Thanks, that's great!