Print Preview Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • istiyaque
    New Member
    • Feb 2008
    • 9

    Print Preview Error

    hi,

    I am intermediate in programming and i am getting error on print preview command in my program.
    Actually i had made a website using vb.net code. and i have a DailyUpdateRepo rt.aspx page. in that i putted one image button and on image button i putted the code below..
    Code:
    Private Sub ImagebuttonPP_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImagebuttonPP.Click
            Try
                Dim oStringWriter As New System.IO.StringWriter
                Dim oHtmlTextWriter As New System.Web.UI.HtmlTextWriter(oStringWriter)
                'Dim oHtmlTextWriter As New System.Xml.XmlTextWriter(oStringWriter)
                Response.Clear()
                Response.Buffer = True
                Response.ContentType = "application/pdf"
                Response.Charset = ""
                Me.EnableViewState = False
                DG1.RenderControl(oHtmlTextWriter)
                Response.Write(oStringWriter.ToString())
                Response.End()
            Catch ex As Exception
                lblErr.Visible = True
                lblErr.Text = ex.Message
            End Try
        End Sub
    before few months its working fine and opening the that aspx page as on print preview in pdf. but now its giving error
    ' File does not begin with %pdf- '
    I am using a Adobe Reader 9, version 9.3.2
    and Internet Explorer 8
    i don't know what is the problem. and how to resolve the problem.
    can anyone knows the solution than please help out.
    if u r not understand anything on problem then let me know to explain.
    its very urgent.

    Thanks
    Ishtiyaque.
    Last edited by Frinavale; May 20 '10, 03:09 PM. Reason: Please post code in [code] ... [/code] tags. Added code tags.
Working...