Silverlight 5 中的矢量打印字形

发布于 2024-12-29 12:33:07 字数 1433 浏览 2 评论 0原文

我正在尝试使用 Silverlight 5 的矢量打印功能打印包含字形元素的画布。除了字形不被打印之外,一切工作正常。矢量打印是否支持字形?如果是这样,我做错了什么?我正在尝试打印在屏幕上正确显示的以下画布:

        <Canvas x:Name="canvasToPrint" Margin="-96,-34,0,0" Grid.ColumnSpan="2" Background="AliceBlue">
        <Rectangle Fill="Blue" Width="39" Height="36"/>
        <Glyphs Name="a0" Fill="#FF000000" FontUri="36481AB7-37EB-642E-4A01-FB63CC6ED952.odttf" FontRenderingEmSize="11.04" StyleSimulations="None" OriginX="72.024" OriginY="82.464" UnicodeString="Hello, World!" Indices=",61.957;,50;,22.826;,22.826;,53.261;,25;,21.739;,89.13;,53.261;,34.783;,22.826;,52.174;">
        </Glyphs>
        <Button Height="25" Content="Print" Click="Button_Click"/>
    </Canvas>

使用以下打印按钮代码:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        PrintDocument doc = new PrintDocument();
        doc.BeginPrint += new EventHandler<BeginPrintEventArgs>(BeginPrinting);
        doc.PrintPage += new EventHandler<PrintPageEventArgs>(PrintNextPage);
        doc.Print("vector");
    }

    private void BeginPrinting(Object sender, BeginPrintEventArgs e)
    {

    }

    private void PrintNextPage(Object sender, PrintPageEventArgs e)
    {
        e.PageVisual = canvasToPrint;
        e.HasMorePages = false;
    }

请注意,如果我将 doc.Print 切换到 doc.PrintBitmap,则所有内容都会正确打印

I am trying to print a Canvas that contains a glyph element using Silverlight 5's vector printing capacity. Everything works fine except that glyphs do not get printed. Are glyphs supported by vector printing? If so, what am I doing wrong? I am trying to print the following canvas that shows up correctly on the screen:

        <Canvas x:Name="canvasToPrint" Margin="-96,-34,0,0" Grid.ColumnSpan="2" Background="AliceBlue">
        <Rectangle Fill="Blue" Width="39" Height="36"/>
        <Glyphs Name="a0" Fill="#FF000000" FontUri="36481AB7-37EB-642E-4A01-FB63CC6ED952.odttf" FontRenderingEmSize="11.04" StyleSimulations="None" OriginX="72.024" OriginY="82.464" UnicodeString="Hello, World!" Indices=",61.957;,50;,22.826;,22.826;,53.261;,25;,21.739;,89.13;,53.261;,34.783;,22.826;,52.174;">
        </Glyphs>
        <Button Height="25" Content="Print" Click="Button_Click"/>
    </Canvas>

With the following code for a print button:

    private void Button_Click(object sender, RoutedEventArgs e)
    {
        PrintDocument doc = new PrintDocument();
        doc.BeginPrint += new EventHandler<BeginPrintEventArgs>(BeginPrinting);
        doc.PrintPage += new EventHandler<PrintPageEventArgs>(PrintNextPage);
        doc.Print("vector");
    }

    private void BeginPrinting(Object sender, BeginPrintEventArgs e)
    {

    }

    private void PrintNextPage(Object sender, PrintPageEventArgs e)
    {
        e.PageVisual = canvasToPrint;
        e.HasMorePages = false;
    }

Note that everything prints correctly if I switch doc.Print to doc.PrintBitmap.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文