summaryrefslogtreecommitdiff
path: root/platform/java/src
diff options
context:
space:
mode:
Diffstat (limited to 'platform/java/src')
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/Document.java38
-rw-r--r--platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java25
2 files changed, 26 insertions, 37 deletions
diff --git a/platform/java/src/com/artifex/mupdf/fitz/Document.java b/platform/java/src/com/artifex/mupdf/fitz/Document.java
index 1fc21c13..52010a02 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/Document.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/Document.java
@@ -11,7 +11,8 @@ public class Document
public static final String META_INFO_AUTHOR = "info:Author";
public static final String META_INFO_TITLE = "info:Title";
- private long pointer;
+ protected long pointer;
+ protected String path; /* for proofing */
protected native void finalize();
@@ -20,23 +21,21 @@ public class Document
pointer = 0;
}
- private native long newNativeWithPath(String filename);
- private native long newNativeWithBuffer(byte buffer[], String magic);
- // private native long newNativeWithRandomAccessFile(RandomAccessFile file, String magic);
-
- private String mPath=null;
- public String getPath() {return mPath;}
- public Document(String filename) {
- mPath = filename;
- pointer = newNativeWithPath(filename);
+ protected Document(long p) {
+ pointer = p;
}
- public Document(byte buffer[], String magic) {
- pointer = newNativeWithBuffer(buffer, magic);
+ protected native static Document openNativeWithPath(String filename);
+ protected native static Document openNativeWithBuffer(byte buffer[], String magic);
+
+ public static Document openDocument(String filename) {
+ Document doc = openNativeWithPath(filename);
+ doc.path = filename;
+ return doc;
}
- private Document(long p) {
- pointer = p;
+ public static Document openDocument(byte buffer[], String magic) {
+ return openNativeWithBuffer(buffer, magic);
}
public native boolean needsPassword();
@@ -54,17 +53,14 @@ public class Document
public native boolean isUnencryptedPDF();
- public native PDFDocument toPDFDocument();
-
public boolean isPDF() {
- return toPDFDocument() != null;
+ return false;
}
- public String makeProof (String currentPath, String printProfile, String displayProfile, int resolution)
- {
+ public String getPath() { return path; }
+ protected native String proofNative (String currentPath, String printProfile, String displayProfile, int resolution);
+ public String makeProof (String currentPath, String printProfile, String displayProfile, int resolution) {
String proofFile = proofNative( currentPath, printProfile, displayProfile, resolution);
return proofFile;
}
-
- public native String proofNative (String currentPath, String printProfile, String displayProfile, int resolution);
}
diff --git a/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java b/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java
index f866cb86..a925ac90 100644
--- a/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java
+++ b/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java
@@ -1,27 +1,21 @@
package com.artifex.mupdf.fitz;
-public class PDFDocument
+public class PDFDocument extends Document
{
- static {
- Context.init();
- }
-
- private long pointer;
-
- protected native void finalize();
+ private static native long newNative();
- public void destroy() {
- finalize();
- pointer = 0;
+ protected PDFDocument(long p) {
+ super(p);
}
- private PDFDocument(long p) {
- pointer = p;
+ public PDFDocument() {
+ super(newNative());
}
- public native Document toDocument();
+ public boolean isPDF() {
+ return true;
+ }
- public native int countPages();
public native PDFObject findPage(int at);
public native PDFObject getTrailer();
@@ -102,5 +96,4 @@ public class PDFDocument
public native boolean hasUnsavedChanges();
public native boolean canBeSavedIncrementally();
public native int save(String filename, String options);
-
}