|
| 1 | +# Sharp MuPDF |
| 2 | + |
| 3 | +Sharp MuPDF demonstats how to compile MuPDF source code into a dynamic link library and consume its functionality in .NET. |
| 4 | + |
| 5 | +## Compile |
| 6 | + |
| 7 | +To compile the source code. |
| 8 | + |
| 9 | +1. Install _Visual Studio 2019_ or newer versions. |
| 10 | + |
| 11 | +2. Install _python 3_ (`Python.exe` must be accessible via the PATH environment variable). |
| 12 | + |
| 13 | +3. Open the `MuPDF.sln` in the solution folder with Visual Studio. |
| 14 | + |
| 15 | +4. Compile the solution. |
| 16 | + |
| 17 | +5. During compilation, Python will be called to generate the definition file for the target dll file. |
| 18 | + |
| 19 | +6. Results: |
| 20 | + |
| 21 | + `MuPDFLib` project will produce two DLL files for mupdf, one for x86 and the other for x64. |
| 22 | + |
| 23 | + `Demo` project contains some code to demonstrate how to use functions in mupdflib.dll |
| 24 | + |
| 25 | +## Shrinking MuPDF.dll |
| 26 | + |
| 27 | +Open the property page for the `libmupdf` project. |
| 28 | + |
| 29 | +Add `;TOFU;TOFU_CJK_EXT` to _C/C++_/_Preprocessor_/_Preprocessor Definitions_ for _All Configurations_ and _All Platforms_ in configuration manager. |
| 30 | + |
| 31 | +So you can exclude several huge fonts from the DLL. |
| 32 | + |
| 33 | +## Update source code |
| 34 | + |
| 35 | +1. Use `git pull` command to update the repository. |
| 36 | + |
| 37 | +2. To update source code, tags and submodules, use |
| 38 | + |
| 39 | + ``` bash |
| 40 | + cd mupdf |
| 41 | + git pull origin master --recurse-submodules |
| 42 | + git checkout <TAG> |
| 43 | + ``` |
| 44 | + |
| 45 | + To discard local modifications when updating submodules, use the following command before `pull`ing from master |
| 46 | + |
| 47 | + ``` bash |
| 48 | + git reset --hard --recurse-submodules origin/master |
| 49 | + git reset --hard --recurse-submodules <TAG> |
| 50 | + ``` |
| 51 | + |
| 52 | +3. Check out whether the mupdf has upgraded to a new version. If so, change the FZ_VERSION before compiling the solution after update. |
| 53 | + |
| 54 | +## Git Proxy |
| 55 | +If accessing the Internet requires HTTPS proxy, use the following command: |
| 56 | + |
| 57 | +``` bash |
| 58 | +git config --global http.proxy <PROXY:PORT> |
| 59 | +git config --global https.proxy <PROXY:PORT> |
| 60 | +``` |
| 61 | + |
| 62 | +When you are done, use the following command to reset the proxy to default: |
| 63 | + |
| 64 | +``` bash |
| 65 | +git config --global --unset http.proxy |
| 66 | +git config --global --unset https.proxy |
| 67 | +``` |
| 68 | + |
| 69 | +## License |
| 70 | + |
| 71 | +This project follows the license terms of *MuPDF*. |
0 commit comments