WPF PrintVisual - Selecting XPS in print dialog causing errors
I've spent some time searching for related topics on this, but haven't found any...
My problem is that I am getting a few errors when trying to select the Print to Microsoft XPS Document Error.
- If I choose Print, I'll get the Save dialog. If I select a file and hit OK, it'll properly save my XPS file, but I noticed my WPF window turns all white, like it crashed. When开发者_如何学运维 trying to open up the XPS file from explorer, the content is correct.
- If I choose Print, and then hit Cancel on the Save dialog, I'll get "Win32 error: The data area passed to a system call is too small".
The code I am doing is
PrintDialog dialog = new PrintDialog();
if (dialog.ShowDialog() == true)
{
dialog.PrintVisual(this.myStackPanel, string.Empty);
}
I have seen other posts about writing much more in depth printing code, but right now this all the code is doing (I inherited this from another developer). Does anyone have a fix for this issue? Thanks.
精彩评论