Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to execute some part of a postscript procedure instantly

56 views
Skip to first unread message

alamr...@gmail.com

unread,
Mar 9, 2013, 2:43:14 PM3/9/13
to Olavi Sakari, ma...@quark.com
Hi All,

I want to execute a small part of a procedure instantly. The procedure is to draw an image (large image) due to which i am getting a limitcheck error. So i decided to put the image data in an array or dictionary but not sure how to execute the data reading and storing part instantly (at the time of procedure definition).

Help from PostScript expert is highly appreciated.

Thanks & Regards
Md Raquib

luser- -droog

unread,
Mar 9, 2013, 9:17:13 PM3/9/13
to Olavi Sakari, ma...@quark.com
It's not entirely clear what you're trying to do. Can you post the whole error message that says 'limitcheck'? And are you using the 'image' operator, or drawing with lots of 'moveto' and 'lineto' and 'stroke's?

alamr...@gmail.com

unread,
Mar 10, 2013, 12:54:24 AM3/10/13
to Olavi Sakari, ma...@quark.com
Hi,

I am using image operator. If you need then i can provide you the whole PS file.

Kindly find below the detail error message.
"
%%[ Error: limitcheck; OffendingCommand: 0419F8FF0419F9FF0419F6FF0318EFFF0416F3FF0318F2FF0417F0FF041AF2FF0417EDFF0316F0FF0316ECFF0418EDFF0318E7FE0317E9FF0316E1FE0316E9F ]%%

Stack:
/PaintProc
19.41
/YStep
29.13
/XStep
[0 0 29.13 19.41]
/BBox
2
/TilingType
1
/PaintType
1
/PatternType
-mark-


%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%
"

luser- -droog

unread,
Mar 10, 2013, 1:27:14 AM3/10/13
to Olavi Sakari, ma...@quark.com
Ok. It looks like your dictionary isn't closed. You're missing a ">>".

And the limitcheck error isn't a memory problem, so don't worry about putting the data in an array or dictionary. The limitcheck is happening when the interpreter tries to execute your hex image data as postscript code, and the string is too long to be converted into a name. So this is just a symptom: it's not the real problem.

Hopefully closing the dictionary will solve it. Otherwise we'll need to see the whole code.

alamr...@gmail.com

unread,
Mar 10, 2013, 1:05:13 PM3/10/13
to Olavi Sakari, ma...@quark.com
Hi,
The dictionary has been closed properly. I did not find any option to attache the TestFile. I am sending you the same separately. Kindly note that i need the image data inside the pattern dictionary.

luser- -droog

unread,
Mar 10, 2013, 4:59:02 PM3/10/13
to Olavi Sakari, ma...@quark.com
On Saturday, March 9, 2013 1:43:14 PM UTC-6, alamr...@gmail.com wrote:
Here's the file with the image data truncated so we can see the code.


%!PS-Adobe-3.0
%APL_DSC_Encoding: UTF8
%%Setting current point
0 0 moveto
gsave
0 0 translate
0 124.48 moveto
360 124.48 lineto
360 0 lineto
0 0 lineto
closepath
clip
gsave
newpath
0 124.48 moveto
360 124.48 lineto
360 0 lineto
0 0 lineto
closepath
clip
<<
/PatternType 1
/PaintType 1
/TilingType 2
/BBox[ 0 0 29.13 19.41 ]
/XStep 29.13
/YStep 19.41
/PaintProc
{
%%Setting current point
0 0 moveto
gsave
[29.13 0 0 19.41 0 -0 ] concat
matrix currentmatrix

1 1 scale
/DeviceCMYK setcolorspace
<<
/ImageType 1
/Width 1013
/Height 675
/BitsPerComponent 8
/Decode [1 0 1 0 1 0 1 0]
/ImageMatrix [1013 0 0 675 0 0]
/DataSource currentfile /ASCIIHexDecode filter
>>
image
0419F8FF0419F9FF0419F6FF0318EFFF0416F3FF0318F2FF0417F0FF041AF2FF0417EDFF0316F0FF
%... extra image data snipped.

setmatrix
grestore
} bind
>>
/Guid66A3EE8E817E4979ABEA430B32156CB1 exch def
newpath
345.24 14.48 moveto
15.45 14.48 lineto
15.45 107.95 lineto
345.24 107.95 lineto
closepath
gsave currentdict dup
/Guid66A3EE8E817E4979ABEA430B32156CB1 known { /Guid66A3EE8E817E4979ABEA430B32156CB1 get [1 0 0 1 0 124.48 ] makepattern /Pattern setcolorspace setcolor fill } { error } ifelse
grestore
newpath
grestore

/DeviceCMYK setcolorspace
1 0 0 1 setcolor
newpath
345.24 14.48 moveto
15.45 14.48 lineto
15.45 107.95 lineto
345.24 107.95 lineto
closepath
gsave stroke grestore
newpath
grestore
%%EOF

alamr...@gmail.com

unread,
Mar 10, 2013, 11:56:10 PM3/10/13
to Olavi Sakari, ma...@quark.com
Hi luser,
You did not explain the reason for the limitcheck error. Is it related to the truncation of the lines to 80 characteres?
I generate a PS by truncating every line of the image data to 80 characters but still getting the same error.

I am sending you the generated PS in a separate mail.
Thanks
Raquib

luser- -droog

unread,
Mar 11, 2013, 12:47:37 AM3/11/13
to Olavi Sakari, ma...@quark.com
On Sunday, March 10, 2013 10:56:10 PM UTC-5, alamr...@gmail.com wrote:

