Find the answer to your Linux question:
Page 2 of 2 FirstFirst 1 2
Results 11 to 16 of 16
Write native Postscript in your code. Postscript is based on an old stack-oriented language (Forth) so it seems to be written backwards, but most of what you need is dirt ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #11
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158

    Write native Postscript in your code.

    Postscript is based on an old stack-oriented language (Forth)
    so it seems to be written backwards, but most of what you need is dirt simple. You can create the Postscript commands from C on the fly and write to a text file ---
    with logic in your C code that looks like this:

    for (each box you want to print)
    {
    Select a font Ps command = findfont
    Select a fontsize PS command = setfont
    Move to the coordinates of the start of a box PS command = moveto
    output the data = show
    }
    output the whole page = showpage

    Chapter 5 in this tutorial gives you what you need.

    http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF

  2. #12
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    --
    The Postscript output file will look like this :
    Code:
    %!PS
    /Courier-New findfont
    setfont
    10 scalefont
    70 100 moveto
    (data for box 1) show
    70 200 moveto
    (data for box 2) show
    showpage

  3. #13
    Linux Enthusiast
    Join Date
    Jan 2005
    Posts
    575
    I hope I'm not hijacking the thread but how does one send a
    Postscript programme to the printer ? Is it just a matter of writing
    cat postscript_programme > printer_device ?

  4. $spacer_open
    $spacer_close
  5. #14
    Linux Newbie
    Join Date
    Oct 2004
    Posts
    158
    Yes, you can do that.

    You can also call lp() directly in C code to move the file off to a printer.

  6. #15
    Just Joined!
    Join Date
    Jun 2005
    Posts
    8
    Quote Originally Posted by jim mcnamara
    Write native Postscript in your code.

    Postscript is based on an old stack-oriented language (Forth)
    so it seems to be written backwards, but most of what you need is dirt simple. You can create the Postscript commands from C on the fly and write to a text file ---
    with logic in your C code that looks like this:

    for (each box you want to print)
    {
    Select a font Ps command = findfont
    Select a fontsize PS command = setfont
    Move to the coordinates of the start of a box PS command = moveto
    output the data = show
    }
    output the whole page = showpage

    Chapter 5 in this tutorial gives you what you need.

    http://www-cdf.fnal.gov/offline/PostScript/BLUEBOOK.PDF
    Thanks a lot Jim!!

    This is exactly what I was looking for!!

  7. #16
    scm
    scm is offline
    Linux Engineer
    Join Date
    Feb 2005
    Posts
    1,044
    Personally, I'd use troff(1) to do what you want to do. In fact I did - all my invoices (and most of my other documentation) are done that way. But maybe I'm just old-fashioned.

Page 2 of 2 FirstFirst 1 2

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •