0

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?

Vijayakumar
  • 51
  • 1
  • 9

1 Answers1

1

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.

Vijayakumar
  • 51
  • 1
  • 9