Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I use PaintProc & execform to call a form? 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I need to figure out how to call a form in PS; the manual (redbook)talks about PaintProc and execform, but without examples I can't make too much sense of it.

Can anyone enlighten me please, preferably with some PS code..

Thanks! Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2
 
Do you still need help with this? I know it's an old post. Let me know.

Thomas D. Greer
 
Thomas, If you have an example handy I'd still like to see it, although we went about the task completely differntly if I remember correctly. For future ref it would be great to know how to do this, but don't bust a gut if you don't have anything to hand.

Thanks,
Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2
 
It's no problem. You do it with a dictionary. "PaintProc" is part of the dictionary. Things get tricky, though, depending on what you want to use as your PaintProc. Here's the basic structure:

/VerySimpleForm
<<
/FormType 1 % all forms are FormType 1
/PaintProc % draw a red square
{ pop
gsave
0 0 moveto
1 0 0 setrgbcolor
[ 0 0 72 72 ] rectfill
grestore
} bind

/BBox [ 0 0 77 72 ] % 1 inch square form/image
/Matrix [ 1 0 0 1 0 0] % no scaling or translating
>> def

10 10 translate
VerySimpleForm execform
100 100 translate
VerySimpleForm execform

Typically, though, you'll want to use a logo or entire page background as your form, not very simple drawing operators like I've shown.

This is trivial if your RIP has access to a hard drive, such as using Distiller on a PC. Your PaintProc just &quot;runs&quot; the logo (assuming it's PS or EPS).

/PaintProc
{ /showpage {} def
/ostate save def
% do a translate or scale if needed
% all the basic EPS housekeeping stuff
(c:/some_logo.eps) run
ostate restore
} bind

If the image data is inline... that's a much more difficult issue, since forms can't use inline data. You have to break up the image into a series of arrays. There are references for that if you'd like them.

Thomas D. Greer
 
Thanks a lot- that looks easier than I thought!

Jim Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2
 
Tgreer... you posted this &quot;If the image data is inline... that's a much more difficult issue, since forms can't use inline data. You have to break up the image into a series of arrays. There are references for that if you'd like them.&quot;

Can you elaborate a little more on this?

Thanks
 
No, but I can elaborate a LOT.

The typical way you handle &quot;inline data&quot;, that is, encoded image data embedded directly within a PostScript program, is to precede it with an image dictionary containing instructions for how to render the image data that follows.

You can't wrap all that up inside of a procedure (remember that the /PaintProc value must be a procedure).

This is because procedures are immediately scanned and converted to PostScript objects... the scanner will turn all your image data into executable names. When you call the procedure, those names aren't to be found in any of the dictionaries, thus you'll get an &quot;undefined&quot; error.

The crux of the issue is how the PostScript scanner deals with procedures.
 
Do you, or does adobe have references as to how to precede the image data with an image dictionary?

For a little background, we do insert EPS files into postscript files as forms, however, this only works, as you say, when the EPS doesn't contain image data.

My problem today is that most graphic programs build EPS files with image data. So either I need a way to build EPS files without image data, or I need to figure out how to use them as they are with the form calls. We routinely build PDFs that are greater than 10,000 pages and using form calls is the only way to go (that I know of).

Your advice is much appreciated.
 
Do your EPS files need to be inside the PostScript, or can they be referenced on the hard drive?

If you're using EPS files, you won't need to use the image operator necessarily.

The best discussion of the topic I've seen recently is in a recent series of John Deubert's Acumen Journals.


That's the first article in the series.
 
The EPS files don't need to be inside of the Postscript and we do currently reference them from outside.

I've checked out the articles and they are very good. However, I've haven't had success making his examples work yet... but I'm still trying.
 
The easiest way of course is to reference external EPS files via the &quot;run&quot; operator, as I show upstream in this thread.

Concentrate on the SubFileDecode filter method. I'd be happy to answer any questions.

Tom
 
Hi tgreer,
I saw you are an experienced in PostScript and may be you can give an advice.
I use tiff2ps program to generate PostScript file.
I want to use your example to avoid repeating in every page static picture, but if I put my data(from tiff2ps) in /PaintProc like this
/VerySimpleForm
<<
/FormType 1 % all forms are FormType 1
/PaintProc % draw a red square
{
gsave
100 dict begin
%ImageData: 326 407 8 4 0 1 2 &quot;false 4 colorimage&quot;
/line 1304 string def
326 407 8
[326 0 0 407 0 0]
{currentfile line readhexstring pop} bind
false 4 colorimage
1e0007001f0007006c3b0000000000000000000000000000091da200000
.....
0000000000000000
end
grestore
}
/BBox [ 0 0 244 153 ] % inch square form/image
/Matrix [ 1 0 0 1 0 0] % no scaling or translating
>> def
.....
VerySimpleForm execform

it does not work.
I'm still not very familiar with PostScript, so please can you tell me where are my errors.
Thanks in advance
 
Refer to my post earlier in this thread, and follow the link to Acumen Training's journal article on this exact topic.

There are a couple reasons this fails. One is in regard to how procedures are tokenized.

But look also at the &quot;currentfile&quot; operator used to process your image data. Where is &quot;currentfile&quot; at the time the proc is executed?? Nowhere near the image data.

John's article will give you some solutions to this problem.

Thomas D. Greer
 
I used the article of Mr.Thomas D. Greer &quot;Preparing EPS files for use in VDP&quot; to put an EPS file in my PS file like this
...
save
/showpage {} def
/setpagedevice /pop load def
0 0 translate
14.2 -12.848 scale
-154 -521 translate
(G:/Output/id_2_front.eps) run
restore
...
It works fine, but if I share my PS file the fixed path (G:/Output/id_2_front.eps) causes problems for the RIP.

Is it possible to put the EPS file inside the PS file like Form and how.
I was not able to find it in Acumen Journal.
Kind regards,
Trifon Alekov
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top