Skip to content

Ghostcript used to find the number of pages on output could fail #98

@l1gi

Description

@l1gi

Hello,

I have experienced ghostscript failure to produce expected output for my specific input document.

Error: /rangecheck in --getinterval--                                                                         
Operand stack:                                                                                                
   ClippedLabel   ()   0   -1                                                                                 
Execution stack:                                                                                              
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nost
ringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1933   1   3   %oparray_pop   1932
   1   3   %oparray_pop   1917   1   3   %oparray_pop   1787   1   3   %oparray_pop   --nostringval--   %error
exec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval
--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--   --nostringval--
   %loop_continue                                                                                             
Dictionary stack:                                                                                             
   --dict:745/1123(ro)(G)--   --dict:0/20(G)--   --dict:88/200(L)--   --dict:34/100(L)--   --dict:31/100(L)-- 
Current allocation mode is local                                                                              
Current file position is 15757                                                                                GPL Ghostscript 10.05.1: Unrecoverable error, exit code 1

It seems it is unable to generate output which cfFilterGhostscript() uses to cound the number of pages in the input document.

cupsfilters/ghostscript.c:
...
1032       // Ghostscript runs too long on files converted from djvu files                                    
1033       // Using -dDEVICEWIDTHPOINTS -dDEVICEHEIGHTPOINTS params solves the                                
1034       // problem                                                                                         
1035       snprintf(gscommand, 65536, "%s -q -dNOPAUSE -dBATCH -sDEVICE=bbox -dDEVICEWIDTHPOINTS=1 -dDEVICEHEI     GHTPOINTS=1 %s 2>&1 | grep -c HiResBoundingBox",                                                         
1036                CUPS_GHOSTSCRIPT, filename);
...

I have found well working alternative to this potentially problematic approach. It uses inkcov gs device. See the attached patch and consider merging it.

Thank you,
m.

gs.patch

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions