Mercurial > hgrepos > Python2 > PyMuPDF
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mupdf-source/docs/guide/using-with-java.md Mon Sep 15 11:43:07 2025 +0200 @@ -0,0 +1,44 @@ +# Using with Java + + +There is also a Java library, which uses JNI to provide access to the C +library. The Java classes provide an interface very similar to that available +to Javascript. This Java library also powers the Android versions of MuPDF. + +## Android + +If you want to build an application for Android, you have several options. You +can base it off one of the existing viewers, or build a new app using the Java +library directly. + +See the "Using with Android" section to get started using the MuPDF library for +Android. + +## Building + +Check out (or download) the MuPDF repository. + +The Java bindings are in the platform/java directory. + +You can build them using make: + + make java + +The resulting shared library are in build/java/release. You need to make sure +the Java runtime can find the JAR archive (with class-path) and the native +library (with java.library.path). + +To test the bindings you can use the Java shell: + + $ jshell --class-path=build/java/release -R-Djava.library.path=build/java/release + jshell> import com.artifex.mupdf.fitz.* + jshell> var doc = Document.openDocument("pdfref17.pdf") + jshell> System.out.println(doc.countPages()) + +## Examples + +There are several more examples in the Java directory. + +To build and run the example Swing viewer: + + make -C platform/java run
