|
|
7 months ago | |
|---|---|---|
| .vs | 7 months ago | |
| Demo | 7 months ago | |
| MuPDFLib | 7 months ago | |
| Release | 7 months ago | |
| mupdf | 7 months ago | |
| mupdf_load_system_font | 7 months ago | |
| x64 | 7 months ago | |
| LICENSE | 7 months ago | |
| MuPDF.sln | 7 months ago | |
| README.md | 7 months ago |
Sharp MuPDF demonstrates how to compile MuPDF source code into a dynamic link library and consume its functionality in .NET.
To compile the source code.
Install Visual Studio 2019 or newer versions.
Install python 3 (Python.exe must be accessible via the PATH environment variable).
Open the MuPDF.sln in the solution folder with Visual Studio.
Compile the solution.
During compilation, Python will be called to generate the definition file for the target dll file.
Results:
MuPDFLib project will produce two DLL files for mupdf, one for x86 and the other for x64.
Demo project contains some code to demonstrate how to use functions in MuPDFLib.dll
In order to support loading system fonts for documents with unembedded fonts and avoid the performance lost across DLL files, a code file named mupdf_load_system_font.c shall be compiled with the libmupdf project.
We have to modify that project and reference the code file from MuPDFLib\Document\mupdf_load_system_font.c.
That code file is copied from project SumatraPDF and all credits goes to them.
The default compilation of MuPDFLib contains a large Unicode font TOFU.
Usually we don't need it. We can exclude it by the following procedure.
Open the property page for the libmupdf project.
Add ;TOFU;TOFU_CJK_EXT to C/C++/Preprocessor/Preprocessor Definitions for All Configurations and All Platforms in configuration manager.
For more information, see config.h file within the !include/fitz folder in libmupdf project.
There are several Python scripts in the folder of MuPDFLib. You can open and read the comment on top of the scripts to learn their usage.
Those scripts are run before compiling the MuPDFLib project automatically.
Especially, the modify_vcxprojs.py script should be run before compiling the libmupdf project, to make modifications about System font loading and Shrinking MuPDFLib.dll.
From version 2.* on, it is possible to reference MuPDFLib.dll as a .NET assembly, since it is compiled with C++/CLI.
If you redistribute the MuPDFLib.dll which is referenced as a .NET assembly in your application, your users may encounter a problem that the MuPDFLib.dll could not be loaded.
To fix the problem, enclose the Visual C++ Runtime library files with your redistribution. At least, vcruntime140.dll and msvcp140.dll are the minimum set of required DLL files.
Use git pull command to update the repository.
To update source code, tags and submodules, use:
cd mupdf
git pull origin master --recurse-submodules
It is possible that local modifications have been made. To discard local modifications when updating submodules, use the following command before pulling from master:
git reset --hard --recurse-submodules origin/master
git reset --hard --recurse-submodules <TAG>
To fetch remote tags, use:
git fetch origin --tags
Afterwards, it is possible to check out the newly added tags:
git checkout <TAG>
Alternatively, we can also execute the following commands against each changed files:
git reset HEAD <file name>
git checkout -- <file name>
We may see the following warning when we pull from master:
error: You have not concluded your merge (MERGE_HEAD exists).
hint: Please, commit your changes before merging.
fatal: Exiting because of unfinished merge.
To fix this, run the following commands:
git fetch --all
git reset --hard origin/master
Afterwards, we can pull from master then.
name-table.h file have slight modifications from the original one in the libmupdf project, for the sake of making field names valid in .NET. Check whether it is changed and make the corresponding synchronization. To facilitate this operation, run the sync_name_table.py script within the MuPDFLib project folder.If accessing the Internet requires HTTPS proxy, use the following command:
git config --global http.proxy <PROXY:PORT>
git config --global https.proxy <PROXY:PORT>
When you are done, use the following command to reset the proxy to default:
git config --global --unset http.proxy
git config --global --unset https.proxy
This project follows the license terms of MuPDF.