Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. PDF Download Error.

PDF Download Error.

Scheduled Pinned Locked Moved ASP.NET
helpadobesysadmintutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    nccs1234
    wrote on last edited by
    #1

    I have Created a pdf file by using pdfSharp and save in a location.but when i want to open that pdf file on the link button click event down load dialogue box is appear and when i clicked the open button.Adobe Reader throws the Strange Error message.the Error Message is Adobe Reader couldn't open "invoice__2009[1].pdf because it is either not supported file type or because the file has been damaged(for example it was sent as an email attachment and wasn't correctly decoded) (my filename is only invoice__2009 but [1] is extra comming in the message) can you help me for this matter? My code sample is string inv = Session["invN0"].ToString(); Response.Clear(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + inv); Response.TransmitFile(Server.MapPath(("~/") + "Shopping/pdfInvoice/" + inv)); Response.End(); Thank You Pawan

    A 1 Reply Last reply
    0
    • N nccs1234

      I have Created a pdf file by using pdfSharp and save in a location.but when i want to open that pdf file on the link button click event down load dialogue box is appear and when i clicked the open button.Adobe Reader throws the Strange Error message.the Error Message is Adobe Reader couldn't open "invoice__2009[1].pdf because it is either not supported file type or because the file has been damaged(for example it was sent as an email attachment and wasn't correctly decoded) (my filename is only invoice__2009 but [1] is extra comming in the message) can you help me for this matter? My code sample is string inv = Session["invN0"].ToString(); Response.Clear(); Response.ClearHeaders(); Response.ContentType = "application/pdf"; Response.AppendHeader("Content-Disposition", "attachment; filename=" + inv); Response.TransmitFile(Server.MapPath(("~/") + "Shopping/pdfInvoice/" + inv)); Response.End(); Thank You Pawan

      A Offline
      A Offline
      Abhishek Sur
      wrote on last edited by
      #2

      Check the response. I think you are ending the response before writing the output. Also use Response.BinaryWrite to write binary data in response. :cool:

      Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


      My Latest Articles-->** Simplify Code Using NDepend
      Basics of Bing Search API using .NET
      Microsoft Bing MAP using Javascript

      N 1 Reply Last reply
      0
      • A Abhishek Sur

        Check the response. I think you are ending the response before writing the output. Also use Response.BinaryWrite to write binary data in response. :cool:

        Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.


        My Latest Articles-->** Simplify Code Using NDepend
        Basics of Bing Search API using .NET
        Microsoft Bing MAP using Javascript

        N Offline
        N Offline
        nccs1234
        wrote on last edited by
        #3

        I also tried that but the result is same. This code works when I used it on same Block where i generate the pdf.But when i pass the Pdf file name in session and used it in the Button click event this error throws.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups