www.webdeveloper.com
Results 1 to 12 of 12

Thread: Convert word doc to pdf

Hybrid View

  1. #1
    Join Date
    Apr 2005
    Location
    My Home :D
    Posts
    106

    Convert word doc to pdf

    Convert word doc to pdf

    How can I convert a word doc uploaded by the user to a pdf?
    How can I store the converted pdf in the database?

    am using asp.net 1.1 and vb.net

    Nina

  2. #2
    Join Date
    Nov 2002
    Location
    Auburn, AL
    Posts
    9,224
    To store a pdf in the db, we just use an image data type in sql server. It is pretty much the same as putting anything else in the db, except the sql parameter for the file would be something more like
    Code:
    Dim imagebytes(uploadcntrl.PostedFile.InputStream.Length) As Byte
    uploadcntrl.PostedFile.InputStream.Read(imageBytes, 0, imagebytes.Length)
    yourCommand.Parameters.AddWithValue("@Imageparam", imagebytes)
    where uploadcntrl is an asp:FileUpload

    As for converting a word doc to a pdf however, I haven't the faintest idea on how one would accomplish that. There might be some third party software that could handle it, but I have no idea how one would code that up.

  3. #3
    Join Date
    Sep 2004
    Location
    Northeast, FL
    Posts
    332
    We use products from a company called ActivePDF for converting most every common file type to PDF. I believe Adobe may have their own products now too. Basically, for a Word document, it opens the word document in Word, saves it back out as a postscript file and then converts it to PDF. So the server that would be hosting the process would have to have MS Office installed on it. It's really pretty simple, you put a file in an input directory and sometime later the PDF pops out into an output directory. It does expose an API that you can use with the .Net framework, but I've yet to have used it.

    As for saving the file to a MsSql, PeOfEo is right on with his example. It is just that easy. But, a word of warning, depending on the number of files you plan on storing, this could get ugly. Your DBA, might get a little peeved about the amount of disk space the DB is taking and the cost of backing up the database. We've briefly considered the option for our electronic records system, but quickly realized that it was a bad move.

  4. #4
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,
    you can read the word document into you .net application then use Crystal Reports to create your PDF file.
    ----------------------------------

  5. #5
    Join Date
    Apr 2005
    Location
    My Home :D
    Posts
    106
    thank you Ribeyed

    but can you explain more? I mean how can i read the word doc into my application?

  6. #6
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,
    sure.
    First you need the Primary Interop Assemblies installed for either 2003 or 2005 Office. Then is just the case of openning and reading the word document in to your application.

    Here are some examples:
    http://www.codeproject.com/office/csautomateword.asp
    http://www.siteexperts.com/forums/vi...asp?d_id=19402

    Code:
    Dim AppWord As New Word.Application
    Dim WordDoc As Word.Document
    
    WordDoc = AppWord.Documents.Open(FileName)
    Once you have your document you can then use Crystal Reports to convert to pdf.
    http://www.codeproject.com/useritems/JatsArticle1.asp

    Hope that helps
    ----------------------------------

  7. #7
    Join Date
    Jan 2014
    Location
    On the earth
    Posts
    67
    Quote Originally Posted by Ribeyed View Post
    Hi,
    sure.
    First you need the Primary Interop Assemblies installed for either 2003 or 2005 Office. Then is just the case of openning and reading the word document in to your application.

    Here are some examples:
    http://www.codeproject.com/office/csautomateword.asp
    http://www.siteexperts.com/forums/vi...asp?d_id=19402

    Code:
    Dim AppWord As New Word.Application
    Dim WordDoc As Word.Document
    
    WordDoc = AppWord.Documents.Open(FileName)
    Once you have your document you can then use Crystal Reports to convert to pdf.
    http://www.codeproject.com/useritems/JatsArticle1.asp

    Hope that helps

    Great help buddy.. It's pretty good and working for my project. Thanks Ribeyed
    There is a lots of but choose the best Website Design Companies among them, After upload the site Web Maintenance is also important.

  8. #8
    Join Date
    Aug 2009
    Posts
    1
    Convert Word documents to PDF on Serverside with Word 2007. See article on Codeproject:
    http://www.codeproject.com/KB/aspnet...erconvert.aspx

  9. #9
    Is there really a need to store the file in your database. Why not just upload it to a directory and store the path to it in your database?

  10. #10
    Join Date
    Apr 2013
    Posts
    26
    If you wanna save these complicated steps and find a easy way, you can google PDF to word Converter and you will find many useful tools, or google how to convert PDF to word and vice versa to get instructive articles. I think PDF conversion programmes can enable to quickly convert files. i have use PDF converter which can original layouts hyperlinks, Images and tables retained in word ,text, image, Epub, html.but i forgot download the wedsite ,go to google. By the way , pay attention to your system platform, select the suitable one . I use a PDF converter driver found on the internet . Install it and it becomes a selectable converter option.Then you can convert PDFs to many forms in any program at all, including Adobe Acrobat . Just open a PDF, select convert, and choice a form you want, then you can do pdf to word conversion and vice versa,the task will be finished in several seconds. if you haven't found a good choice , you can have a try. best wishes.

  11. #11
    Join Date
    May 2013
    Location
    Surendranagar Gujarat India
    Posts
    55
    Hi NinaWilliam
    you can try this page that can be usedfull for you..
    http://www.codeproject.com/Articles/...ASP-NET-Server

    Gaurav Pandya
    Web Developer
    Insight Softech
    www.insightsoftech.com

  12. #12
    Join Date
    Jun 2013
    Posts
    27
    Convert Word to pdf file by using following codes from a thid party that talks much about document and image viewing, converting and processing:

    Public Sub WordConvertToPdf()
    If True Then
    WordInputFile = ("C:/1.docx")
    ImageOutputFile = ImageFormat.pdf
    End If
    End Sub
    doc.Save(@"C:/1.docx", 1, @"C:/1.pdf")

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles