File tree Expand file tree Collapse file tree 4 files changed +51
-0
lines changed Expand file tree Collapse file tree 4 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ node_modules
2
+ npm-debug.log
Original file line number Diff line number Diff line change @@ -97,6 +97,20 @@ or to build it from source. We supply pre-built versions for usage with NPM and
97
97
the ` pdfjs-dist ` name. For more information and examples please refer to the
98
98
[ wiki page] ( https://github.com/mozilla/pdf.js/wiki/Setup-pdf.js-in-a-website ) on this subject.
99
99
100
+ ## Using PDF.js in docker
101
+ + Remove package ` "@jazzer.js/core" ` from ` package.json ` .
102
+ + In ` gulpfile.mjs ` add the line ` server.host='0.0.0.0' ` here:
103
+
104
+ ``` js
105
+ const { WebServer } = await import (" ./test/webserver.mjs" );
106
+ const server = new WebServer ({ port });
107
+ server .host = ' 0.0.0.0' ;
108
+ server .start ();
109
+ ```
110
+ + Build the docker image using ` mutagen-compose build`
111
+ + Start the docker container with ` mutagen-compose up pdfjs`
112
+ + Access server at ` http://localhost:8888/web/viewer.html`
113
+
100
114
## Including via a CDN
101
115
102
116
PDF .js is hosted on several free CDNs:
Original file line number Diff line number Diff line change
1
+ services :
2
+ pdfjs :
3
+ build : .
4
+ container_name : pdfjs_container
5
+ ports :
6
+ - " 8888:8888"
7
+ volumes :
8
+ - .:/app
9
+ - /app/node_modules
10
+ command : bash -c "gulp server"
Original file line number Diff line number Diff line change
1
+ FROM node:18
2
+
3
+ RUN useradd -r -m -d /app app
4
+ WORKDIR /app
5
+ COPY --chown=app:app ./ ./
6
+
7
+ RUN apt-get update && \
8
+ apt-get install -y --no-install-recommends \
9
+ libcairo2-dev \
10
+ libpango1.0-dev \
11
+ libjpeg-dev \
12
+ libgif-dev \
13
+ librsvg2-dev \
14
+ cmake \
15
+ python3 \
16
+ && rm -rf /var/lib/apt/lists/*
17
+
18
+ RUN npm install -g gulp-cli
19
+
20
+ RUN npm install
21
+
22
+ USER app
23
+
24
+ EXPOSE 8888
25
+ CMD ["gulp", "server", "--watch"]
You can’t perform that action at this time.
0 commit comments