0

I have a Code where I can upload files (doc, txt) and save it sql and I want that user can click on a download button and download the file in pdf. So it should convert the doc in pdf.

Jana Pasch
  • 9
  • 1
  • 9
  • 2
    Maybe this will help you [http://stackoverflow.com/questions/607669/how-do-i-convert-word-files-to-pdf-programmatically](http://stackoverflow.com/questions/607669/how-do-i-convert-word-files-to-pdf-programmatically) – Dlyx Nov 11 '16 at 13:42
  • What exactly are you saving in your database? – Dan Bracuk Nov 11 '16 at 13:43
  • I suggest you check out [GemBox.Document](http://www.gemboxsoftware.com/document/overview), what you can do with it on user's click is to retrieve the byte array of DOC or TXT file from your DB, create a stream from that array, load that document's stream into a DocumentModel and save that DocumentModel to PDF file or stream, [see this](http://www.gemboxsoftware.com/support-center/kb/articles/30-working-with-document-file-stream). – Mario Z Nov 14 '16 at 06:32

1 Answers1

0

You have a couple options for handling this within your application:

  • You can convert the DOC / TXT file before saving it to the SQL db
  • Or you can do this on-the-fly when the user clicks the download button.

Either way, you will need a SDK, API, or utility to do the conversion. There are quite a bit of information already on this on the web, here are some links you should take a look at to see how to do the conversion in C#:

net library to convert microsoft office docs to pdf

How do I convert Word files to PDF programmatically?

hcham1
  • 1,799
  • 2
  • 16
  • 27