summaryrefslogtreecommitdiff
path: root/source/tools/murun.c
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-11-15 16:10:03 +0100
committerTor Andersson <tor.andersson@artifex.com>2016-11-16 12:09:20 +0100
commitfa9cd67527ab9994fec917f0f88fc16abb9926a6 (patch)
tree9f533a52350e32b0d778c158fbb4eafbe0d0d12e /source/tools/murun.c
parent5ed7e6c29233874a68733cdf075260fe261caa40 (diff)
downloadmupdf-fa9cd67527ab9994fec917f0f88fc16abb9926a6.tar.xz
pdf: Add 'compressed/raw' flag to pdf_add_stream.
Also expose the argument to JS and JNI.
Diffstat (limited to 'source/tools/murun.c')
-rw-r--r--source/tools/murun.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/source/tools/murun.c b/source/tools/murun.c
index 7d26c49c..8ba003b6 100644
--- a/source/tools/murun.c
+++ b/source/tools/murun.c
@@ -3055,7 +3055,7 @@ static void ffi_PDFDocument_addObject(js_State *J)
ffi_pushobj(J, ind);
}
-static void ffi_PDFDocument_addStream(js_State *J)
+static void ffi_PDFDocument_addStream_imp(js_State *J, int compressed)
{
fz_context *ctx = js_getcontext(J);
pdf_document *pdf = js_touserdata(J, 0, "pdf_document");
@@ -3064,7 +3064,7 @@ static void ffi_PDFDocument_addStream(js_State *J)
pdf_obj *ind;
fz_try(ctx)
- ind = pdf_add_stream(ctx, pdf, buf, obj);
+ ind = pdf_add_stream(ctx, pdf, buf, obj, compressed);
fz_always(ctx) {
fz_drop_buffer(ctx, buf);
pdf_drop_obj(ctx, obj);
@@ -3074,6 +3074,16 @@ static void ffi_PDFDocument_addStream(js_State *J)
ffi_pushobj(J, ind);
}
+static void ffi_PDFDocument_addStream(js_State *J)
+{
+ ffi_PDFDocument_addStream_imp(J, 0);
+}
+
+static void ffi_PDFDocument_addRawStream(js_State *J)
+{
+ ffi_PDFDocument_addStream_imp(J, 1);
+}
+
static void ffi_PDFDocument_addImage(js_State *J)
{
fz_context *ctx = js_getcontext(J);
@@ -4358,7 +4368,8 @@ int murun_main(int argc, char **argv)
jsB_propfun(J, "PDFDocument.createObject", ffi_PDFDocument_createObject, 0);
jsB_propfun(J, "PDFDocument.deleteObject", ffi_PDFDocument_deleteObject, 1);
jsB_propfun(J, "PDFDocument.addObject", ffi_PDFDocument_addObject, 1);
- jsB_propfun(J, "PDFDocument.addStream", ffi_PDFDocument_addStream, 1);
+ jsB_propfun(J, "PDFDocument.addStream", ffi_PDFDocument_addStream, 2);
+ jsB_propfun(J, "PDFDocument.addRawStream", ffi_PDFDocument_addRawStream, 2);
jsB_propfun(J, "PDFDocument.addSimpleFont", ffi_PDFDocument_addSimpleFont, 1);
jsB_propfun(J, "PDFDocument.addFont", ffi_PDFDocument_addFont, 1);
jsB_propfun(J, "PDFDocument.addImage", ffi_PDFDocument_addImage, 1);