-
-
Save t-cool/e27563bf27471d9a034cdd3dcc4daa4d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; CL-PDF Hello World | |
;; | |
;; Use ASDF to load the CL-PDF library | |
;; | |
(asdf:operate 'asdf:load-op 'cl-pdf) | |
;; | |
;; Function to generate a Hello World pdf file. | |
;; On calling this function, you should see a pdf file | |
;; with a big Hello World in the center! | |
;; | |
(defun hello-world (file author title greeting) | |
"Create a Hello World PDF file" | |
(pdf:with-document (:title title :author author) | |
(pdf:with-page () | |
(pdf:register-page-reference "page 1") | |
(pdf:with-outline-level ("Page 1" "page 1") | |
(let ((helvetica (make-instance 'pdf:font))) | |
(pdf:in-text-mode | |
(pdf:set-font helvetica 36.0) | |
(pdf:move-text 200 400) | |
(pdf:draw-text greeting))))) | |
(pdf:write-document file))) | |
(hello-world #P"d:/tmp/hello_world.pdf" "Sid H" "Hello World" "Hello World") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment