You are here >  

CL-PDF examples

CL-PDF is very easy to use. Here is a short example :

(pdf:with-document ()
   (pdf:with-page ()
     (let ((helvetica (make-instance 'pdf:font)))
       (pdf:add-fonts-to-page helvetica)
         (pdf:set-font helvetica 36.0)
         (pdf:move-text 100 800)
         (pdf:draw-text "CL-PDF: Example 1"))
       (pdf:translate 230 500)
       (loop repeat 101
         for i = 0.67 then (* i 1.045)
         do (pdf:in-text-mode
           (pdf:set-font helvetica i)
           (pdf:move-text (* i 3) 0)
           (pdf:draw-text "rotation"))
         (pdf:rotate 18))))
   (pdf:write-document #P"ex1.pdf"))

The result of this programm is here: ex1.pdf (19k)

Others examples : Some bezier curves ex2.pdf
Rotated and scaled images ex3.pdf
The fractal logo at several levels (multiple pages)ex4.pdf
A maze generation example ex5.pdf
Arc functions ex6.pdf
Charts (histogram, pie and plot-xy) ex7.pdf
The lisp file that generated the examples: examples.lisp

Please send me some other fancy ones to put here!