开发者

How do you prevent PrintDocument in Silverlight 4 of producing extremely large spooling data?

I've created a bare bones example to try and figure out why the data being sent to the printer is so large. I'm sending one text box with "Printing text." as its content. This results in ~90MB being sent to the printer. Why is this so large?

Can someone please explain how I can avoid this?

Here is my example

<StackPanel x:Name="LayoutRoot" Orientation="Vertical">
    <Button Content="Print" Click="Button_Click" Width="50" Height="20"/> 
    <TextBox x:Name="tbPrintableTextBox" Text="Printing test." Width=开发者_JAVA技巧"300" Height="20"/>
</StackPanel>  

And the code:

public partial class Print : Page
{
    PrintDocument pd;

    public Print()
    {
        InitializeComponent();

        // Create new a new PrintDocument object 
        pd = new PrintDocument();
        pd.PrintPage += new EventHandler<PrintPageEventArgs>(pd_PrintPage);

    }
    // Executes when the user navigates to this page.
    protected override void OnNavigatedTo(NavigationEventArgs e)
    {
    }

    void pd_PrintPage(object sender, PrintPageEventArgs e)
    { 
        e.PageVisual = tbPrintableTextBox; 
    }

    private void Button_Click(object sender, RoutedEventArgs e)
    { 
        pd.Print("Print test");
    }


}


http://forums.silverlight.net/forums/p/180585/409402.aspx

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