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!

PS file in new PS file - OR - add filename of PS to print

Status
Not open for further replies.

DEmagmac

Programmer
Nov 5, 2004
10
DE
Hi (my first post... ,-))

I am looking for a solution to place a PS file into a new PS file which contains e.g. the filename and date.

I've tried several things (one week till now) - including the set of Unix commands, ps2ps, psnup, pstoepsi, convert, pstops, making a shell script to create new temp PS file... etc. => but nothing worked.

What I want to do:
I have different PS files with different sizes(!). I want to place one on a new page (e.g. A3 - 297 mm x 420 mm - or 842 x 1191 ps-points) - make a border arround it and add a text with the name and date of the used PS file above this frame. The problem is, that when using e.g. imagemagick or ghostscript - the files are interpreted by IM or GS => so they become a picture. But I need to verify that this certain/placed PS file is ok on a special printer RIP, so the printer must interpret it, not another RIP or application.

Any ideas are welcome!

Tech-background:
- PS-files come from XPress or other applications
- running Helios Ethershare with OPI (files are FAT PS)
- resolution above(!) 300 dpi
- Unix/Linux Server with Suse Linux

Thanks
Magnus
 
Thanks Thomas,
that's true - PS can include other PS by using "run".

The problem in my case is, that when I include the PS with the "run", the resulting PS has two pages, one large with the title, and another tiny one with the included file. The problem seems to be, that this placed page also has a "showpage" inside. So I am using two "showpages" in the PS and this creates two pages...

I can not change the placed PS because I'll need it for later - I just want to have an A3 paper with the PS and a title above it... sounds easy - but it's not... and in the next step this PS might also be a PDF.
 
Thanks - good thing - I'll test it directly...

The last with the PDF just means when I'm done with the PS stuff, the same has to be done with the PDF - but this might be more easy... (it was just a hint for myself for the future-work ,-))
 
sorry -it does not work...
Maybe I misunderstand something in general?

Afterwards the origin PS-File (myFile is the external/placed PS):

%!PS-Adobe-2.0
%%BoundingBox: 0 0 842 1190
%%BeginFeature: *PageSize A3
<< /PageSize [842 1190] >> setpagedevice
%%EndFeature
/Pages 1 def
/Helvetica findfont
14 scalefont
setfont
newpath
69 1130 moveto
(myFile.ps) show
save
/showpage {} def
{myFile.ps} run
restore
%%EOF

=> when I send it via lpr to our Printer, the result is:
ERROR: typecheck
OFFENDING COMMAND: run

STACK:

{myFile.ps } // yes, with a space at the end...
-savelevel-

=> when I use ps2pdf on the Unix command-line, the result:
Error: /typecheck in --file--
Operand stack:
--nostringval-- --nostringval-- (r)
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- 2 3 %oparray_pop --nostringval-- --nostringval-- --nostringval--
Dictionary stack:
--dict:1058/1417(ro)(G)-- --dict:0/20(G)-- --dict:70/200(L)--
Current allocation mode is local
Current file position is 284
ESP Ghostscript 7.05.3: Unrecoverable error, exit code 1

It's really strange...
Any ideas?

Greetings from Munich
Magnus
 
1:0 - yes, you're right... with a parentheses i've no problems creating the PS.
But... (sorry) - when I send it to the printer it says: "

ERROR: undefinedfilename
OFFENDING COMMAND: run

STACK:

(myFile.ps)
-savelevel-

a quick and dirty created ps2pdf shows the correct result - but just for 2 seconds, then a white page(?!?) - on a Mac it's corrupted and does not show anything.

... i think I'll need to load the file somehow to the PS and then call the "run".

So my new PS looks like this:

%!PS-Adobe-2.0
%%BoundingBox: 0 0 842 1190
%%DocumentNeededResources: myFile.ps
%%BeginFeature: *PageSize A3
<< /PageSize [842 1190] >> setpagedevice
%%EndFeature
/Pages 1 def
/Helvetica findfont
14 scalefont
setfont
newpath
69 1130 moveto
(myFile.ps) show
save
/showpage {} def
%%IncludeResource: myFile.ps
(myFile.ps) run
%%EndResource
restore
%%EOF

=> but the same result...

If only I could find a good book to look in for PS programming... but I can't find any here in Germany (any good tip?).

Thanks for your help - it's quite better than ever before!
 
