Bug 690377

Summary: Error: /configurationerror in --setpagedevice--
Product: Ghostscript Reporter: serge gubenko <serge_gubenko>
Component: PDF InterpreterAssignee: Alex Cherepanov <alex>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P4    
Version: 8.64   
Hardware: PC   
OS: Windows XP   
Customer: Word Size: ---
Attachments: file which had an error
gs_setpd.ps

Description serge gubenko 2009-04-03 08:48:19 UTC
I'm trying to open a pdf file with ghost script and having the subj error

Here's the command line I'm using:
gswin32c -dSAFAER -dBATCH test_13.pdf

Here's what gs returns to me:

Processing pages 1 through 1.
Page 1
Error: /configurationerror in --setpagedevice--
Additional information: [/PageSize [2464 3228]]
Operand stack:
   --nostringval--   --dict:5/5(L)--   --dict:6/6(L)--
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval-
-   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   fa
lse   1   %stopped_push   1862   1   3   %oparray_pop   1861   1   3   %oparray_
pop   1845   1   3   %oparray_pop   --nostringval--   --nostringval--   2   1
1   --nostringval--   %for_pos_int_continue   --nostringval--   1830   3   7   %
oparray_pop   --nostringval--   --nostringval--   --dict:8/10(L)--   --nostringv
al--   10   %dict_continue
Dictionary stack:
   --dict:1150/1684(ro)(G)--   --dict:1/20(G)--   --dict:74/200(L)--   --dict:74
/200(L)--   --dict:106/127(ro)(G)--   --dict:278/300(ro)(G)--   --dict:21/25(L)-
-
Current allocation mode is local
GPL Ghostscript 8.64: Unrecoverable error, exit code 1
Comment 1 serge gubenko 2009-04-03 08:49:26 UTC
Created attachment 4892 [details]
file which had an error
Comment 2 serge gubenko 2009-04-03 08:50:39 UTC
This file was opened successfully with Adobe Reader
Comment 3 Alex Cherepanov 2009-04-03 12:26:25 UTC
I cannot reproduce this. Please provide more information about
your system and your copy of Ghostscript.
- do you have 32 or 64 bit system ?
- have you installed a binary distribution or compiled from sources ?
- can you run the sample file on other systems ?
Comment 4 serge gubenko 2009-04-03 14:04:17 UTC
- I have 32bit WinXP. 
- I've installed the binary distribution for gs 8.64.
- Can check it on 32bit Windows Server 2003 if needed.
Comment 5 serge gubenko 2009-04-03 14:15:23 UTC
Created attachment 4893 [details]
gs_setpd.ps
Comment 6 serge gubenko 2009-04-03 14:18:48 UTC
Sorry, I found the problem, I have custom gs_setpd.ps to restrict the page size 
to 1728 pixels. Is this possible to configure gs to scale the image if it's 
bigger then given size?
Comment 7 Ray Johnston 2009-04-03 17:25:12 UTC
Ghostscript follows the PLRM-3rd edition as to how PageSize matching is
performed, including choosing the media from the InputAttributes dictionary
according to a fit withing +/- 5 points possibly with rotation to fit.

If no page size is close enough, then the 'Policies' dict of the page device
come into play. A PageSize policy value of 3 scales down pages that are too
large for the largest PageSize and centers smaller pages on the closest larger
PageSize.

The syntax for this in a setpagedevice dictionary is:

   << /Policies << /PageSize 3 >> >> setpagedevice

I hope this helps.
Comment 8 Alex Cherepanov 2009-04-04 06:56:33 UTC
The following prefix removes all predefined input attributes and
sets a single variable media size from the modified gs_setpd.ps .

Under policy 3, this makes media matching algorithm to scale down the
input page size to the media size. Please note that all media attributes
are replaced; modified gs_setpd.ps is not needed.

<< currentpagedevice /InputAttributes get
0 1 2 index length 1 sub {1 index exch undef } for
/InputAttributes exch dup 0 <</PageSize [0 0 612 1728]>> put
/Policies << /PageSize 3 >> >> setpagedevice

Run the prefix before your file as:

gswin32c prefix.ps foo.pdf

In any case, this is not a bug in Ghostscript.
Comment 9 serge gubenko 2009-04-04 09:29:52 UTC
Thank you very much for your help, I apologize for inconvenience, the issue was
in my settings not in gs itself.