I have a problem, that i'm trying to solve for about a week now and I decided to sign up and ask you, because everything I have tried has failed.
I have WPF application written in C#. My biggest concern is printing. I have following piece of code:
TransformedBitmap tb = new TransformedBitmap();
RotateTransform transform = new RotateTransform(90);
tb.BeginInit();
tb.Source = myBitmapImage;
tb.Transform = transform;
tb.EndInit();
PrintDialog myPrintDialog = new PrintDialog();
var dv = new DrawingVisual();
using (var dc = dv.RenderOpen())
{
dc.DrawImage(tb, new Rect(0, 0, myPrintDialog.PrintableAreaWidth, myPrintDialog.PrintableAreaHeight));
}
myPrintDialog.PrintVisual(dv, "Image");
I have tried this code on few computers, with different Windows versions. Works fine on Win 10, Win 8.1, Win 7, even on my old Win XP.
But lately I have tried to run this application on ASUS X553M with Win 8.1. Application hangs after code given above. And of course, nothing is printed.
I took closer look to the code, I've debugged this code and I figure out that it stops in line:
myPrintDialog.PrintVisual(dv, "Image");
File is sent to printer, but nothing more happens. Interesting thing is, that in printer's queue file has status: "buffering" all the time and doesn't change. I've tried with few printers, both physical and virtual printers - same thing, never ending buffering... Another strange thing, I have tested printers and they seems to be working correctly. Printing test page from printer's driver has succeeded.
It is strange thing for me, because - as I said - code works fine on other computers. In last few days I have searched answer in the Internet, I have cleaned and reset print spooler service in Windows system. I have installed every possible update on that Asus X553M Win 8, I have even updated it to Windows 10. I've created a new account, for new admin user, because I thought maybe user profile is corrupt. And nothing changed, still doesn't printing... and application still hangs on that line.
I would appreciate every clue, what can be wrong or where should I look... I'm counting on your suggestions. I have to make this laptop (or my app) work properly. Changing laptop is not an option, so you are my last hope. Thanks in advance!