From f4defeee497d21a211f83e7a8d2d6c2dcadca607 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Fri, 17 Feb 2017 15:09:20 +0100 Subject: Add no-reuse-images option to SVG device. Also add explicit viewBox and width/height to image symbol and use elements, to work around a strange clipping/image scaling issue with firefox. --- source/fitz/output-svg.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'source/fitz/output-svg.c') diff --git a/source/fitz/output-svg.c b/source/fitz/output-svg.c index 40260fae..f8711031 100644 --- a/source/fitz/output-svg.c +++ b/source/fitz/output-svg.c @@ -9,12 +9,14 @@ struct fz_svg_writer_s int count; fz_output *out; int text_format; + int reuse_images; }; const char *fz_svg_write_options_usage = "SVG output options:\n" "\ttext=text: Emit text as elements (inaccurate fonts).\n" "\ttext=path: Emit text as elements (accurate fonts).\n" + "\tno-reuse-images: Do not reuse images using definitions.\n" "\n" ; @@ -31,7 +33,7 @@ svg_begin_page(fz_context *ctx, fz_document_writer *wri_, const fz_rect *mediabo fz_format_output_path(ctx, path, sizeof path, wri->path, wri->count); wri->out = fz_new_output_with_path(ctx, path, 0); - return fz_new_svg_device(ctx, wri->out, w, h, wri->text_format); + return fz_new_svg_device(ctx, wri->out, w, h, wri->text_format, wri->reuse_images); } static void @@ -65,6 +67,7 @@ fz_new_svg_writer(fz_context *ctx, const char *path, const char *args) wri->super.drop_writer = svg_drop_writer; wri->text_format = FZ_SVG_TEXT_AS_PATH; + wri->reuse_images = 1; fz_try(ctx) { @@ -75,6 +78,9 @@ fz_new_svg_writer(fz_context *ctx, const char *path, const char *args) else if (fz_option_eq(val, "path")) wri->text_format = FZ_SVG_TEXT_AS_PATH; } + if (fz_has_option(ctx, args, "no-reuse-images", &val)) + if (fz_option_eq(val, "yes")) + wri->reuse_images = 0; wri->path = fz_strdup(ctx, path ? path : "out-%04d.svg"); } fz_catch(ctx) -- cgit v1.2.3