summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilipp Knechtges <philipp-dev@knechtges.com>2017-08-28 12:32:34 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-08-31 13:44:17 +0200
commit86fabe06f451ec98eef6447417ffcdacc24904d2 (patch)
tree33135bc354313fd2bdf46e77a852c1844efbc760
parent04c0464e035d4a6d681d7fd2faaed625ee513846 (diff)
downloadmupdf-86fabe06f451ec98eef6447417ffcdacc24904d2.tar.xz
Always add newline before 'endstream' keyword for PDF/A compliance.
-rw-r--r--source/pdf/pdf-write.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c
index 79e7f958..d2ad560c 100644
--- a/source/pdf/pdf-write.c
+++ b/source/pdf/pdf-write.c
@@ -1688,9 +1688,7 @@ static void copystream(fz_context *ctx, pdf_document *doc, pdf_write_state *opts
pdf_print_obj(ctx, opts->out, obj, opts->do_tight);
fz_write_string(ctx, opts->out, "\nstream\n");
fz_write_data(ctx, opts->out, data, len);
- if (len > 0 && data[len-1] != '\n')
- fz_write_byte(ctx, opts->out, '\n');
- fz_write_string(ctx, opts->out, "endstream\nendobj\n\n");
+ fz_write_string(ctx, opts->out, "\nendstream\nendobj\n\n");
fz_drop_buffer(ctx, buf);
pdf_drop_obj(ctx, obj);
@@ -1753,9 +1751,7 @@ static void expandstream(fz_context *ctx, pdf_document *doc, pdf_write_state *op
pdf_print_obj(ctx, opts->out, obj, opts->do_tight);
fz_write_string(ctx, opts->out, "\nstream\n");
fz_write_data(ctx, opts->out, data, len);
- if (len > 0 && data[len-1] != '\n')
- fz_write_byte(ctx, opts->out, '\n');
- fz_write_string(ctx, opts->out, "endstream\nendobj\n\n");
+ fz_write_string(ctx, opts->out, "\nendstream\nendobj\n\n");
fz_drop_buffer(ctx, buf);
pdf_drop_obj(ctx, obj);