Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

postscript example of printing a simple text page

Can someone provide me with an example of (or a link to) a postscript document for printing a simple 1 page (or multiple page) document. I need to use ps2pdf to generate a PDF from postscript since I cannot get TCPDF installed on a server I am using. So my only option is to generate the document in postscript and then send it to ps2pdf. So I am looking for an example of how to print a simple page with text in postscript. If you have another solution for my PDF problem, please let me know. Thank you

PS: The system here would not allow me to create the tag "ps2pdf". Can someone with a higher rating please create a tag for "ps2pdf" so it is easier for others to find information in the future. Thanks.

like image 371
Andrew Avatar asked Sep 21 '25 12:09

Andrew


1 Answers

This is about as simple as you can get. Assuming your default page size for the PostScript converter is 8.5 x 11 (612pt x 792pt) the following PostScript code will print "Hello World" approximately one inch from the upper left of the page in 36 point Times Bold.

%!PS
/Times-Bold findfont 36 scalefont setfont
72 684 moveto (Hello World!) show
showpage
like image 129
joelgeraci Avatar answered Sep 23 '25 08:09

joelgeraci