🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.postscript.programming
7 messages
7 total messages Started by Nagendra_Kuma Mon, 21 Jul 2008 20:13
Understanding Post Script
#312
Author: Nagendra_Kuma
Date: Mon, 21 Jul 2008 20:13
2 lines
1157 bytes
Hi,
 We have so many programs written in Post script by previous developers,10 years ago.right now we are trying to understand what is been written in those programs and trying to reengineer them with latest programming language. in that process our big hurdle is understanding the existing code.because we have no post script knowledge at all . i would like to hear from anybody who can help me in guiding what my best bets would be, either to learn post script language or are there any tools which can convert them to a popular language or any debugger to understand the code.
Re: Understanding Post Script
#313
Author: Nagendra_Kuma
Date: Mon, 21 Jul 2008 20:57
16 lines
1414 bytes
even installed "GhostView" to see the result. but no luck in it. since my programs looks like below,output was empty page.

%PS mark 0.5 setlinewidth currentpoint
%PS 22 1 50 {dup 0 0 t! (B) eq {20 99 t! show crlf}{exit}ifelse }for
%PS dup 22 ne{3 1 roll gsave
%PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto
%PS dup 546 exch lineto lineto closepath stroke grestore
%PS 22 sub 12 mul}{pop pop pop 0}ifelse
%PS currentpoint
%PS 26 1 49 {dup 0 0 t! (D) eq {20 99 t! show crlf}{exit}ifelse }for
%PS dup 26 ne{3 1 roll gsave
%PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto
%PS dup 546 exch lineto lineto closepath stroke grestore
%PS 26 sub 12 mul}{pop pop pop 0}ifelse
%PS add neg 0 exch translate
%PS cleartomark
Re: Understanding Post Script
#314
Author: Dan Coby
Date: Mon, 21 Jul 2008 22:38
30 lines
2826 bytes
<Nagendra_Kuma@adobeforums.com> wrote in message news:59b5e758.0@webcrossing.la2eafNXanI...
> even installed "GhostView" to see the result. but no luck in it. since my programs looks like 
> below,output was empty page.
>
> %PS mark 0.5 setlinewidth currentpoint
> %PS 22 1 50 {dup 0 0 t! (B) eq {20 99 t! show crlf}{exit}ifelse }for
> %PS dup 22 ne{3 1 roll gsave
> %PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto
> %PS dup 546 exch lineto lineto closepath stroke grestore
> %PS 22 sub 12 mul}{pop pop pop 0}ifelse
> %PS currentpoint
> %PS 26 1 49 {dup 0 0 t! (D) eq {20 99 t! show crlf}{exit}ifelse }for
> %PS dup 26 ne{3 1 roll gsave
> %PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto
> %PS dup 546 exch lineto lineto closepath stroke grestore
> %PS 26 sub 12 mul}{pop pop pop 0}ifelse
> %PS add neg 0 exch translate
> %PS cleartomark

The '%' character is used to mark the start of comments in Postscript.  Thus if your
lines all begin with '%PS', then they will all be treated as comments and have no
effect.

If you remove the %PS then there are various other errors within your code
fragment. Ghostview has a display window that shows the error messages.

The basic reference for the Postscript language is the 'Postscript Language
Reference Manual 3rd Edition' as known as PLRM 3rd.

http://www.adobe.com/products/postscript/pdfs/PLRM.pdf 
Re: Understanding Post Script
#315
Author: Aandi_Inston
Date: Tue, 22 Jul 2008 07:11
43 lines
2637 bytes
>.right now we are trying to understand what is been written in those programs and trying to reengineer them with latest programming language. 

PostScript has not changed, the PostScript doesn't need updating
unless it is badly written (which you probably aren't yet in a
position to judge) or doesn't do it's job any longer.

> or are there any tools which can convert them to a popular language or any debugger to understand the code.

There is a debugger for PostScript. My company sells it, in fact. It
is limited to level 2 PostScript, but the chances are 10 year old code
will be level 2.

Some useful background on PostScript
* PostScript is a programming language understood by some printers
* 99.99% of PostScript files are not written by programmers, but
automatically written by software such as print drivers.

