[Postscript] If the page size is not set correctly, there will be a PostScript error "configurationerror"

RESOLVED INVALID

Status

()

defect
RESOLVED INVALID
15 years ago
13 years ago

People

(Reporter: leon.sha, Assigned: leon.sha)

Tracking

Trunk
x86
Linux
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(3 attachments, 1 obsolete attachment)

Assignee

Description

15 years ago
If the page size is not set correctly, there will be a PostScript error
"configurationerror"

ERROR: configurationerror
OFFENDING COMMAND: setpagedevice.

STACK:

-dictionary-
Assignee

Comment 1

15 years ago
Posted patch PatchSplinter Review
I use "<<" here. This is a postscript level 2 operator.
But If the postscript interpreters only support level 1, it will not have
"setpagedevice". This part of postscript code will not be used by postscript
level 1 interpreters.
Attachment #175413 - Flags: review?(kherron+mozilla)
Assignee

Updated

15 years ago
Assignee: printing → leon.sha

Comment 2

15 years ago
Comment on attachment 175413 [details] [diff] [review]
Patch

>   // Tell the printer what size paper it should use
>   fprintf(f,
>     "/setpagedevice where\n"			// Test for the feature
>-    "{ pop 1 dict\n"				// Set up a dictionary
>-    "  dup /PageSize [ %s %s ] put\n"		// Paper dimensions
>-    "  setpagedevice\n"				// Install settings
>+    "{ <<\n"

You need a "pop" here, as in the original. The "where" operator pushes a
dictionary on the stack which has to be removed.


>+    "  /PageSize [ %s %s ]\n"			// Paper dimensions
>+    "  /Policies <<\n"
>+    "  /PolicyNotFound 1\n"			// Ignore the wrong request

"PolicyNotFound" sets the default error handling policy. The patch sets an
explicit policy for PageSize errors, so setting the default policy isn't
necessary, is it? I'd rather be conservative and leave that out, particularly
given that we're in beta right now.

r=kherron provided you fix these. If you feel strongly about PolicyNotFound, we
can talk about it.
Attachment #175413 - Flags: review?(kherron+mozilla) → review+
Assignee

Comment 3

15 years ago
Attachment #175792 - Flags: superreview?(roc)
Assignee

Comment 4

15 years ago
(In reply to comment #2)
> (From update of attachment 175413 [details] [diff] [review] [edit])
> >   // Tell the printer what size paper it should use
> >   fprintf(f,
> >     "/setpagedevice where\n"			// Test for the feature
> >-    "{ pop 1 dict\n"				// Set up a dictionary
> >-    "  dup /PageSize [ %s %s ] put\n"		// Paper dimensions
> >-    "  setpagedevice\n"				// Install settings
> >+    "{ <<\n"
> 
> You need a "pop" here, as in the original. The "where" operator pushes a
> dictionary on the stack which has to be removed.
> 
> 
> >+    "  /PageSize [ %s %s ]\n"			// Paper dimensions
> >+    "  /Policies <<\n"
> >+    "  /PolicyNotFound 1\n"			// Ignore the wrong request
> 
> "PolicyNotFound" sets the default error handling policy. The patch sets an
> explicit policy for PageSize errors, so setting the default policy isn't
> necessary, is it? I'd rather be conservative and leave that out, particularly
> given that we're in beta right now.
> 
> r=kherron provided you fix these. If you feel strongly about PolicyNotFound, we
> can talk about it.
> 

Yes, you are right.
Attachment #175792 - Flags: superreview?(roc) → superreview+
Assignee

Comment 5

15 years ago
Checking in nsPostScriptObj.cpp;
/cvsroot/mozilla/gfx/src/ps/nsPostScriptObj.cpp,v  <--  nsPostScriptObj.cpp
new revision: 1.118; previous revision: 1.117
done
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Assignee

Comment 6

15 years ago
(In reply to comment #1)
> Created an attachment (id=175413) [edit]
> Patch
> 
> I use "<<" here. This is a postscript level 2 operator.
> But If the postscript interpreters only support level 1, it will not have
> "setpagedevice". This part of postscript code will not be used by postscript
> level 1 interpreters.

https://bugzilla.mozilla.org/show_bug.cgi?id=234182#c11
It is very strange that when I use this method to test postscript language
level, gs give me an error.

---------------------
Error: /syntaxerror in -file-
Operand stack:
   false
---------------------

Is that to say that I can not use "<<" and ">>" even in "{}"?
Should I change this or it is just a gs's bug?

Assignee

Comment 7

15 years ago
> Is that to say that I can not use "<<" and ">>" even in "{}"?
> Should I change this or it is just a gs's bug?
> 

I am wrong.
In the PostScript® LANGUAGE REFERENCE third edition page 783/912 d.3.4, there is
the warning. 

"If a program containing these constructs is sent to a LanguageLevel 1
interpreter, a syntaxerror will occur, even if the constructs appear only inside
procedures that are to be executed conditionally according to LanguageLevel."

Assignee

Comment 8

15 years ago
Assignee

Updated

15 years ago
Attachment #176715 - Flags: superreview?(roc)
Attachment #176715 - Flags: review?(kherron+mozilla)

Comment 9

15 years ago
Comment on attachment 176715 [details] [diff] [review]
Use (<<) cvx exec to replace <<


>     "/setpagedevice where\n"			// Test for the feature
>     "{ pop\n"
>-    "  <<\n"
>+    "  (<<) cvx exec\n"
>     "  /PageSize [ %s %s ]\n"			// Paper dimensions
>-    "  /Policies <<\n"
>+    "  /Policies (<<) cvx exec\n"
>     "  /PageSize 3\n"				// Select the nearest page size to fit
>-    "  >>\n"
>-    "  >> setpagedevice\n"				// Install settings
>+    "  (>>) cvx exec\n"
>+    "  (>>) cvx exec\n"
>+    "  setpagedevice\n"

I'm inclined to just go back to the level 1 syntax. It has fewer operators,
uses less stack, and IMHO is a little cleaner.

/setpagedevice where
{ pop 2 dict
  dup /PageSize [ %s %s ] put
  dup /Policies 1 dict
    dup /PageSize 3 put
  put
  setpagedevice
} if
Assignee

Comment 10

15 years ago
Yes Ken, you are correct.
Attachment #176857 - Flags: superreview?(roc)
Attachment #176857 - Flags: review?(kherron+mozilla)

Updated

15 years ago
Attachment #176857 - Flags: review?(kherron+mozilla) → review+

Updated

15 years ago
Attachment #176715 - Attachment is obsolete: true
Attachment #176715 - Flags: superreview?(roc)
Attachment #176715 - Flags: review?(kherron+mozilla)
Attachment #176857 - Flags: superreview?(roc) → superreview+
Assignee

Comment 11

15 years ago
Fix checked in.

Comment 12

14 years ago
(In reply to comment #9)
>     "  /PageSize 3\n"		// Select the nearest page size to fit

This change seems to have caused bug 324635.
Assignee

Comment 13

13 years ago
Because of the bug 324635, user or printer driver should take care of the page size by itself. I'll mark this bug as invalid.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee

Updated

13 years ago
Status: REOPENED → RESOLVED
Closed: 15 years ago13 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.