-
First, execute all steps in the How to compile section
-
Get Emscripten SDK:
python3 make.py build-emsdk
-
Execute EMSDK environment file "emsdk_env" according to your system.
-
Get PDFium:
python3 make.py build-pdfium-wasm
-
Patch:
python3 make.py patch-wasm
-
PDFium Linux dependencies
./build/wasm32/pdfium/build/install-build-deps.sh
-
Compile:
python3 make.py build-wasm
-
Install libraries:
python3 make.py install-wasm
-
Test:
python3 make.py test-wasm
-
Generate javascript libraries:
python3 make.py generate-wasm
Obs:
- The file make.py need be executed with python version 3.
- You need run all steps in a Linux machine (real, vm or docker) to it works.
- With docker you can skip steps 2 and 3.
You can use docker to build and test on local machine before deploy.
Build the image with command:
docker build -t pdfium-wasm -f docker/wasm/Dockerfile docker/wasm
Test with command:
docker run -v ${PWD}:/app -it pdfium-wasm echo "test"
Now you can execute any command with pattern:
docker run -v ${PWD}:/app -it pdfium-wasm [COMMAND]
If you are in a macOS with arm64 processors (M*), build with command:
docker build --platform linux/amd64 -t pdfium-wasm -f docker/wasm/Dockerfile docker/wasm
and
docker run --platform linux/amd64 -v ${PWD}:/app -it pdfium-wasm echo "test"
You can test the sample using commands:
python3 make.py test-wasm
python3 -m http.server --directory sample-wasm/build
or with docker you can use:
docker run -v ${PWD}:/app -it pdfium-wasm python3 make.py test-wasm
python3 -m http.server --directory sample-wasm/build
You can test the sample using commands:
python3 make.py test-wasm
node sample-wasm/build/index.js
or with docker you can use:
docker run -v ${PWD}:/app -it pdfium-wasm python3 make.py test-wasm
docker run -v ${PWD}:/app -it pdfium-wasm node sample-wasm/build/index.js
You can test pdfium on web browser here: