From 014fb58f887086ea34f74dcdb0d91dbec05966d1 Mon Sep 17 00:00:00 2001 From: Sebastian Rasmussen Date: Sun, 17 Jul 2016 16:55:17 +0800 Subject: JNI: When adding stream/page contents, accept String. This is for easy of use, in addition to accepting Buffer. --- .../src/com/artifex/mupdf/fitz/PDFDocument.java | 23 ++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) (limited to 'platform/java/src') diff --git a/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java b/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java index 58a3e3a6..c049d336 100644 --- a/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java +++ b/platform/java/src/com/artifex/mupdf/fitz/PDFDocument.java @@ -41,9 +41,28 @@ public class PDFDocument public native PDFObject createObject(); public native void deleteObject(int i); - public native PDFObject addStream(Buffer buf); + public native PDFObject addStreamBuffer(Buffer buf); + public native PDFObject addStreamString(String str); + + public PDFObject addStream(Buffer buf) { + return addStreamBuffer(buf); + } + + public PDFObject addStream(String str) { + return addStreamString(str); + } + + public native PDFObject addPageBuffer(Rect mediabox, int rotate, PDFObject resources, Buffer contents); + public native PDFObject addPageString(Rect mediabox, int rotate, PDFObject resources, String contents); + + public PDFObject addPage(Rect mediabox, int rotate, PDFObject resources, Buffer contents) { + return addPageBuffer(mediabox, rotate, resources, contents); + } + + public PDFObject addPage(Rect mediabox, int rotate, PDFObject resources, String contents) { + return addPageString(mediabox, rotate, resources, contents); + } - public native PDFObject addPage(Rect mediabox, int rotate, PDFObject resources, Buffer contents); public native void insertPage(int at, PDFObject page); public native void deletePage(int at); public native PDFObject addImage(Image image); -- cgit v1.2.3