diff options
author | Tor Andersson <tor.andersson@artifex.com> | 2018-10-10 16:46:15 +0200 |
---|---|---|
committer | Tor Andersson <tor.andersson@artifex.com> | 2018-10-23 17:23:59 +0200 |
commit | 7b7b4de12bc50f97bd8fd32403319c6d1a758a90 (patch) | |
tree | 8fa91fb1c96fc1f46de8dddcbdca8b7671c5e3d0 /source/fitz/svg-device.c | |
parent | ca01073483cbb63a77e3cd2e39993c7dd26fe856 (diff) | |
download | mupdf-7b7b4de12bc50f97bd8fd32403319c6d1a758a90.tar.xz |
Allow SVG output to keep ID numbers unique across pages.
This is required if embedding multiple SVG documents in a web page,
for example.
Diffstat (limited to 'source/fitz/svg-device.c')
-rw-r--r-- | source/fitz/svg-device.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index d0d9f50e..7d2c7ee3 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -53,6 +53,7 @@ struct svg_device_s fz_buffer *defs_buffer; int def_count; + int *save_id; int id; int num_tiles; @@ -1196,6 +1197,9 @@ svg_dev_close_device(fz_context *ctx, fz_device *dev) sdev->layers--; } + if (sdev->save_id) + *sdev->save_id = sdev->id; + fz_write_printf(ctx, out, "</svg>\n"); } @@ -1221,7 +1225,7 @@ svg_dev_drop_device(fz_context *ctx, fz_device *dev) fz_free(ctx, sdev->images); } -fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height, int text_format, int reuse_images) +fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, float page_height, int text_format, int reuse_images, int *id) { svg_device *dev = fz_new_derived_device(ctx, svg_device); @@ -1261,7 +1265,8 @@ fz_device *fz_new_svg_device(fz_context *ctx, fz_output *out, float page_width, dev->out = out; dev->out_store = out; - dev->id = 0; + dev->save_id = id; + dev->id = id ? *id : 0; dev->layers = 0; dev->text_as_text = (text_format == FZ_SVG_TEXT_AS_TEXT); dev->reuse_images = reuse_images; |