Silverlight 中的页面方向
我想使用 PrintDocument 在 Silverlight 4 中打印我的文档。但我想使用纸张的横向方向。我使用这样的代码:
public Run()
{
var pd = new PrintDocument();
pd.PrintPage += new EventHandler<PrintPageEventArgs>(pd_PrintPage);
pd.Print();
}
void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.PageVisual = myPaper;
}
我们可以使用 PrintPageEventArgs 进行修改页打印。但我们不能使用PrintPageEventArgs.PrintableArea(PrintableArea总是使用纵向)。我能用它做什么?
I want to print my document in Silverlight 4 with PrintDocument. But I want to use Landscape orientation of paper. I use code like this:
public Run()
{
var pd = new PrintDocument();
pd.PrintPage += new EventHandler<PrintPageEventArgs>(pd_PrintPage);
pd.Print();
}
void pd_PrintPage(object sender, PrintPageEventArgs e)
{
e.PageVisual = myPaper;
}
We can use PrintPageEventArgs for modification page print. But we can't PrintPageEventArgs.PrintableArea (PrintableArea always use portrait orientation). What I can do with it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我们遇到了同样的问题,并认为 silverlight 无法访问打印机对话框(因为它是沙盒的),因此我们记录了此功能,并让用户在打印机对话框和应用程序内设置方向。这样,打印输出是正确的,但这确实很难看。
如果有人知道更好的解决方案,我将不胜感激!
We had the same issue and decided that silverlight has no way of access to the printer dialog (as it is sandboxed) so we documented this feature and let our users set the orientation in the printer dialog and inside the application. this way, the printout is correct, but this is really ugly.
I would appreciate anyone knowing a better solution to this!