×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Reusable Content Caching: 2 eps files in 1 ps file

Reusable Content Caching: 2 eps files in 1 ps file

Reusable Content Caching: 2 eps files in 1 ps file

(OP)
The following works just fine when IDForm1 is called
further in the program. (thanks Mr. Greer for that
great article on your site).

------------------------------------------------------
/ImageData
currentfile
<< /Filter /SubFileDecode
   /DecodeParms << /EODCount 0 /EODString (*EOD*) >>
>> /ReusableStreamDecode filter
[[[[ eps1 here ]]]]
*EOD*
def
/IDForm1
<< /FormType 1
   /BBox [0 0 1224 792]
   /Matrix [ 1 0 0 1 0 0]
   /PaintProc
   { pop
       /ostate save def
         /showpage {} def
         /setpagedevice /pop load def
         ImageData 0 setfileposition ImageData cvx exec
       ostate restore
   } bind
>> def
------------------------------------------------------

But what if I want to include 2 EPS files?  How and
where would I define the block for IDForm2?

I tried just copying the block above and renaming
to IDForm2, but my pdf creator bombs when it hits the
second call IDForm2 call..

Any pointer would be great... any code would be even better.

I checked a good bit of post history here and saw this
issue discussed, but I'm having a devil of a time getting any code to actually run...

Thanks,
Chris M.

RE: Reusable Content Caching: 2 eps files in 1 ps file

You not only have to define a second form, you also have to create a second Resuable Stream.

Copy that code block you have above.

Rename "ImageData" to "ImageData2"

Rename "IDForm1" to "IDForm2".

In the form's PaintProc, change "ImageData" to "ImageData1"

CODE


% First EPS:
/ImageData
currentfile
<< /Filter /SubFileDecode
   /DecodeParms << /EODCount 0 /EODString (*EOD*) >>
>> /ReusableStreamDecode filter
[[[[ eps1 here ]]]]
*EOD*
def
/IDForm1
<< /FormType 1
   /BBox [0 0 1224 792]
   /Matrix [ 1 0 0 1 0 0]
   /PaintProc
   { pop
       /ostate save def
         /showpage {} def
         /setpagedevice /pop load def
         ImageData 0 setfileposition ImageData cvx exec
       ostate restore
   } bind
>> def

% Second EPS:
/ImageData2
currentfile
<< /Filter /SubFileDecode
   /DecodeParms << /EODCount 0 /EODString (*EOD*) >>
>> /ReusableStreamDecode filter
[[[[ eps1 here ]]]]
*EOD*
def
/IDForm2
<< /FormType 1
   /BBox [0 0 1224 792]
   /Matrix [ 1 0 0 1 0 0]
   /PaintProc
   { pop
       /ostate save def
         /showpage {} def
         /setpagedevice /pop load def
         ImageData2 0 setfileposition ImageData cvx exec
       ostate restore
   } bind
>> def

That should do the trick.

You can thank me for that article by clicking some of the ads on my site!

Thomas D. Greer
http://www.tgreer.com

Providing PostScript & PDF
Training, Development & Consulting

RE: Reusable Content Caching: 2 eps files in 1 ps file

(OP)
Works like a charm!  Heading to click after this post :)

Here's a related follow-up question:

I am using the ps2pdf.bat file included with ghostscript for windows (ver 8.14) to distill the ps files I am producing.  I would have thought that using a reusable content cache in the ps file, that the resulting PDF produced would not be much larger than the ps file.. but the resulting PDF is actually over 4 times larger than the PS file... which leads me to think it is writing out the forms every occurrence instead of caching them.

It was my understanding that PDF would cache the form data in a similar way that the PS file does and prevent such large filesize escalation.

On a whim, I just checked.. and strangely enough, when I distill using Adobe's Distiller.. the resulting PDF is much much smaller (and is produced much mush faster too).

Not sure what I may be missing here.. mabye I need to feed some sort of flags to ghostscript to achieve the same optimization as Distiller?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close