Bug 697223 - Errors (ICC) when processing pdf file
Summary: Errors (ICC) when processing pdf file
Status: RESOLVED INVALID
Alias: None
Product: Ghostscript
Classification: Unclassified
Component: General (show other bugs)
Version: 9.18
Hardware: PC Linux
: P4 normal
Assignee: Default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-10-20 04:14 UTC by Sasa Friedrich
Modified: 2019-06-19 12:31 UTC (History)
0 users

See Also:
Customer:
Word Size: ---


Attachments
test file used by ghostscript (12.64 MB, application/pdf)
2016-10-20 04:14 UTC, Sasa Friedrich
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sasa Friedrich 2016-10-20 04:14:08 UTC
Created attachment 13029 [details]
test file used by ghostscript

I'm getting those errors processing file with ghostscript 9.18 (Ubuntu 16.04). I'm filing bug because on my old system (Ubuntu 12.04 - GS 9.05) this file is processed with no errors.

And I'm assuming this is the case why I get blank pages when printing this file on 16.04 (GS 9.18) system whereas same file is printed fine on 12.04 system (GS 9.05)

I tried to recompile 9.20 version from source and result is same.



gs -o repaired.pdf -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress test.pdf

GPL Ghostscript 9.18 (2015-10-05)
Copyright (C) 2015 Artifex Software, Inc.  All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 40.
Page 1
Page 2
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
Page 3
Page 4
Page 5
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 6
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 7
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 8
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 9
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 10
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 11
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 12
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 13
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 14
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 15
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 16
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 17
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 18
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 19
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 20
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 21
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 22
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 23
Querying operating system for font files...
Substituting font Helvetica for NimbusSanNovDBla.
Loading NimbusSanL-Reg font from /usr/share/ghostscript/9.18/Resource/Font/NimbusSanL-Reg... 9075084 7584279 7929132 6261263 3 done.
Page 24
Substituting font Helvetica for NimbusSanNovDBla.
Page 25
Substituting font Helvetica for NimbusSanNovDBla.
Page 26
Substituting font Helvetica for ArialMT.
Substituting font Courier for CourierNewPSMT.
Loading NimbusMono-Regular font from /usr/share/ghostscript/9.18/Resource/Font/NimbusMono-Regular... 10139536 8712804 7603276 5913871 3 done.
Substituting font Times-Bold for TimesNewRomanPS-BoldMT.
Loading NimbusRomNo9L-Med font from /usr/share/ghostscript/9.18/Resource/Font/NimbusRomNo9L-Med... 10256736 8902094 7683676 6000707 3 done.
Substituting font Helvetica for NimbusSanNovDBla.
Page 27
Substituting font Helvetica for NimbusSanNovDBla.
Page 28
Substituting font Helvetica for ArialMT.
Substituting font Helvetica for NimbusSanNovDBla.
Page 29
Substituting font Helvetica for NimbusSanNovDBla.
Page 30
Substituting font Helvetica for NimbusSanNovDBla.
Page 31
Substituting font Courier for CourierNewPSMT.
Substituting font Helvetica for ArialMT.
Substituting font Helvetica for NimbusSanNovDBla.
Page 32
Substituting font Helvetica for ArialMT.
Substituting font Helvetica for NimbusSanNovDBla.
Page 33
Substituting font Helvetica for NimbusSanNovDBla.
Page 34
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 35
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 36
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 37
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 38
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.
Page 39
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
   **** File did not complete the page properly and may be damaged.
Page 40
   **** Warning: ICCbased space /N value does not match the ICC profile.
                 Using the number of channles from the profile.
| ./base/gsicc.c:407: gx_remap_ICC(): Could not create ICC link:  Check profiles
   **** Error reading a content stream. The page may be incomplete.
   **** Illegal; Executing Do inside a text block, attempting to recover
   **** File did not complete the page properly and may be damaged.

   **** This file had errors that were repaired or ignored.
   **** Please notify the author of the software that produced this
   **** file that it does not conform to Adobe's published PDF
   **** specification.
Comment 1 Ken Sharp 2016-10-20 04:43:19 UTC
Well, fundamentally your PDF file is broken. It uses ICCBased colour spaces, and the number of declared components in the colour space doesn't match the actual content of the ICC profile.

Eg:

516 0 obj
<<
  /N 1
  /Length 1200
>>
stream

But the stream contents indicate this is an RGB ICC profile.

So which should we use ?

Previously we would throw away the profile and use the number of components to select a device profile. Clearly this won't be correct because a 3-component ICC colour space need not be RGB.

Now we ignore the number of components in the colour space definition and use the actual ICC profile instead. However, if the ICC profile should turn out to be illegal, we still fall back to the number of components.

At least some of the profiles embedded in your PDF file apparently aren't legal. causing this behaviour, others appear like they might be legal, but result in invalid colours.

Note that opening your file with Adobe Acrobat (which is well known for ignoring errors in PDF files) results in an error on page2.

It 'looks like' the reason this 'worked' with old versions of Ghostscript is simply because they didn't use the ICC profiles at all. They just used the number of components in the colour space definition and hoped for the best. In short your file was rendered incorrectly previously, but it was 'close enough' so you didn't notice there was a problem.

Now we do use the ICC profiles, and so your PDF file is revealed as broken.

I notice that the PDF creating application is apparently too embarrassed even to put its name in the Info dictionary.

Where is a bug here, but its not in Ghostscript.
Comment 2 Sasa Friedrich 2019-06-19 10:17:48 UTC
(In reply to Ken Sharp from comment #1)

> It 'looks like' the reason this 'worked' with old versions of Ghostscript is
> simply because they didn't use the ICC profiles at all. They just used the
> number of components in the colour space definition and hoped for the best.
> In short your file was rendered incorrectly previously, but it was 'close
> enough' so you didn't notice there was a problem.
> 
> Now we do use the ICC profiles, and so your PDF file is revealed as broken.
> 

Is there a way to force GS to process file in "old way" (ignore ICC profiles)?
Comment 3 Ken Sharp 2019-06-19 12:31:31 UTC
(In reply to Sasa Friedrich from comment #2)

> Is there a way to force GS to process file in "old way" (ignore ICC
> profiles)?

No.