stephanrauh / ngx-extended-pdf-viewer

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

How to build ngx-extended-pdf-viewer 18.1.x on angular 11 project? #2311

Closed Congchuabongbong closed 5 months ago

Congchuabongbong commented 5 months ago

I am trying to build version 18.1.x on angular 11. I create an angular 11 project, then I copy all your logic from version 18.1.x and then build it. so i tried config but it still can't be built. In addition to the above method, I tried downloading version 9 which is using angular 11 and doing the same as above but it's still the same! I encountered the same error as in the photo! I need a base project to support angular 11 but still have all the features of 18.1.x. I sent you my git link, can you support me? https://github.com/Congchuabongbong/ngx-extended-pdf-viewer-v11

Congchuabongbong commented 5 months ago

image image

stephanrauh commented 5 months ago

I'd really like to support you, but I'm awfully sorry, I can't do that. This is a leisure-time project, and I barely manage to solve new tickets.

In theory, you should be able to compile the source code with Angular 11. There are a few features of modern Angular I'm using, but it's a project with a lot of history, so most of the code is old. To be honest, I don't understand the error messages in your screenshot. They are really weird.

stephanrauh commented 5 months ago

I'll keep the ticket open for a while. Maybe another developer sees it and is ready to help you.

Dear community, come on, show what you're able to achieve!

Congchuabongbong commented 5 months ago

In the options folder, I see you use accessor in interface. I think this is the error above that I sent you! image

Congchuabongbong commented 5 months ago

But why do you use acessor in the interface? I haven't seen the typescript doc talk about this!

stephanrauh commented 5 months ago

Which version of TypeScript are you using? Accessors have be added to interfaces in TypeScript 4.3. https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-3.html

stephanrauh commented 5 months ago

Ah, I see, you're using Angular 11. Well, maybe you have to replace the accessors by simple attributes. To be honest, I didn't write the type definition myself - it's been generated by the TypeScript compiler, and I only copied it into the project.

Congchuabongbong commented 5 months ago

Maybe I have migrate down to version 11 mainly due to typescript syntax as I mentioned above. Do I need to downgrade the showcase to version 11 now? I still want to use your automatic build kit! To be honest, I mainly customize in pdfJs. As for your core, I do almost nothing! But now if I don't use the automatic build method, I have to do it manually by copying the entire pdfJs after building into the assets of ngx-extended-pdf-viewer.

stephanrauh commented 5 months ago

I suppose you already know that, but you've phrased your sentence slightly confusing, so let me state it correctly: if you need to use Angular 11 for some reason, this means you're bound to TypeScript 4.2. Also see https://angular.io/guide/versions

stephanrauh commented 5 months ago

If the automated build tool is "ng add ngx-extended-pdf-viewer", here's the source code: https://github.com/stephanrauh/ngx-extended-pdf-viewer/tree/main/projects/ngx-extended-pdf-viewer/schematics/ng-add

I can't promise it, but I believe that ng add ngx-extended-pdf-viewer works in an Angular 11 installation and installs either version 13.5.3 or version 14.0.1. If that doesn't work for you, you can run the schematics from your local source of the library using this script: https://github.com/stephanrauh/ngx-extended-pdf-viewer/blob/b67127c1ece0c68c03fd51c972deded2662d1eab/package.json#L18

stephanrauh commented 5 months ago

I'm afraid the community didn't chime in, so let's close the ticket. Feel free to add comments to this ticket. I'm still listening to this channel. I just want to keep the list of open tickets short, because I'm using it as a to-do list.