I found empirically that when I save a image to pdf I need to scale it by 1.25.
Code below. Why? Is there a setting I should use instead? Thanks Dan #lang racket (provide image->pdf) (require racket/draw (only-in 2htdp/image save-image image-width image-height scale )) (define (image->bitmap image) (let* ([width (image-width image)] [height (image-height image)] [bm (make-bitmap width height)] [dc (send bm make-dc)]) (send dc clear) (send image draw dc 0 0 0 0 width height 0 0 #f) bm)) (define (image->pdf image output-file) (define dc (new pdf-dc% [ interactive #f ] [ use-paper-bbox #f ] [ width (image-width image)] [ height (image-height image)] [ output output-file ])) (send* dc (start-doc "useless string") (start-page)) (send dc draw-bitmap (image->bitmap (scale 1.25 image)) 0 0) (send* dc (end-page) (end-doc))) (module+ test (require (only-in 2htdp/image circle text square overlay above)) (define im (overlay (above (circle 50 'solid 'red) (text "This is a red circle" 12 'black)) (square 150 'solid 'lightblue))) (image->pdf im "image-test.pdf") (save-image im "image-test.png"))
____________________ Racket Users list: http://lists.racket-lang.org/users