Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/docs/guide/using-with-java.md @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 # Using with Java | |
| 2 | |
| 3 | |
| 4 There is also a Java library, which uses JNI to provide access to the C | |
| 5 library. The Java classes provide an interface very similar to that available | |
| 6 to Javascript. This Java library also powers the Android versions of MuPDF. | |
| 7 | |
| 8 ## Android | |
| 9 | |
| 10 If you want to build an application for Android, you have several options. You | |
| 11 can base it off one of the existing viewers, or build a new app using the Java | |
| 12 library directly. | |
| 13 | |
| 14 See the "Using with Android" section to get started using the MuPDF library for | |
| 15 Android. | |
| 16 | |
| 17 ## Building | |
| 18 | |
| 19 Check out (or download) the MuPDF repository. | |
| 20 | |
| 21 The Java bindings are in the platform/java directory. | |
| 22 | |
| 23 You can build them using make: | |
| 24 | |
| 25 make java | |
| 26 | |
| 27 The resulting shared library are in build/java/release. You need to make sure | |
| 28 the Java runtime can find the JAR archive (with class-path) and the native | |
| 29 library (with java.library.path). | |
| 30 | |
| 31 To test the bindings you can use the Java shell: | |
| 32 | |
| 33 $ jshell --class-path=build/java/release -R-Djava.library.path=build/java/release | |
| 34 jshell> import com.artifex.mupdf.fitz.* | |
| 35 jshell> var doc = Document.openDocument("pdfref17.pdf") | |
| 36 jshell> System.out.println(doc.countPages()) | |
| 37 | |
| 38 ## Examples | |
| 39 | |
| 40 There are several more examples in the Java directory. | |
| 41 | |
| 42 To build and run the example Swing viewer: | |
| 43 | |
| 44 make -C platform/java run |
