[cl-pdf-devel] cl-pdf image question

Marc Battyani marc.battyani at fractalconcept.com
Wed May 9 07:15:33 UTC 2007


"Cyrus Harmon" <ch-lisp at bobobeach.com> wrote:

> Ok, I'm probably doing something here, but when I try:
>
>
> (cl:defpackage #:cl-pdf-test
>   (:use #:cl))
>
> (cl:in-package :cl-pdf-test)
>
> (defun png-test (file)
>   (pdf:with-document ()
>     (let ((pdf-image (pdf::make-image file)))
>       (pdf:with-page ()
>         (pdf:add-images-to-page pdf-image)
>         (pdf:draw-image pdf-image
>                         300 300 500 300
>                         0 t)))
>     (pdf:write-document (merge-pathnames (make-pathname :type "pdf")
>                                          file))))
> ;;; doesn't work
> (png-test "circles.png")
>
> ;;; works
> (png-test "circles-small.png")
>
> where circles-small is a cropped version of the bigger png, circles-
> small works as expected, but the big image either prints nothing or a
> single black line. I've attached a tgz with the images in question.
> I'm new to cl-pdf, so this could very easily be operator error, but,
> nevertheless, I'm a bit stumped.

What you do seems OK and it works when the image is converted to jpg. So 
there is probably a problem with the png reading.
Indeed (pdf::read-png-file "circles.png") gives a png-image with 4 bytes.

Marc





More information about the cl-pdf-devel mailing list