|
1 | | -PS-WASM: Rendering PostScript in browsers using GhostScript. |
| 1 | +# PS-WASM: Rendering PostScript in browsers using Ghostscript. |
2 | 2 |
|
3 | | -This little wrapper allows GhostScript to be run with WebAssembly in browser, |
| 3 | +This little wrapper allows Ghostscript to be run with WebAssembly in browser, |
4 | 4 | and thus allows PostScript files to be opened with modern browsers directly. |
5 | 5 |
|
6 | | -Currently only Chrome is supported. |
| 6 | +## Usage |
7 | 7 |
|
8 | | ------- |
| 8 | +1. Set up the EMScripten environmen following [this tutorial](https://webassembly.org/getting-started/developers-guide/). |
9 | 9 |
|
10 | | -August 2019: v0.2 updates: |
| 10 | +2. If compiling from latest git repo: set up `git`, `autoconf` and `automake`. |
11 | 11 |
|
12 | | -* Large files are now supported. |
13 | | -* PDF files can now be saved. |
14 | | -* Improved URL and title display. |
| 12 | +3. Run `./compile.sh` with the following parameters: |
15 | 13 |
|
16 | | ------- |
| 14 | +``` |
| 15 | +./compile.sh (--version=[latest|version.number]) (--browser=[chrome]) (--debug) (--skip_compile) |
| 16 | +``` |
| 17 | +where the parameters are as follows: |
| 18 | +* `--version`: specify `latest` to compile from latest [git source](https://github.com/ArtifexSoftware/ghostpdl), or a specific version number such as `10.05.0`. |
| 19 | + * Note: some versions (such as `10.05.1`) do compile but have bugs that prevent the program from running on certain files. Commit `dedddcb` of the git repo is the version used for the web store version of `v0.4` of this extension. |
| 20 | +* `--browser`: specify the target browser. Currently only `chrome` is supported. |
| 21 | +* `--debug`: compile the debug version, which prints a lot more info to the console. |
| 22 | +* `--skip_compile`: tell the script to assume the `.wasm` and `.js` files are already there and just pack the plugin. Useful for debugging. |
17 | 23 |
|
18 | | -Note on cross-compilation: |
| 24 | +4. The plugin is then located at `extension/(browser)/ps-wasm`. |
19 | 25 |
|
20 | | -Cross-compiling ghostscript was the nontrivial part of this project. |
| 26 | +## License |
21 | 27 |
|
22 | | -After obtaining the source code from the [source repository](https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs926/ghostscript-9.26.tar.gz), one needs to copy files in the "code_patch" folder into their respective places. |
| 28 | +Ocha 2025. Code licensed under AGPLv3. |
23 | 29 |
|
24 | | -One also needs to have the EMScripten environment set up; see [here](https://webassembly.org/getting-started/developers-guide/) for a tutorial. |
25 | | - |
26 | | -Then one can run the following command for setting up configure: |
27 | | - |
28 | | -`emconfigure ./configure --disable-threading --disable-cups --disable-dbus --disable-gtk --with-drivers=PS CC=emcc CCAUX=gcc --with-arch_h=~/ghostscript-9.26/arch/wasm.h` |
29 | | - |
30 | | -Followed by the following "make" command: |
31 | | - |
32 | | -`emmake make XE=".html" GS_LDFLAGS="-s ALLOW_MEMORY_GROWTH=1 -s EXIT_RUNTIME=1"` |
33 | | - |
34 | | -And one needs to copy everything from the "bin" folder to the extension folder. |
35 | | - |
36 | | -To include debugging information, instead use the following command, and look for results in "debugbin" (make sure you also copy the map files into the extension folder): |
37 | | - |
38 | | -`emmake make debug XE=".html" GS_LDFLAGS="-s ALLOW_MEMORY_GROWTH=1 -s EXIT_RUNTIME=1 -s ASSERTIONS=2 -g4"` |
39 | | - |
40 | | ------- |
41 | | - |
42 | | -Ocha 2019. Code licensed under AGPLv3. |
43 | | - |
44 | | -GhostScript is released by Artifex under AGPLv3 and can be found [here](https://www.ghostscript.com/). |
| 30 | +Ghostscript is released by Artifex under AGPLv3 and can be found [here](https://www.ghostscript.com/). |
45 | 31 |
|
46 | 32 | Pako is written by Andrey Tupitsin and Vitaly Puzrin and can found [here](https://github.com/nodeca/pako). |
0 commit comments