Click here to Skip to main content
16,015,393 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi..
I developing the report system, i am using RDLC for Generate report, i am almost finish my report work,now my problem is the report is automatically create in Pdf format and send the particular client email-id,i don't how it's possible, so pls send your ideas,
pls help me...
Posted

I Solve this problem in simple code, my code is below

VB
Dim byteViewer As Byte() = ReportViewer1.LocalReport.Render("PDF")
            Dim saveFileDialog1 As New SaveFileDialog()
            saveFileDialog1.Filter = "*PDF files (*.pdf)|*.pdf"
            saveFileDialog1.FilterIndex = 2
            saveFileDialog1.RestoreDirectory = True
            Dim newFile As New FileStream("D:\Company Reckon Invoice(ExE)\PDF Files\Invoice Due Details" & clientno & ".pdf", FileMode.Create)
            newFile.Write(byteViewer, 0, byteViewer.Length)
            newFile.Close()
 
Share this answer
 
Comments
Remoddn 16-Jun-15 5:26am    
I Want To PDF Page Margin This Below Code
Try this code:

C#
'Create an instance of ReportViewer
    
Dim viewer As New Microsoft.Reporting.WinForms.ReportViewer()

    'Set local report
    'NOTE: MyAppNamespace refers to the namespace for the app.
    viewer.LocalReport.ReportEmbeddedResource = "MyAppNamespace.Report1.rdlc"
                
    'Create Report Data Source
    Dim rptDataSource As New Microsoft.Reporting.WinForms.ReportDataSource("Product", data)
    viewer.LocalReport.DataSources.Add(rptDataSource)

    'Export to PDF. Get binary content.
    Dim pdfContent As Byte() = viewer.LocalReport.Render("PDF", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)

    'Creatr PDF file on disk
    Dim pdfPath As String = "C:\temp\report.pdf"
    Dim pdfFile As New System.IO.FileStream(pdfPath, System.IO.FileMode.Create)
    pdfFile.Write(pdfContent, 0, pdfContent.Length)
    pdfFile.Close()
 
Share this answer
 
Comments
sv sathish 15-Aug-13 7:01am    
It's showing error in Create Report Data Source. in this code what's mean by ("Product,data")
Marc Gabrie 15-Aug-13 7:34am    
Does your report have a data source? if yes, then:

"Product": you must change it to match the name of your report's data source name
data: it must be your data source obj e.g. a DataTable, a Collection, etc.
Member 12857508 5-Apr-17 10:31am    
Awesome, thanks!
Dim Bytes() As Byte = ReportViewer1.LocalReport.Render("PDF", "", Nothing, Nothing, Nothing, Nothing, Nothing)
Using Stream As New FileStream("D:\CabDB\Vouchers\" & cboVoucherNo.SelectedItem & ".pdf", FileMode.Create)
Stream.Write(Bytes, 0, Bytes.Length)
MsgBox("PDF File Exported Successfully.", MsgBoxStyle.Information, "PDF Exported")
End Using
 
Share this answer
 
Comments
CHill60 16-Jun-15 5:37am    
If you have a question of your own use the "Ask a Question" link. Don't post questions as solutions to old posts

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