Click here to Skip to main content
16,008,299 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Everybody,

I want to take print out like super market bill in small size and A4 size. I dont know how to apply this in vb.net. If anybody know please help me.


Thanks in advance.
Posted

1. Create a page(print.aspx) with all the details you required on printing page.

2. Place a button on the page and onclick of that button simply open the print.aspx page with below code.

<a href="javascript:void(0);" onclick="window.open('print.aspx?orderID=<%# Container.DataItem("OrderId") %>','','width=100,height=200,scrollbars=1');">
   </a>


3. Here in the above code snippest, order id is passed as query string to print.aspx. Purpose of that is to fetch all the needed information on the print page by order id

4. On the page load of print.aspx, first fetch all the required stuff and assign it to appropriate control, then simply add below line in the page load .

ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), "print", "window.print();", True)


5. With the above line, after page load, print dialogue will appear so that use can print that particular page.

Hope it helps.
 
Share this answer
 
You need to look into the System.Drawing.Printing Namespace, specifically the PrintDocument class. Here is a link to the MSDN article PrintDocument Class[^]. This page has a good example as well.

Hope this helps
 
Share this answer
 

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