diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2010-07-01 19:08:29 +0000 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2010-07-01 19:08:29 +0000 |
commit | 8bcd33402ccfd7163ed34cd34269bc2760937859 (patch) | |
tree | 91159363a42dcbcc986be0f151693e3243846c46 /gs/base/gdevpdfj.c | |
parent | 36aaf13c1472a03dacce62805758f93482fdb016 (diff) |
Enhancement (pdfwrite) : Fall back to Flate instead of JPEG when an image turns out
short.
Bug #691435 "any PDFSETTINGS besides /default gives dictfull error"
There are two problems; firstly when an error is encountered closing a filter the
error code (-1 or -2 usually) is returned and interpreted as a regular GS error,
resulting in ridiculous error messages. Modified to return ioerror instead.
Secondly, when an image terminates with insufficient data and pdfwrite is creating a
DCT encoded image, we can't complete the image. In this case try to fall back to the
simple Flate compressed stream instead.
No differences expected.
git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@11476 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs/base/gdevpdfj.c')
-rw-r--r-- | gs/base/gdevpdfj.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/gs/base/gdevpdfj.c b/gs/base/gdevpdfj.c index 72bfddf58..9b4a61428 100644 --- a/gs/base/gdevpdfj.c +++ b/gs/base/gdevpdfj.c @@ -605,7 +605,7 @@ pdf_choose_compression_cos(pdf_image_writer *piw, cos_stream_t *s[2], bool force l0 = cos_stream_length(s[0]); l1 = cos_stream_length(s[1]); - if (force && l0 <= l1) + if (force && l0 <= l1 || l1 == -1) k0 = 1; /* Use Flate if it is not longer. */ else { k0 = s_compr_chooser__get_choice( @@ -650,10 +650,10 @@ pdf_choose_compression(pdf_image_writer * piw, bool end_binary) status = s_close_filters(&piw->binary[0].strm, piw->binary[0].target); if (status < 0) - return status; + return gs_error_ioerror; status = s_close_filters(&piw->binary[1].strm, piw->binary[1].target); - if (status < 0) - return status; + if (status < 0) + s[1]->length = -1; } pdf_choose_compression_cos(piw, s, end_binary); return 0; |