2010-10-21 63 views
1

我创建了一个简单的骨骼示例,试图找出为什么发送到打印机的数据太大。我正在发送一个带有“打印文本”的文本框。作为其内容。这导致~90MB被发送到打印机。为什么这么大?如何防止Silverlight 4中的PrintDocument产生非常大的假脱机数据?

有人可以解释我怎么能避免这种情况?

这里是我的榜样

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

,代码:

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"); 
    } 


} 

回答