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
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
where uploadcntrl is an asp:FileUpload
Dim imagebytes(uploadcntrl.PostedFile.InputStream.Length) As Byte
uploadcntrl.PostedFile.InputStream.Read(imageBytes, 0, imagebytes.Length)
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.
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.
you can read the word document into you .net application then use Crystal Reports to create your PDF file.
thank you Ribeyed
but can you explain more? I mean how can i read the word doc into my application?
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:
Once you have your document you can then use Crystal Reports to convert to pdf.
Dim AppWord As New Word.Application
Dim WordDoc As Word.Document
WordDoc = AppWord.Documents.Open(FileName)
Hope that helps
Convert Word documents to PDF on Serverside with Word 2007. See article on Codeproject:
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?
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.
you can try this page that can be usedfull for you..
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
doc.Save(@"C:/1.docx", 1, @"C:/1.pdf")
Originally Posted by Ribeyed
Great help buddy.. It's pretty good and working for my project. Thanks Ribeyed
*** spam signature deleted by moderator - please do not put it back ***
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)