I am interested in your idea of "converting to a popular language".
PostScript is a programming language, certainly, but one with a
special purpose. It is the language understood by PostScript printers.

So, in a typical scenario, this PostScript is understood by your
printer(s). Your printer probably doesn't understand anything else, so
conversion isn't an option.

Conversion to PDF is a possibility, if that is more helpful for you.
PDF is designed for both viewing on screen and printing but note the
following:
* PDF is NOT a language, but a graphical file format
* You do not edit PDF files, So you would still absolutely want to
keep the PostScript, and learn PostScript, for any future changes.
Think of them as the raw and compiled program, source code and exe, if
that helps.
* PDF files are generated from PostScript automatically using Acrobat
Distiller.

If this doesn't point you in the right direction for your project, it
would probably be best to discuss the purpose of the files: what is
done with these PostScript files in your workflow, in your
organisation?


Aandi Inston
Re: Understanding Post Script
#316
Author: Aandi_Inston
Date: Tue, 22 Jul 2008 07:12
14 lines
1050 bytes
>%PS mark 0.5 setlinewidth currentpoint

In PostScript, % is the start of a comment. The comment runs to the
end of the line. So your program contains nothing but comments - and
hence, is blank!

It is common to put

%!

on the first line of a PostScript file, alone, which tells some
utilities that this is PostScript.

Aandi Inston
Re: Understanding Post Script
#321
Author: Nagendra_Kuma
Date: Tue, 22 Jul 2008 18:24
41 lines
2633 bytes
Hi Aandi,

Thanks for your reply . But we have tried removing this Post script and the result was not as expected. so understood that they are not comments. we used post scripts in our report generation to get certain outputs .we are trying to get rid of this post scripts and also at the same time maintain for the current production use.so in our maintaining activity we have follwoing problem .

we have a form with post script embedded to it,which i gave below.what our understanding is ,this post script creates a box.then we send the text from input file,which will be displayed inside the box.we think that the box is taking relative position to the top left corner of the page.right now we are trying to place a static text at top corner of the page.but by doing that.if my input file not passing the text for the box.my new static text is disappearing .

So, we are trying to understand this post script, so that we can locate what is the starting position that is tied up with this box display. We might need to change the position so that our new static text at the top of the form should be stick to one place.



The post script is -

%PS mark 0.5 setlinewidth currentpoint

%PS 22 1 50 {dup 0 0 t! (B) eq {20 99 t! show crlf}{exit}ifelse }for

%PS dup 22 ne{3 1 roll gsave

%PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto

%PS dup 546 exch lineto lineto closepath stroke grestore

%PS 22 sub 12 mul}{pop pop pop 0}ifelse

%PS currentpoint

%PS 26 1 49 {dup 0 0 t! (D) eq {20 99 t! show crlf}{exit}ifelse }for

%PS dup 26 ne{3 1 roll gsave

%PS currentpoint -6 8 translate 4 -2 roll moveto currentpoint exch pop 546 exch lineto

%PS dup 546 exch lineto lineto closepath stroke grestore

%PS 26 sub 12 mul}{pop pop pop 0}ifelse

%PS add neg 0 exch translate

%PS cleartomark

if you can help us explain what this post script does and explain where we can modify to achieve our requirement,that would be great.
Re: Understanding Post Script
#322
Author: Aandi_Inston
Date: Tue, 22 Jul 2008 21:08
21 lines
1807 bytes
>Thanks for your reply . But we have tried removing this Post script and the result was not as expected. so understood that they are not comments. 

Please believe me when I say that % is a comment in PostScript. I
don't often say this, but I DO know what I am talking about.

However, your "PostScript" files are processed by a program. It is
likely that it uses %PS as some kind of escape, and removes it. I
recommend reading the program (not the PostScript) to find out how
these are handled.

Until you know exactly what is done to process these lines into a
print or other file, it is probably not a good idea to touch them.

>So, we are trying to understand this post script, so that we can locate what is the starting position that is tied up with this box display. 

PostScript has a transformation matrix which is used to map all
coordinates. Without looking at the entire context of the print
stream, rather than these few lines, it is not possible to know what
the co-ordinates mean.

Aandi Inston
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads