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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Total newbie needing help here! 1

Status
Not open for further replies.

xezekielx

IS-IT--Management
Jun 30, 2005
93
CA
Hi! I'm totally new to PostScript. I want to use it to generate a report from Access and then convert it to PDF using GhostScript. I don't want to use any virtual printer (whether it's to generate a PS or PDF file). I would just need a few guidelines to know how to set a page's size, position text on a page (I don't really understand how 'moveto' works) and stuff like that. Any help would be much appreciated!
 
PostScript is an unusual, but fun, language.

First, the coordinate system. It uses an x and y axis, with the origin (0,0) at the lower left corner of the page.

It uses "points", and there are 72 points per inch. Thus an 8.5x11 inch "letter sized" page is 612 x 792 points.

Page size:

Code:
<</PageSize [612 792]>> setpagedevice

To draw text:

1. assign a font
2. define a current point (spot to start drawing)
3. draw a string

Complete program:

Code:
%!PS
<< /PageSize [612 792] >> setpagedevice
/Courier 14 selectfont
10 600 moveto
(Hello world!) show
showpage

"moveto" requires two numbers on the stack, an x and a y. "show" requires a string, which PostScript delineates with parantheses.

Experiment with that, and come back if you have any more questions.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Thanks a lot, mate! That's exactly what I was looking for! You wouldn't know any websites with small (but good) examples that I could use, would you? Thanks again! It's people like you who make this website so great!
 
Would I be permitted to mention my own site, in direct response to your question? It has several articles on the PostScript language.

See if you can find the "PostScript Tutorial and Cookbook" online somewhere, also known as the "The PostScript Blue Book". It has lots of little sample programs and quick tutorials.



Thomas D. Greer

Providing PostScript & PDF
Training, Development & Consulting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top