[cl-typesetting-devel] An interesting problem from a neophyte...
Marc Battyani
marc.battyani at fractalconcept.com
Sun Jan 20 22:01:12 UTC 2008
Robert L. Read wrote:
> Thanks for making cl-pdf and cl-typesetting; they are a great idea.
>
> I'm attempting to use them now. However, I am implementing a website,
> and I want to render the PDFs on demand, not store them in files. The
> API to cl-pdf is stream-based, which in theory should allow me to send
> in an "in-memory" stream, rather than a "file-based-stream". For
> example, I can almost get it to work by using the
> "IN-MEMORY-OUTPUT-STREAM" of the "flexi-streams" package.
>
> However, flexi-streams does not support file-position, which is used by
> cl-pdf to write the "xrefs" section of the PDF.
>
> I thought about attempting to extend a flexi-stream class to support
> file-position, but that is little more than I want to take on right now.
>
> So my questions are:
>
> 1) Am I crazy to want to do this in-memory?
>
No, I do this all the time. ;-)
> 2) What are the xrefs, and do I need them?
>
It's the positions of the objects in the file. I'm sure you need them. :)
> 3) Is it necessary to use "file-position" to compute this? (perhaps the
> PDF spec and character encoding issues basically for the answer to be
> "yes")
>
It's mush easier to implement file-position in flexi-streams than trying
to try to compute it at the cl-pdf level.
> 4) Is there some package that supports "in-memory" files that corectly
> computes file-position that I may not know about?
>
Sure, just write the pdf to a string. It's what I do in my web applications.
Marc
More information about the cl-typesetting-devel
mailing list