sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.35k stars 1.7k forks source link

PDF/A conformance #640

Closed hafedh-trimeche closed 7 years ago

hafedh-trimeche commented 7 years ago

Using pdf_open_document_with_stream and pdf_write_document functions , the stream objects are written to the document without inserting necessary EOL/CR/LF to be compliant with PDF/A.

Is there a way to make stream object compliant with PDF/A ?

mu.pdf

Validation Report.pdf


The file used as input to pdf_open_document_with_stream is one witch is PDF/A compliant and generated with Ghostscript converter and has all stream objects framed with EOL character (x0A).

After using these 2 function, the output is modified as that object stream no longer have content ended with EOL RawPDFA.pdf

hafedh-trimeche commented 7 years ago

copystream and expandstream functions would be modified allowing insertion of an EOL character after the stream content. fprintf(opts->out, "%d %d obj\n", num, gen); pdf_fprint_obj(opts->out, obj, opts->do_expand == 0); fprintf(opts->out, "stream\n"); fwrite(buf->data, 1, buf->len, opts->out); fprintf(opts->out, "\n"); fprintf(opts->out, "endstream\nendobj\n\n"); or fprintf(opts->out, "\nendstream\nendobj\n\n");

kjk commented 7 years ago

How is it related to Sumatra? Sumatra is a viewer for PDF files, we don't create them.

If this is a mupdf bug, you should report it to mupdf devs: http://mupdf.com/

hafedh-trimeche commented 7 years ago

Please note that the original code from MuPDF handles well stream writing by using this code

http://mupdf.com/downloads/mupdf-1.9a-source.tar.gz

static void copystream(fz_context ctx, pdf_document doc, pdf_write_state opts, pdf_obj obj_orig, int num, int gen, int do_deflate) ... fz_printf(ctx, opts->out, "%d %d obj\n", num, gen); pdf_print_obj(ctx, opts->out, obj, opts->do_tight); fz_puts(ctx, opts->out, "\nstream\n"); fz_write(ctx, opts->out, buf->data, buf->len); if (buf->len > 0 && buf->data[buf->len-1] != '\n') fz_putc(ctx, opts->out, '\n');

fz_puts(ctx, opts->out, "endstream\nendobj\n\n");

Would the MuPDF code used by Sumatrapdf be updated accordingly?

kjk commented 7 years ago

We have lots of patches over mupdf so updating is not easy.

I still don't see how is this related to Sumatra. In what scenario does Sumatra calls this code?

hafedh-trimeche commented 7 years ago

MuPDF would be used as a PDF Writer and SumatraPDF already provides a 32/64 compiled binaries for Windows.

I'm using Delphi as development framework, so I intend to use libmupdf for digital signature (PAdES).

Best regards.

---- On Fri, 21 Oct 2016 20:16:28 +0100Krzysztof Kowalczyk <notifications@github.com> wrote ----

We have lots of patches over mupdf so updating is not easy.

I still don't see how is this related to Sumatra. In what scenario does Sumatra calls this code?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.