>
> Hi luser,
>
> You did not explain the reason for the limitcheck error. Is it related to the truncation of the lines to 80 characteres?
>
> I generate a PS by truncating every line of the image data to 80 characters but still getting the same error.
>

Hmm. No, not exactly. It's hard to find a nice way to say this, but, this whole approach just isn't going to work. You can't put the image data inside a procedure like that. I was wrong when I said it was executing the data, it's not doing that. But it is trying to *parse* the data into postscript code.

Now even though I can see where it's going wrong, I'm not the best person on here to tell you the right way to do it. I was hoping John Deubert would jump in already, because it's the Acumen Journal that I would recommend.

If you go here
http://www.acumentraining.com/acumenjournal.html
I think it's the 2-part article on images in forms that will help you. You need to save the image data in memory and then "replay" it in the procedure. This will involve changing the design of your program somewhat.

December 2002
Issue 21
PostScript Tech - Using Images in a PostScript Form, Part 1
This month we start a two-part article discussing how to use images in a PostScript form. A form's PaintProc cannot usefully read the input stream, so how do you embed the image data in the form? We'll see how this month.

January 2003
Issue 22
PostScript Tech - Using Images in a PostScript Form, Part 2
We continue last month's topic: how to incorporate images into a PostScript form. This month, we look at using the ReuseableStreamDecode filter.

luser- -droog

unread,
Mar 11, 2013, 1:39:17 AM3/11/13
to Olavi Sakari, ma...@quark.com
On Sunday, March 10, 2013 10:56:10 PM UTC-5, alamr...@gmail.com wrote:
>
> Hi luser,
>
> You did not explain the reason for the limitcheck error. Is it related to the truncation of the lines to 80 characteres?
>

I truncated the line just to remove the bulk so it would fit in a message here. I picked 80 chars because that's a typical line-width limit for usenet. For interchange with older software, 80 chars is a reasonable line-width limit to choose. I suppose fewer and fewer new programs will have difficulty with long lines, but you never know, you know?

I had just opened up the file before I had to leave for work, so I posted it in case somebody else could help you faster. :)

Olle

unread,
Mar 11, 2013, 3:12:08 AM3/11/13
to Olavi Sakari, ma...@quark.com
Md,

I told you last Thursday that "First, I _think_ you cannot have currentfile data here when it's part of a procedure.", and I still think you should use the other solution I presented, reading the currentfile data separately into a bunch of strings.

Thanks,

Olle

Olle

unread,
Mar 11, 2013, 3:27:38 AM3/11/13
to Olavi Sakari, ma...@quark.com
This was the solution I suggested:

%!PS-Adobe-3.0
%APL_DSC_Encoding: UTF8
%%Setting current point
0 0 moveto
gsave
gsave
newpath
0 124.48 moveto
360 124.48 lineto
360 0 lineto
0 0 lineto
closepath
clip

/iWidth 1013 def
/iHeight 675 def
/imageSourceIndex 0 def

/CreateDataArray
{
% CMYK => 4 mul
iHeight 4 mul {
currentfile iWidth string readhexstring pop
} repeat
} bind def

/imageDataArray
[
CreateDataArray
0419F8FF0419F9FF0419F6FF0318EFFF0416... [lots of hexadecimal data]
... 951FEFF1D55FEFF1C51FEFF194BFEFF
] def

/ReadImageData
{
imageDataArray imageSourceIndex get
/imageSourceIndex imageSourceIndex 1 add iHeight 4 mul mod def
} bind def

<<
/PatternType 1
/PaintType 1
/TilingType 2
/BBox[ 0 0 29.13 19.41 ]
/XStep 29.13
/YStep 19.41
/PaintProc
{
%%Setting current point
0 0 moveto
gsave
[29.13 0 0 19.41 0 -0 ] concat
matrix currentmatrix

1 1 scale
/DeviceCMYK setcolorspace
<<
/ImageType 1
/Width iWidth
/Height iHeight
/BitsPerComponent 8
/Decode [1 0 1 0 1 0 1 0]
/ImageMatrix [iWidth 0 0 iHeight 0 0]
/DataSource //ReadImageData
>>
image

setmatrix
grestore
} bind
>>
/GuidCDBF99D100DE4855B5D98E5F1642FC62 exch def
newpath
345.24 14.48 moveto
15.45 14.48 lineto
15.45 107.95 lineto
345.24 107.95 lineto
closepath
gsave currentdict dup
/GuidCDBF99D100DE4855B5D98E5F1642FC62 known { /GuidCDBF99D100DE4855B5D98E5F1642FC62 get [1 0 0 1 0 124.48 ]
makepattern /Pattern setcolorspace setcolor 15.449005 14.482000 329.795990 93.469002 rectfill } { error } ifelse
grestore
newpath
grestore

/DeviceCMYK setcolorspace
1 0 0 1 setcolor
newpath
345.24 14.48 moveto
15.45 14.48 lineto
15.45 107.95 lineto
345.24 107.95 lineto
closepath
gsave stroke grestore
newpath
grestore
%%EOF


luser- -droog

unread,
Mar 17, 2013, 4:56:12 AM3/17/13
to Olavi Sakari, ma...@quark.com
On Monday, March 11, 2013 2:27:38 AM UTC-5, Olle wrote:
> This was the solution I suggested:
>
>

<snipped nice-looking code>

That looks like a good approach. Thanks for sharing.

As a side-note, on usenet put new text at the bottom so it's easier to follow the "thread" of the conversation.
0 new messages