Well, you can't send it to your printer, unless your printer has access to myFile.ps. I thought you said you were creating PDFs?

I'm sorry, but I'm not quite clear on what you want to do or where the PostScript will be processed.

You can INCLUDE the second file within the body of the first file. You have to treat it just like you would an EPS. In other words, perform basic housekeeping procedures, such as including it between save/restore pairs.

Try this:

Replace (myFile.ps) run with the actual contents of the myFile.ps.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Ok, I placed the content of the file instead of the "run" line... the result seems the same - no output on printer and a temporary PDF just shows up for 2 seconds...

The printer has no access to myFile.ps - it's on our server. The printer is a Canon CLC3200 with an attached Colorpass 3200 (same like Fiery X12).

I try to clarify my idea:

We're doing advertisings for magazines to be placed on a magazine-page. They have different sizes and fileformats. I created some hotfolders to drop the filetypes inside and to print them on A3 paper - TIFF and Scitex CT are running well. The next step is to have an hotfolder for PS and another one for PDF. We need to show the advertising to the customer to make sure, that it's correct. In general we're using A3 paper to place it, with a border arround it and a headline with the exact filename, so the customer can see the exact name (with ID for the magazine and ID for the pagenumber). The PS file just has to be printed on an A3 paper with a headline above - that's the goal - in the next step the same has to be done with PDF files, but not to be placed in a PS - I'll try to manipulate the PDF or create a PS out of the PDF and use this workflow above...

But(!) - I am not allowed to create (interpret) an image of the PS because our Colorpass 3200 has the same PS version as the later used RIP - so what you'll see on the printer will also be on the RIP and so inside the magazine.

The problem with the different PS versions is related to tranparencies, over/unterprinting... etc. So if I interpretate it on our Unix to become an image, I am not quite sure if it was done with the same PS version as the RIP will use, and this final RIP is not in our hand.

That's the reason why I need a "big" PS with the included/placed PS and the headline - and standardized to A3. (that's also why I tried psnup, psresize... etc.)
 
Magnus,

I'm sorry, I deleted your email without first recording/save your address. Please email me again.

In your case, the solution is simple.

Add this code to the TOP of your ORIGINAL PostScript program:

Code:
%!PS

<<
   /BeginPage
   { 0 0 moveto /Helvetica 14 selectfont (TGREER) show 
   } bind
>> setpagedevice

You can adjust the "0 0 moveto" to place the text more accurately, and of course change (TGREER) to your filename.

What this does is modify the behavior of showpage, to perform the procedure within /BeginPage.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thanks Thomas,

I'll try it tomorrow morning. Is it also possible to overload the old pagesize to become A3? - because the origin PS is always different and smaller than A3.

The mail will get to you in a few minutes! Attention: it's about 5 MB!

Bye
Magnus
 
Thanks Thomas,

it does work - but... (sorry again) the PS File still has the dimension as before. So the output create errors or does nothing (our printer just says "who cares, I don't print anything or mention anything..." => so the file is just thrown away).

I tried to overload the PS file with another topic and the papersize, but this only creates A4 (also with the psresize command) - or an error.

Bye - nice weekend
Magnus
 
Change the code to this:

Code:
%!PS

<<
   /PageSize [612 792] % put the page size you want here

   /BeginPage
   { 0 0 moveto /Helvetica 14 selectfont (TGREER) show
   } bind
>> setpagedevice

/setpagedevice /pop load def

This allows you to set your own Page Size, and disables the setpagedevice in the rest of the program.


Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
OK - it does what it has to do! When I am doing a ps2pdf everything is fine -> A3 paper with title above.

When I print it to our CLC I got:

***
ERROR: invalidaccess
OFFENDING COMMAND: def

STACK:

-dictionary-
/md
0
***

the title is on the A3 page but the placed PS makes this error.

Might there be something in the placed PS that corrupts the whole thing?
 
Hi,
Can anybody tell me how to add a GIF/JPEG image in my postscript file ?
Thanks in advance - KP
 
sorry for the delay.

We fixed the problem - or better - we escaped from it... now we're using a GMG RIP to create a Scitex CT or TIFF to be sent to the printer directly.

@kp99
sorry - I am not a PS programmer in general - more or less just a problem-solver. But I am sure, that tgeer can help you!

Cheers from snowy munich
DEmagmac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top