Reputation: 51
Printing a PrintDocument to file using Microsoft XPS Document Writer in Windows 10 always throw exception 'The handle is invalid'. But in Windows 7 it is working perfectly.
The error throws when the PrinterSettings changed to custom page size. No error when printed without changing the PrinterSettings.
Could anyone explain how to overcome this issue in C# Windows Forms application executed in Windows 10?
Upvotes: 0
Views: 549
Reputation: 51
SORRY FOR THE TROUBLE I MADE. The error was related to a minor error in calculating the page height and width. I passed value slightly lower than the actual page height and width.
Conclusion
In windows 7 minor variations in page settings will not affect the actual print, but in Windows 10 and Windows Server 2012, the page settings must be accurate.
Upvotes: 1