PS code to write a Special File? 
Author Message
 PS code to write a Special File?

Hello all you postscript folks,

I need a very simple filter or postscript code snippet that does the
following:

I have a textfile which is an image bitmap which has 640 pixels per line
and 480 lines (like a VGA output).  This file is quite simple it either
has a "1" or a "0" character at each location.  I have discovered that
by using a Couier fixed typeface at 2 point font on landscape paper with
margins set at 1/8" and 1 point spacing between lines I get the entire
image on one sheet of paper.

Now what I need is the postscript code to make those setting work.  I
have a lot of these files to print and doing them within any
text/wordprocess is very painful.

Maybe in perl or c?  This doesn't strike me as difficult I just don't
have any postscript coding experience.  I can send the data directly to
the printer...I am driving an HP4MV.

Thanks in advance for any help...you may post or email me directly I
will be watching this news group for a reponse.

TomT...
--
+-----------------------------------------------------------------------+

:
: Thomas Tessier          |  FAX:    303.441.5811                      
:
:                         |  WWW:   http://www.*-*-*.com/            
:
+------------------------Have a nice
Day--------------------------------+



Sat, 14 Aug 1999 03:00:00 GMT  
 PS code to write a Special File?

Quote:

> Hello all you postscript folks,

> I need a very simple filter or postscript code snippet that does the
> following:

> I have a textfile which is an image bitmap which has 640 pixels per line
> and 480 lines (like a VGA output).  This file is quite simple it either
> has a "1" or a "0" character at each location.  I have discovered that
> by using a Couier fixed typeface at 2 point font on landscape paper with
> margins set at 1/8" and 1 point spacing between lines I get the entire
> image on one sheet of paper.

> Now what I need is the postscript code to make those setting work.  I

Do you literally need to have little bitty '0's and '1's squished
together 1 point apart, or would you be satisfied to render your file as
an image (with light and dark regions instead of tiny numbers)?

If you really need the tiny numbers, the code below will probably do the
trick, but boy those numbers are ugly.

The pretty way would be to use the image operator; one of its arguments
is a procedure that provides the next line of image data each time it
is called, which makes it very easy to do things like this. Just write
a procedure that reads the next line from your text file, mungs the '1'
and
'0' characters into binary ones and zeros, and returns them.

You can now use all the scale, translate, rotate, etc. operators to put
your image anywhere on the page you would like.  The code would not be
much more complicated than this (proof left as an exercise for the
reader).

You should have a copy of the PostScript Language Reference Manual, 2nd
Edition,
from Adobe, but if you don't, in a pinch you can use
http://www.lumcorp.com/Web/PSWeb/index.html .

For the code below, if you save it in a file snarf.ps, and your input
data are
in myfile.in, you would run gs as in:

$  gs  -sFILENAME=myfile.in  snarf.ps

Use the other command line options to specify the right printer device,
etc.

-Chap
--------snip-------
/buf 641 string def

/inp FILENAME (r) file def

/inch { 72 mul } def
/eighth { 8 div } def

8.5 inch 0 translate % move origin to (8.5, 0)

90 rotate % landscape

1 eighth inch   8.5 -1 eighth add inch  moveto  %  to (1/8, 8.5 - 1/8)

/Courier findfont 2 scalefont setfont  % 2-pt Courier

/line { save exch show restore 0 -1 rmoveto } def  % print a line then
down 1 pt

{ inp buf readline not { exit } if line } loop  % do 'em all

pop

showpage

quit



Sat, 14 Aug 1999 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to write special characters (eg: TAB) to text files

2. Writing out VBS code with response.write()

3. FileSystemObject: how to avoid writing special characters

4. Response.Write: Special characters

5. Writing ASP code to file?

6. need to embed non-ps executable code into *.ps file

7. Writing ASP code to file?

8. Writing ASP code in to file by using FileSystemObject

9. How do I write code in MS Access 97 to print a postscript-file

10. special characters and ASCII code

11. Need to write to ps file and rotate image

12. (Q)writing dot gain compensation for PS files

 

 
Powered by phpBB® Forum Software