Skip to content

Commit a6e64cd

Browse files
committed
stephanrauh#415 updated the "how to build" walkthrough
1 parent 916d003 commit a6e64cd

File tree

2 files changed

+41
-32
lines changed

2 files changed

+41
-32
lines changed

README.md

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,5 @@ Bringing Mozilla's pdf.js to the Angular world. That's not only the core PDF vie
2020

2121
There's a showcase at <a href="https://pdfviewer.net">https://pdfviewer.net</a>. Check this page for live demos, source code examples, and a handbook.
2222

23-
24-
25-
Now the (tiny) demo app will automatically reload if you change any of the source files.
26-
2723
## Build or update the library from scratch
28-
If you want to use the library, install it via npm:
29-
30-
```
31-
npm i ngx-extended-pdf-viewer --save
32-
```
33-
34-
35-
If you want to send a pull request or if you're simply curious, there are two options:
36-
- Simple changes to the HTML or JavaScript code:
37-
- `npm run unix-package` (or `npm run win-package` if you're running Windows)
38-
- `ng serve -o` (to start the demo project)
39-
- Changes including the core library (pdf.js) itself:
40-
- see the [how-to-build walkthrough](projects/ngx-extended-pdf-viewer/how-to-build.md).
24+
See the [how-to-build walkthrough](projects/ngx-extended-pdf-viewer/how-to-build.md).
Lines changed: 40 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,45 @@
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
15
1. Create a new folder "embedded-pdf". It must be in the same folder as ngx-extended-pdf-viewer.
26
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
636
6. npm install -g gulp-cli
737
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.
1040
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

Comments
 (0)