|
| 1 | +# Preparations |
| 2 | +You need a current node.js and roughly 20-30 minutes of time. Most of the build process is automated. This recipe shows the Unix and MacOS scripts, but there are also Windows batch files you can use. Sometime the two sets of files diverge. If you run into trouble, have a look at the Unix files. I use them much more often, so they are the "source of truth". |
| 3 | + |
| 4 | +## Build ngx-extended-pdf-viewer without modifying pdf.js |
1 | 5 | 1. Create a new folder "embedded-pdf". It must be in the same folder as ngx-extended-pdf-viewer. |
2 | 6 | 2. cd embedded-pdf |
3 | | -3. git clone https://github.com/mozilla/pdf.js.git |
4 | | -4. mv pdf.js mozillas-pdf.js (or rename pdf.js mozillas-pdf.js if you're using Windows) |
5 | | -5. cd mozillas-pdf.js |
| 7 | +3. git clone https://github.com/stephanrauh/ngx-extended-pdf-viewer |
| 8 | +4. cd ngx-extended-pdf-viewer |
| 9 | +5. npm install |
| 10 | +6. npm run win-package (or npm run unix-package, depending on your OS) (this command copies the viewer files to the dist folder so you can run the demo) |
| 11 | +7. npm run start |
| 12 | + |
| 13 | +## Use the showcase to test your changes of ngx-extended-pdf-viewer |
| 14 | +Follow the recipe above first to install your local copy of ngx-extended-pdf-viewer. |
| 15 | + |
| 16 | +1. cd embedded-pdf |
| 17 | +2. git clone https://github.com/stephanrauh/extended-pdf-viewer-showcase |
| 18 | +3. cd extended-pdf-viewer-showcase |
| 19 | +4. npm install |
| 20 | +5. cd .. |
| 21 | +6. cd ngx-extended-pdf-viewer |
| 22 | +7. npm run showcase |
| 23 | +8. cd .. |
| 24 | +9. cd extended-pdf-viewer-showcase |
| 25 | +10. ng serve -o |
| 26 | + |
| 27 | +Instead of changing the directory all the time, you can also open multiple terminal windows. The showcase updates automatically each time you execute `npm run showcase`. |
| 28 | + |
| 29 | +## Build ngx-extended-pdf-viewer with a custom version of pdf.js |
| 30 | +I assume you've already followed the first recipe above. |
| 31 | + |
| 32 | +1. cd embedded-pdf |
| 33 | +3. git clone https://github.com/stephanrauh/pdf.js.git |
| 34 | +4. mv pdf.js mypdf.js (or rename pdf.js mypdf.js if you're using Windows) |
| 35 | +5. cd mypdf.js |
6 | 36 | 6. npm install -g gulp-cli |
7 | 37 | 7. npm install |
8 | | -8. gulp server (steps 9 - 11 only check if the installation went well) |
9 | | -9. open http://localhost:8888/web/viewer.html |
| 38 | +8. gulp server (steps 9 - 11 are not necessary; they only check if the installation is healthy) |
| 39 | +9. open http://localhost:8888/web/viewer.html. Note that the source-code version of pdf.js is a lot slower than the production version. It takes a while until the PDF file shows. |
10 | 40 | 10. stop the server (CTRL+C) |
11 | | -11. gulp generic |
12 | | -12. cd .. |
13 | | -13. cd ngx-extended-pdf-viewer |
14 | | -14. sh ./updateMozillasPdfViewer.sh |
15 | | -15. examine the history of https://github.com/mozilla/pdf.js/blob/master/web/viewer.html and copy the changes to ngx-extended-pdf-viewer.component.html. Warning: ngx-extended-pdf-viewer.component.html has a lot of additions to the original file. Proceed with care. |
16 | | - |
17 | | -16. npm run win-package (or npm run unix-package, depending on your OS) (this command copies the viewer files to the dist folder so you can run the demo) |
18 | | -17. ng serve |
19 | | - |
20 | | -Note to myself: to deploy the library on npm, change to the folder `dist/ngx-extended-pdf-viewer` and run `npm publish` from there. Or: run `npm run unix-package` followed by `npm run release`. |
| 41 | +11. cd .. |
| 42 | +12. cd ngx-extended-pdf-viewer |
| 43 | +13. sh ./updateMozillasPdfViewer.sh |
| 44 | +14. npm run win-package (or npm run unix-package, depending on your OS) (this command copies the viewer files to the dist folder so you can run the demo) |
| 45 | +15. npm run start |
0 commit comments