From: James F. <li...@el...> - 2009-07-11 07:06:43
|
> PDF:WRITE-DOCUMENT function > seems to be unable to take a string or pathname, but throws the > following error (which I tried to resolve by OPENing the proper handle > and passing it): > > #<SB-SYS:FD-STREAM for "file /tmp/ex1.pdf" {BEC30D1}> is not a binary > output stream. Tony, I've recently run into this myself. After a bit of experimentation, I've had consistent success with passing it a filehandle opened for writing with :element-type :default, like so: (with-open-file (outstream #p"/path/to/outfile.pdf" :direction :output :if-exists :rename :element-type :default) (pdf:with-document <PDF stuff goes here...> (pdf:write-document outstream))) I first tried passing it a filehandle opened with :element-type '(unsigned-byte 8) but it them complained that it didn't have a stream of type character. I've no idea why you have to explicitly tell it to use the default element-type, but also don't have the time to dig around and figure that out. HTH, James |