From rambham at gmail.com Mon Mar 2 00:20:15 2009 From: rambham at gmail.com (Ram Bhamidipaty) Date: Sun, 1 Mar 2009 16:20:15 -0800 Subject: [cl-pdf-devel] printing PDF pages to an in-memory buffer Message-ID: Does anyone have an example of printing to an in-memory stream? I am using sbcl on linux. I tried using flex-streams and string-output-stream but I was not able to make either one work. Any suggestions? Thanks for any info. -Ram From attila.lendvai at gmail.com Mon Mar 2 01:33:11 2009 From: attila.lendvai at gmail.com (Attila Lendvai) Date: Mon, 2 Mar 2009 02:33:11 +0100 Subject: [cl-pdf-devel] printing PDF pages to an in-memory buffer In-Reply-To: References: Message-ID: > I tried using flex-streams and string-output-stream > but I was not able to make either one work. iirc, you need a stream that supports file-position, which flexi-streams don't do and neither babel-streams, although i almost added it last time. > Any suggestions? i looked into this some time ago and we ended up generating our pdf's into /tmp/ which is a good idea if you are serving them through the net anyway (think of slow connections... using memory buffers would be a waste) -- attila From rambham at gmail.com Mon Mar 2 03:22:12 2009 From: rambham at gmail.com (Ram Bhamidipaty) Date: Sun, 1 Mar 2009 19:22:12 -0800 Subject: [cl-pdf-devel] printing PDF pages to an in-memory buffer In-Reply-To: References: Message-ID: On Sun, Mar 1, 2009 at 5:33 PM, Attila Lendvai wrote: >> I tried using flex-streams and string-output-stream >> but I was not able to make either one work. > > iirc, you need a stream that supports file-position, which > flexi-streams don't do and neither babel-streams, although i almost > added it last time. > Would that be "hard" to do? I'm not too experienced with LISP, would this be a good way to get started to learn about streams and stuff? -Ram From archimag at gmail.com Thu Mar 26 10:11:47 2009 From: archimag at gmail.com (Andrey Moskvitin) Date: Thu, 26 Mar 2009 13:11:47 +0300 Subject: [cl-pdf-devel] Simple patch for draw-...-text Message-ID: Hi, I need to draw text in bounded rect. However, functions of draw-...- text does not allow it. So, I made minor changes in this functions. Here is my patch: diff --git a/text.lisp b/text.lisp index 8fbddf3..30736bd 100644 --- a/text.lisp +++ b/text.lisp @@ -36,36 +36,39 @@ with Lisps that read source files in UTF-8 encoding.") finally (push (string-trim *delimiter-chars* (subseq string start)) result)) (nreverse result)))) -(defun draw-centered-text (x y string font font-size &optional max-width) +(defun draw-centered-text (x y string font font-size &optional max-width max-height) (pdf:in-text-mode (pdf:move-text x y) (pdf:set-font font font-size) (loop with dy = (* -1.2 font-size) for (str . rest) on (if max-width (split-text string font font-size max-width) (list string)) + for line-count from 0 while (if max-height (> max-height (* -1 dy line-count)) t) for last-x = 0 then offset for offset = (* -0.5 (text-width str font font-size)) do (move-text (- offset last-x) 0) (show-text str) (when rest (pdf:move-text 0 dy))))) -(defun draw-left-text (x y string font font-size &optional max-width) +(defun draw-left-text (x y string font font-size &optional max-width max-height) (pdf:in-text-mode (pdf:move-text x y) (pdf:set-font font font-size) (loop with dy = (* -1.2 font-size) for (str . rest) on (if max-width (split-text string font font-size max-width) (list string)) + for line-count from 0 while (if max-height (> max-height (* -1 dy line-count)) t) for last-x = 0 then offset for offset = (- (text-width str font font-size)) do (move-text (- offset last-x) 0) (show-text str) (when rest (pdf:move-text 0 dy))))) -(defun draw-right-text (x y string font font-size &optional max-width) +(defun draw-right-text (x y string font font-size &optional max-width max-height) (pdf:in-text-mode (pdf:move-text x y) (pdf:set-font font font-size) (loop with dy = (* -1.2 font-size) for (str . rest) on (if max-width (split-text string font font-size max-width) (list string)) + for line-count from 0 while (if max-height (> max-height (* -1 dy line-count)) t) do (show-text str) (when rest (move-text 0 dy))))) Moskvitin Andrey -------------- next part -------------- An HTML attachment was scrubbed... URL: From divanov at aha.ru Sun Mar 29 06:08:54 2009 From: divanov at aha.ru (Dmitriy Ivanov) Date: Sun, 29 Mar 2009 10:08:54 +0400 Subject: [cl-pdf-devel] Simple patch for draw-...-text References: Message-ID: <002801c9b03c$3020c4b0$8100a8c0@digo> Hello Andrey, | Here is my patch: |...snip...| | for line-count from 0 while (if max-height (> max-height (* -1 dy line-count)) t) I cannot vote as I use rather different versions of these functions in practice. But I would 1) default max-height, e.g. &optional ... (max-height max-positive-fixnum) 2) replace the above line by something like the below for height upfrom 0 below max-height by dy (Not tested.) -- Sincerely, Dmitriy Ivanov lisp.ystok.ru From marc.battyani at fractalconcept.com Sun Mar 29 17:00:20 2009 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sun, 29 Mar 2009 13:00:20 -0400 Subject: [cl-pdf-devel] cl-pdf revision 177 In-Reply-To: References: Message-ID: <49CFA924.8010103@fractalconcept.com> Version 177 committed to the repository: cl-pdf: Small fixes for SBCL warnings [Christian Lynbech], Salsa2 [Daniel Herring], changed the default to no-zlib Marc From marc.battyani at fractalconcept.com Sun Mar 29 17:53:15 2009 From: marc.battyani at fractalconcept.com (Marc Battyani) Date: Sun, 29 Mar 2009 13:53:15 -0400 Subject: [cl-pdf-devel] Simple patch for draw-...-text In-Reply-To: References: Message-ID: <49CFB58B.5050203@fractalconcept.com> An HTML attachment was scrubbed... URL: