Click here to Skip to main content
15,867,594 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have to send an xps file to a physical printer using .NET6 and Winforms.
I found this example, butt it doesn't work in .net, for example PrintDialog doesn't contain a definition or PrintDocument.
I would also like to specify copies, printer and duplex

What I have tried:

PrintDialog dlg = new PrintDialog();
XpsDocument xpsDoc = new XpsDocument(PATH_TO_YOUR_XPS_FILE_HERE, System.IO.FileAccess.Read);
dlg.PrintDocument(xpsDoc.GetFixedDocumentSequence().DocumentPaginator, "Document title");
Posted
Updated 29-Dec-21 8:32am
v3

1 solution

 
Share this answer
 
Comments
Richard MacCutchan 29-Dec-21 12:11pm    
Did you try it?
Richard MacCutchan 29-Dec-21 12:19pm    
Are you the same person who posted this question?
Member 13805520 29-Dec-21 14:24pm    
I forgot to specify that my application works in winforms .net 6.
This solution does not work well in winforms. Seems to work well in WPF .NET

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900