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
  1. Home
  2. Web Development
  3. Export the PDF file

Export the PDF file

Scheduled Pinned Locked Moved Web Development
adobearchitecturehelp
5 Posts 3 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.
  • R Offline
    R Offline
    r aa j
    wrote on last edited by
    #1

    hi all, I want export the pdf file.and I am using following code.In my system .But an error is displaying like adobe readercould not open 'down.pdf' because it is either not a supported file type or because the file has been damaged... DataSet Ds = FillGrid2(sessionvalue, cid, cmid, crid, pid, sdate, edate); Response.Clear(); Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-disposition", "attachment; filename=Download.pdf"); string str = "<table style='border:1px solid #000000;'>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Client: </b>" + client + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Campaign: </b>" + campaign + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Report Summary</b>" + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td>" + "Type" + "</td>"; str += "<td>" + "Impression" + "</td>"; str += "<td>" + "Clicks" + "</td>"; str += "<td>" + "Start Date" + "</td>"; str += "<td>" + "End Date" + "</td>"; str += "</tr>"; for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { str += "<tr style='border:1px solid #000000;'>"; for (int j = 0; j < Ds.Tables[0].Columns.Count; j++) { str += "<td>" + Ds.Tables[0].Rows[i][j].ToString() + "</td>"; } str += "</tr>"; } str += "</table>"; Response.Write(str); If anybody knows please reply me.. thanks...

    Raaj

    J 1 Reply Last reply
    0
    • R r aa j

      hi all, I want export the pdf file.and I am using following code.In my system .But an error is displaying like adobe readercould not open 'down.pdf' because it is either not a supported file type or because the file has been damaged... DataSet Ds = FillGrid2(sessionvalue, cid, cmid, crid, pid, sdate, edate); Response.Clear(); Response.AppendHeader("Content-Type", "application/pdf"); Response.AppendHeader("Content-disposition", "attachment; filename=Download.pdf"); string str = "<table style='border:1px solid #000000;'>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Client: </b>" + client + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Campaign: </b>" + campaign + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td colspan='5'>" + "<b>Report Summary</b>" + "</td>"; str += "</tr>"; str += "<tr>"; str += "<td>" + "Type" + "</td>"; str += "<td>" + "Impression" + "</td>"; str += "<td>" + "Clicks" + "</td>"; str += "<td>" + "Start Date" + "</td>"; str += "<td>" + "End Date" + "</td>"; str += "</tr>"; for (int i = 0; i < Ds.Tables[0].Rows.Count; i++) { str += "<tr style='border:1px solid #000000;'>"; for (int j = 0; j < Ds.Tables[0].Columns.Count; j++) { str += "<td>" + Ds.Tables[0].Rows[i][j].ToString() + "</td>"; } str += "</tr>"; } str += "</table>"; Response.Write(str); If anybody knows please reply me.. thanks...

      Raaj

      J Offline
      J Offline
      Johnny
      wrote on last edited by
      #2

      You seem to be creating a HTML table, pretending it's a PDF file, and then hoping the browser can handle all the minor complications of converting it to a real PDF file?

      R 1 Reply Last reply
      0
      • J Johnny

        You seem to be creating a HTML table, pretending it's a PDF file, and then hoping the browser can handle all the minor complications of converting it to a real PDF file?

        R Offline
        R Offline
        r aa j
        wrote on last edited by
        #3

        please give me the solution.

        Raaj

        A J 2 Replies Last reply
        0
        • R r aa j

          please give me the solution.

          Raaj

          A Offline
          A Offline
          Ashfield
          wrote on last edited by
          #4

          Try this [^], it should give you all the information you need.

          Bob Ashfield Consultants Ltd

          1 Reply Last reply
          0
          • R r aa j

            please give me the solution.

            Raaj

            J Offline
            J Offline
            Johnny
            wrote on last edited by
            #5

            You cannot convert HTML to PDF by simply saying that it's a PDF file. I'd suggest taking some time to investigate exactly what HTML and PDF are, why they are different, and how you would use a server-based solution to convert from one to the other. As someone else has suggested, Google will undoubtedly be your friend here.

            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