{curl 8.0 applet}

{document-style PlainDocument}

{let
    (offscreen-r2d:Renderer2d, offscreen-drawable:Drawable) =
        {Renderer2d.create-offscreen 4cm, 4cm, resolution = 300dpi}
}

{let g:Graphic =
    {Frame width = 4cm,height = 4cm,{TextFlowBox horigin = "left",vorigin = "top","testあいうえお"}}
}

{Frame
    {VBox
        g,
        {CommandButton
            label = "to-PDF",
            {on Action do
                {offscreen-r2d.clear fill-pattern = "white"}
                {g.draw offscreen-r2d}
                {print-graphic-pdf
                    {Frame
                        width = 4cm,height = 4cm,
                        background = {FillPattern {offscreen-drawable.to-Pixmap}}
                    },
                    {url |"file:///c:\test.pdf"|}
                }
            }
        }
    },
    width = {make-elastic},
    height = {make-elastic},
    opaque-to-events? = true,
    {context-popup
        menu-pane =
            {MenuPane
                {MenuAction
                    label = "create PDF",
                    {on Action do
                        {offscreen-r2d.clear fill-pattern = "white"}
                        {g.draw offscreen-r2d}
                        {print-graphic-pdf
                            {Frame
                                width = 4cm,height = 4cm,
                                background = {FillPattern {offscreen-drawable.to-Pixmap}}
                            },
                            {url |"file:///c:\test.pdf"|}
                        }
                    }
                }
            }
    }
}