我目前正在尝试使用
法典如下:
op <- printOperationNew
on op printOptBeginPrint $ context -> do
set op [ printOperationNPages := 1]
return ()
on op printOptDrawPage $ context pages - do
let text = "Hello World"
putStrLn $ "Printing :" ++ text
--cairo
cairoContext<- printContextGetCairoContext context
--pango
layout<- printContextCreatePangoLayout context
layoutSetText layout text
let _ = do
--inside the Render Monad
showLayout layout
return ()
return ()
result <- printOperationRun op PrintOperationActionPrintDialog window
This prints an empty page since I set the printOperationNPages
to 1.
The problem is that cairo does not draw anything. I suppose I have to
connect the cairoContext
with the pango layout, the proper call to
showLayout
would actually be pango_cairo_show_layout (cr, layout);
.
我已在邮寄特克2hs名单中讨论了这一问题。
因此,如果有人有这方面的经验,请让我知道。 我也要感谢其他更好的依赖平台的解决办法,即印刷纸面文件/文字。
Link to conversation: [1] http://sourceforge.net/mailarchive/message.php?msg_id=27662267
GTK(2hs) in Hackage: http://hackage.haskell.org/package/gtk-0.12.0