[racket] printer-dc% and end-doc

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Nov 20 09:16:05 EST 2012

I've pushed a repair for this bug to the git repo. Meanwhile, a
workaround is to wrap the `end-doc' call as

 (with-handlers ([exn:fail:contract? void])
   (send dc end-doc))

At Tue, 20 Nov 2012 09:20:06 +0100, "Nikolaus Klepp" wrote:
> Thanks to Matthew I have a printer dialog :-)
> 
> I can actually print a page, but  (send dc end-doc) throws an error.
> 
> Example:
> 
> (define pss (get-page-setup-from-user "Drucke das Wunderwerk"))
>   (when pss
>     (current-ps-setup pss)
>     (define dc (new printer-dc%))
>     (send dc start-doc "")
>     (send dc start-page)
>     (send dc set-scale 3 3)
>     (send dc set-text-foreground "blue")
>     (send dc draw-text "Don't Panic!" 0 0)
>     (send dc end-page)
>     (send dc end-doc))
> 
>  meth: broke its contract
>  promised: void?
>  produced: #<semaphore>
>  in: the range of
>       (->m void?)
>  contract from: (class printer-dc%)
>  blaming: (class printer-dc%)
> 
> Well, the page is printed, but I would like to get rid of that error. Any way 
> to do that?
> 
> Nik
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.