[plt-scheme] Re: pdf library?
Rohan Nicholls wrote:
> I was wondering if there is a library for building pdf files?
>
> If not I am interested in making a very simple one for generating
> receipts, and would like pointers to documentation etc. on how I would
> go about doing this.
I don't know if there's a library available, but if you're going to roll
your own from scratch, the PDF specification would be a good place to start:
http://partners.adobe.com/asn/developer/acrosdk/docs.html
Note that this is a fairly daunting task, even if you were to implement
the subset of items of interest for your receipts.
If you're willing to shell out to the system, it would be much easier to
write a PostScript file and run it through ghostscript to get the PDF.
PostScript is a bit weird at first, but the following gives you the flavor:
%!
% Use the Times-Roman 12pt font by default.
/Times-Roman findfont 12 scalefont setfont
% Create a new command called "inch" so we don't have to specify
% everything in points.
/inch {12 mul} bind def
1.0 inch 1.0 inch moveto
(Hello World!) show
showpage
Pipe this through ghostscript using something akin to:
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -sOutputFile=...
HTH