Skip to content

Commit 6fb8629

Browse files
committed
Merge branch 'remove-print-download-open-buttons' of github.com:SharinPix/pdf.js into remove-print-download-open-buttons
2 parents 4f085db + 9a2a2a7 commit 6fb8629

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
npm-debug.log

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ or to build it from source. We supply pre-built versions for usage with NPM and
9797
the `pdfjs-dist` name. For more information and examples please refer to the
9898
[wiki page](https://github.com/mozilla/pdf.js/wiki/Setup-pdf.js-in-a-website) on this subject.
9999

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+
100114
## Including via a CDN
101115

102116
PDF.js is hosted on several free CDNs:

docker-compose.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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"

dockerfile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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"]

0 commit comments

Comments
 (0)