Quantcast
Viewing all articles
Browse latest Browse all 1507

how to open pdf(crystalreport ) in browser instead of download it

I converted crystal report to pdf but I want to open pdf in browser  directly instead of download pdf

I don't want show message to open pdf or save ,I want to preview pdf in browser to use link pdf crystal report 

this my code


                Dim rdoc As New ReportDocument
                Dim c As New CLSReports
                ' Dim dsd As DataSet = c.deposits()
                'dsd.WriteXmlSchema(HttpContext.Current.Server.MapPath("parprod.aspx").Replace("parprod.aspx", "xml\xdep.xml"))
                'Dim dse As DataSet = c.exits()
                'dse.WriteXmlSchema(HttpContext.Current.Server.MapPath("parprod.aspx").Replace("parprod.aspx", "xml\xext.xml"))
                'Dim dsi As DataSet = c.invoices()
                'dsi.WriteXmlSchema(HttpContext.Current.Server.MapPath("parprod.aspx").Replace("parprod.aspx", "xml\xinv.xml"))

                rdoc.Load(HttpContext.Current.Server.MapPath("parprod.aspx").Replace("parprod.aspx", "reports\crproduc.rpt"))


                Dim sfd As String
                Dim std As String
                If Session("sfd") = Nothing Then
                    sfd = "01/01/1900"
                Else
                    sfd = Session("sfd")
                End If
                If Session("std") = Nothing Then
                    std = "31/12/9999"
                Else
                    std = Session("std")
                End If
                Dim fdate As Integer = Val(Mid(Trim(sfd), 7, 4)) * 10000 + Val(Mid(Trim(sfd), 4, 2)) * 100 + Val(Mid(Trim(sfd), 1, 2))
                Dim tdate As Integer = Val(Mid(Trim(std), 7, 4)) * 10000 + Val(Mid(Trim(std), 4, 2)) * 100 + Val(Mid(Trim(std), 1, 2))

                Dim fromdate As String = Mid(Trim(fdate), 1, 4) & "/" & Mid(Trim(fdate), 5, 2) & "/" & Mid(Trim(fdate), 7, 2)
                Dim todate As String = Mid(Trim(tdate), 1, 4) & "/" & Mid(Trim(tdate), 5, 2) & "/" & Mid(Trim(tdate), 7, 2)

                Dim sec As Section
                Dim secs As Sections
                Dim rob As ReportObject
                Dim robs As ReportObjects
                Dim subrpobj As SubreportObject
                Dim subrp As ReportDocument

                Dim secext As CrystalDecisions.CrystalReports.Engine.Section = rdoc.ReportDefinition.Sections.Item("DetailSection1")
                Dim secinv As CrystalDecisions.CrystalReports.Engine.Section = rdoc.ReportDefinition.Sections.Item("DetailSection2")
                Dim sec3 As CrystalDecisions.CrystalReports.Engine.Section = rdoc.ReportDefinition.Sections.Item("Section3")
                secs = rdoc.ReportDefinition.Sections
                Dim stype As String = Session("styp")
                If Session("styp") = "01" Then
                    secext.SectionFormat.EnableSuppress = True
                    secinv.SectionFormat.EnableSuppress = True
                    sec3.SectionFormat.EnableSuppress = False

                    For Each sec In secs

                        robs = sec.ReportObjects

                        For Each rob In robs

                            If rob.Kind = ReportObjectKind.SubreportObject Then
                                subrpobj = CType(rob, SubreportObject)
                                subrp = subrpobj.OpenSubreport(subrpobj.SubreportName)
                                If subrp.Name = "deposits" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.deposits(fromdate, todate, Session("ster")))
                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.alldeposits(fromdate, todate))
                                    End If
                                End If
                            End If
                        Next
                    Next
                ElseIf Session("styp") = "02" Then
                    secext.SectionFormat.EnableSuppress = False
                    secinv.SectionFormat.EnableSuppress = True
                    sec3.SectionFormat.EnableSuppress = True

                    For Each sec In secs

                        robs = sec.ReportObjects

                        For Each rob In robs

                            If rob.Kind = ReportObjectKind.SubreportObject Then
                                subrpobj = CType(rob, SubreportObject)
                                subrp = subrpobj.OpenSubreport(subrpobj.SubreportName)

                                If subrp.Name = "exits" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.exits(fromdate, todate, Session("ster")))
                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.allexits(fromdate, todate))
                                    End If
                                End If
                            End If
                        Next
                    Next
                ElseIf Session("styp") = "03" Then
                    secext.SectionFormat.EnableSuppress = True
                    secinv.SectionFormat.EnableSuppress = False
                    sec3.SectionFormat.EnableSuppress = True


                    For Each sec In secs

                        robs = sec.ReportObjects

                        For Each rob In robs

                            If rob.Kind = ReportObjectKind.SubreportObject Then
                                subrpobj = CType(rob, SubreportObject)
                                subrp = subrpobj.OpenSubreport(subrpobj.SubreportName)
                                If subrp.Name = "invoices" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.invoices(fromdate, todate, Session("ster")))

                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.allinvoices(fromdate, todate))
                                    End If
                                End If
                            End If
                        Next
                    Next
                ElseIf Session("styp") = "0" Then
                    secext.SectionFormat.EnableSuppress = False
                    secinv.SectionFormat.EnableSuppress = False
                    sec3.SectionFormat.EnableSuppress = False

                    For Each sec In secs

                        robs = sec.ReportObjects

                        For Each rob In robs

                            If rob.Kind = ReportObjectKind.SubreportObject Then
                                subrpobj = CType(rob, SubreportObject)
                                subrp = subrpobj.OpenSubreport(subrpobj.SubreportName)
                                If subrp.Name = "deposits" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.deposits(fromdate, todate, Session("ster")))
                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.alldeposits(fromdate, todate))
                                    End If
                                ElseIf subrp.Name = "exits" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.exits(fromdate, todate, Session("ster")))
                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.allexits(fromdate, todate))
                                    End If
                                ElseIf subrp.Name = "invoices" Then
                                    If Session("ster") <> "0" Then
                                        subrp.SetDataSource(c.invoices(fromdate, todate, Session("ster")))

                                    ElseIf Session("ster") = "0" Then
                                        subrp.SetDataSource(c.allinvoices(fromdate, todate))
                                    End If
                                End If
                            End If
                        Next
                    Next

                End If

                Dim type As String = Session("styp")
                Dim terr As String = Session("sterr")
                rdoc.SetParameterValue("type", type)
                rdoc.SetParameterValue("terro", terr)
                rdoc.SetParameterValue("fromdate", fromdate)
                rdoc.SetParameterValue("todate", todate)

        rdoc.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, True, "Production Report")-> this to download pdf 
I want change it to open pdf in browser directly without download pdf

how can I do it ,please help me


Viewing all articles
Browse latest Browse all 1507

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>