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?