theoryofben
IS-IT--Management
Hello,
I have reporting services report viewer. I am loading a server report to the viewer. This works fine. I have a button and when it is clicked, I want to export the report to PDF and save it on the server.
When the user clicks the button, the pdf is being saved just fine on the server, but I'm getting an open/save prompt anyway..even though the pdf has already been saved on the server. How can I disable that prompt?
Here is the code.
What am I doing wrong? Any ideas?
________________________________________________
[sub]"I have not failed. I've just found 10,000 ways that won't work."-Thomas Edison[/sub]
I have reporting services report viewer. I am loading a server report to the viewer. This works fine. I have a button and when it is clicked, I want to export the report to PDF and save it on the server.
When the user clicks the button, the pdf is being saved just fine on the server, but I'm getting an open/save prompt anyway..even though the pdf has already been saved on the server. How can I disable that prompt?
Here is the code.
Code:
Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing
Dim streamids As String() = Nothing
Dim mimeType As String = Nothing
Dim encoding As String = Nothing
Dim extension As String = Nothing
Dim DeviceInfo As String = "<DeviceInfo>" _
& " <OutputFormat>PDF</OutputFormat>" _
& " <PageWidth>8.5in</PageWidth>" _
& " <PageHeight>11.5in</PageHeight>" _
& " <MarginTop>0.5in</MarginTop>" _
& " <MarginLeft>0.5in</MarginLeft>" _
& " <MarginRight>0.4in</MarginRight>" _
& " <MarginBottom>0.4in</MarginBottom>" _
& "</DeviceInfo>"
Dim bytes As Byte()
bytes = rpv1.ServerReport.Render("PDF", DeviceInfo, mimeType, encoding, extension, streamids, warnings)
Response.Clear()
Response.ContentType = mimeType
Response.AddHeader("content-disposition", "attachment; filename=Test7." & extension)
Try
File.WriteAllBytes("C:\onetwothree.pdf", bytes)
Catch ex As Exception
End Try
Response.End()
What am I doing wrong? Any ideas?
________________________________________________
[sub]"I have not failed. I've just found 10,000 ways that won't work."-Thomas Edison[/sub]