Click here to Skip to main content
15,920,111 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am Aisha from Delhi, India
I generate a report in printdocument control that is a print annexure of bank but I want that printdocument annexure to save automatically when the user clicks on print button. Please can anyone help me?
Posted
Updated 17-Feb-11 3:44am
v2

Hope[^]this will give you an idea.
 
Share this answer
 
use save dialog box coding on your print button.
 
Share this answer
 
Comments
awarahoo 17-Feb-11 6:09am    
sir but when we use savedialogbox then it is not save whole printpreview as it is formet i used below code
Try

If Me.saveFileDialog1.ShowDialog() = DialogResult.OK Then

Dim fs As New FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.Write)
Dim m_streamWriter As New StreamWriter(fs)
m_streamWriter.Flush()


m_streamWriter.BaseStream.Seek(0, SeekOrigin.Begin)


m_streamWriter.Write(Me.PrintDocument1.DefaultPageSettings.Clone)


m_streamWriter.Flush()
m_streamWriter.Close()
End If
Catch em As Exception
End Try

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