Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Word to PDF By Programmatically

Dear All,

Greetings~

We have new project and its objective is to convert word document into PDF using C#.

Step 1: Open the Word Document
Step 2: Initialize the settings for printing*
Step 3: Print the document to PDF.

*
Layout: same as word document
margin: All margins 1 Inches
Paper Size: Letter


I have doubt in Step 2 and Step 3. Could you help me to complete step 2 and step 3. Any suggestions would be really a great help for me since i am beginner in C#.

Thanks in advance
Ram

Comments

  • wyrmhavenwyrmhaven Member Posts: 4
    Have you tried to use the office macros recorder to do this? I am just throwing that out their because you can then make that macros a part of your custom installer as a template per se for word.

    I beleive that there is an adobe toolbar that you can enable in word that should give you single click access to do the same thing as well.


    : Dear All,
    :
    : Greetings~
    :
    : We have new project and its objective is to convert word document
    : into PDF using C#.
    :
    : Step 1: Open the Word Document
    : Step 2: Initialize the settings for printing*
    : Step 3: Print the document to PDF.
    :
    : *
    : Layout: same as word document
    : margin: All margins 1 Inches
    : Paper Size: Letter
    :
    :
    : I have doubt in Step 2 and Step 3. Could you help me to complete
    : step 2 and step 3. Any suggestions would be really a great help for
    : me since i am beginner in C#.
    :
    : Thanks in advance
    : Ram
    :
    :

  • aspongeasponge Member Posts: 42
    : Dear All,
    :
    : Greetings~
    :
    : We have new project and its objective is to convert word document
    : into PDF using C#.
    :
    : Step 1: Open the Word Document
    : Step 2: Initialize the settings for printing*
    : Step 3: Print the document to PDF.
    :
    : *
    : Layout: same as word document
    : margin: All margins 1 Inches
    : Paper Size: Letter
    :
    :
    : I have doubt in Step 2 and Step 3. Could you help me to complete
    : step 2 and step 3. Any suggestions would be really a great help for
    : me since i am beginner in C#.
    :
    : Thanks in advance
    : Ram
    :
    :
    I would suggest using a 3rd party app such as CutePDF (there are others as well). Many of these applications have APIs that can be utilized in C#.
  • shasurshasur Member Posts: 23
    Step 2: You need to handle the Document's PageSetup from Word Object

    It could be like

    owd.PageSetup.PaperSize = wdPaperLetter
    owd.PageSetup.LeftMargin = 1
    owd.PageSetup.RightMargin = 1
    owd.PageSetup.TopMargin = 1
    owd.PageSetup.BottomMargin = 1

    where owd is word.interop object

    Step 3:

    A simple printout would do if you have a PDFWriter (Adobe/CutePDF/DoPDF) installed

    owd.printout

    Cheers
    Shasur



    : : Dear All,
    : :
    : : Greetings~
    : :
    : : We have new project and its objective is to convert word document
    : : into PDF using C#.
    : :
    : : Step 1: Open the Word Document
    : : Step 2: Initialize the settings for printing*
    : : Step 3: Print the document to PDF.
    : :
    : : *
    : : Layout: same as word document
    : : margin: All margins 1 Inches
    : : Paper Size: Letter
    : :
    : :
    : : I have doubt in Step 2 and Step 3. Could you help me to complete
    : : step 2 and step 3. Any suggestions would be really a great help for
    : : me since i am beginner in C#.
    : :
    : : Thanks in advance
    : : Ram
    : :
    : :
    : I would suggest using a 3rd party app such as CutePDF (there are
    : others as well). Many of these applications have APIs that can be
    : utilized in C#.


    VBA Tips & Tricks ([link=http://vbadud.blogspot.com]http://vbadud.blogspot.com[/link])

    C# Code Snippets ([link=http:dotnetdud.blogspot.com]http:dotnetdud.blogspot.com[/link])
Sign In or Register to comment.