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. General Programming
  3. C#
  4. How to export pdf data (byte[] format) from SQL database to PDF using C# ?

How to export pdf data (byte[] format) from SQL database to PDF using C# ?

Scheduled Pinned Locked Moved C#
databasecsharptutorialquestion
4 Posts 2 Posters 1 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.
  • T Offline
    T Offline
    taibc
    wrote on last edited by
    #1

    Hi everyone, I saved a pdf file into my database in byte[] format. And now, I want to show it in PDF reader program when clicking a button. But I don't want to create the pdf file in my hard drives (because, if create it, I need to delete it). Do you know how to export my data to pdf ? Thanks and regards, Tai

    OriginalGriffO 1 Reply Last reply
    0
    • T taibc

      Hi everyone, I saved a pdf file into my database in byte[] format. And now, I want to show it in PDF reader program when clicking a button. But I don't want to create the pdf file in my hard drives (because, if create it, I need to delete it). Do you know how to export my data to pdf ? Thanks and regards, Tai

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Apparently, it can be done - in C++ - but it's very complex, since Adobe PDF reader doesn't accept memory directly. See here: http://forums.adobe.com/message/2018299#2018299[^] I've also seen a suggestion that you should create a ramdisk at runtime, save it to that, and open the file from there - which kinda indicates the level of desperation you need to have to do it. Basically, I'd go with a "save it as a file in a particular folder and purge the folder regularly" approach, or possibly convert the PDF to HTML and display that. But there doesn't appear to be a "nice" solution.

      Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      T 1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

        Apparently, it can be done - in C++ - but it's very complex, since Adobe PDF reader doesn't accept memory directly. See here: http://forums.adobe.com/message/2018299#2018299[^] I've also seen a suggestion that you should create a ramdisk at runtime, save it to that, and open the file from there - which kinda indicates the level of desperation you need to have to do it. Basically, I'd go with a "save it as a file in a particular folder and purge the folder regularly" approach, or possibly convert the PDF to HTML and display that. But there doesn't appear to be a "nice" solution.

        Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

        T Offline
        T Offline
        taibc
        wrote on last edited by
        #3

        Very useful. Thank you very much !

        OriginalGriffO 1 Reply Last reply
        0
        • T taibc

          Very useful. Thank you very much !

          OriginalGriffO Offline
          OriginalGriffO Offline
          OriginalGriff
          wrote on last edited by
          #4

          You're welcome - sorry it's not better news!

          Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952) Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)

          "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
          "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

          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