Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / November 2007

Tip: Looking for answers? Try searching our database.

Converting Word Document to PDF file.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Akshit Shah - 15 Oct 2007 09:49 GMT
Hi friz,

I want to convert word document (with all formatings & images) to a PDF file.

How i can achive this.

Please Help.
jacky kwok - 16 Oct 2007 03:08 GMT
> Hi friz,
>
[quoted text clipped - 3 lines]
>
> Please Help.

I do not sure winword itself to have such function or not. I do not use
winword since winword2000.

Several methods you can change a word document to PDF:

1. install Adobe Acrobat.

2. using Open Office. Use Open office to open winword document, then
export to PDF (export to PDF is built function of Open Office writer).

Signature

Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk

Mads Bondo Dydensborg - 17 Oct 2007 11:14 GMT
> 2. using Open Office. Use Open office to open winword document, then
> export to PDF (export to PDF is built function of Open Office writer).

Yes, and if you use open offices UNO interface (
http://wiki.services.openoffice.org/wiki/Uno ) you can drive it from within
your programs.

Regards

Mads

Signature

Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo
Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77
34

adaandeve - 29 Nov 2007 18:32 GMT
> Hi friz,
>
[quoted text clipped - 3 lines]
>
> Please Help.
adaandeve - 29 Nov 2007 18:35 GMT
How did you end up doing it? I'd like to do it too.
Laura

> Hi friz,
>
[quoted text clipped - 3 lines]
>
> Please Help.
Bob Eaton - 30 Nov 2007 03:34 GMT
> I want to convert word document (with all formatings & images) to a PDF
> file.

If you have Office/Word 2007, you can install the PDF plug-in and save
directly from within Word.

Below is a snippet of VB.Net code that will do the conversion using the Word
(2007) PIAs.

Bob

+------------------cut here------------------+

Imports System.Windows.Forms
Imports Word = Microsoft.Office.Interop.Word

Imports System.Runtime.InteropServices ' for Marshal

Imports System.IO ' Path

Module ConvertDocToPdf

Sub Main()

Dim openFileDialog As New OpenFileDialog

openFileDialog.Multiselect = True

openFileDialog.Filter = "All Word Documents
(*.docx;*.docm;*.dotx;*.dotm;*.doc;*.dot;*.htm;*.html;*.rtf;*.mht;*.mhtml;*.xml)|*.docx;
*.docm; *.dotx; *.dotm; *.doc; *.dot; *.htm; *.html; *.rtf; *.mht; *.mhtml;
*.xml|All files (*.*)|*.*"

If (openFileDialog.ShowDialog() = DialogResult.OK) Then

Dim wdSaveFormat As Word.WdSaveFormat =
Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatPDF

Dim wrdApp As New Word.Application

Try

Dim oDocFilename As Object

For Each oDocFilename In openFileDialog.FileNames

Dim wrdDoc As Word.Document = wrdApp.Documents.Open(oDocFilename)

Dim oToFilename As Object = String.Format("{0}\{1}",
Path.GetDirectoryName(oDocFilename), _

Path.GetFileNameWithoutExtension(oDocFilename) + ".pdf")

wrdDoc.SaveAs(oToFilename, wdSaveFormat)

wrdDoc.Close()

Next

Catch ex As Exception

MessageBox.Show(ex.Message)

Finally

wrdApp.Quit()

Marshal.ReleaseComObject(wrdApp)

End Try

End If

End Sub

End Module

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.