Click here to Skip to main content
15,895,192 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
hi,
how we set paper size in printdocument? I want to print my webpage in small size like (200 X 200).Please Reply
Posted
Updated 13-Jun-18 6:44am

Hi,
C#
PrintDocument pd = new PrintDocument();

pd.DefaultPageSettings.PaperSize = pd.PrinterSettings.PaperSizes(200,200);


Hope this helps...

Enjoy Coding...
 
Share this answer
 
Comments
Member 10445097 1-Mar-14 9:17am    
i used this line of code its says that "Non-invocable member 'System.Drawing.Printing.PrinterSettings.PaperSizes' cannot be used like a method.
PS Solutions 29-Jul-17 5:44am    
pd.DefaultPageSettings.PaperSize = pd.PrinterSettings.PaperSizes("custom",200,200);
Member 14520531 6-Aug-19 1:53am    
200,200 wht is this cm or millimeter
jinesh sam 5-Nov-14 15:46pm    
Me to getting the same Error 14 Non-invocable member 'System.Drawing.Printing.PrinterSettings.PaperSizes' cannot be used like a method.
 
Share this answer
 
printDocument1.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("custom", 200, 200);
printPreviewDialog1.Document = printDocument1;
printPreviewDialog1.ShowDialog();
 
Share this answer
 
v2
Comments
Maciej Los 14-Jun-18 2:33am    
6 years too late!

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



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