none
Merge multiple Word/PDF's to a single Word/PDF. RRS feed

  • Question

  • Hello All,

       I am working on a web app where i need to merge word doc and pdf. For that, the only way i think would be to convert the word doc to pdf and then merge those 2 pdf's(Correct me if i am wrong).

     I did some search on this and so far everything i saw was third party tools(like iTextSharp etc.) to do the job.

    1) Is there a way to merge word and pdf or convert word to pdf without using 3'rd party tools?

    2) I have excel files as well so i need to merge excel with word/pdf.

    3))For converting a word doc to pdf i followed the article below.   http://msdn.microsoft.com/en-us/library/bb412305.aspx.

    Like it says, the pdf was created, but i could not open it. The error was," Document1.pdf is either not a supported file type or because the file has been damaged..."

    I am using VS 2010 with VB.net, word 2007. I didnot install SaveasPDF add-in..(http://www.microsoft.com/en-us/download/details.aspx?id=9943)...

    Appreicate the help

    Thanks

    Thursday, October 4, 2012 8:56 PM

Answers

  • Hi LoginId

    The method ExportAsFixedFormat can only work if that Add-in is installed - it was designed to work with the add-in. The reason there's an add-in is because in the original release of Office 2007 Microsoft was not allowed to include a PDF file converter as part of its software.

    In later releases the converter is part of the Office programs, but this only works via the SaveAs command.

    This command won't work properly in Word 2010 because the Add-in is not present and the 2010 file format is not identical to the 2007 file format.

    << I am working on a web app where i need to merge word doc and pdf. For that, the only way i think would be to convert the word doc to pdf and then merge those 2 pdf's(Correct me if i am wrong). >>

    The Word 2010 file formats are "zip packages" of XML files. Theoretically (and that's what every converter does) you could roll your own conversion by "transforming" the Open XML to PDF if you don't want to use a third-party tool.

    The Word Automation Services, introduced in Word 2010 lets you convert Word documents to other file formats in a server environment. You shouldn't try to use the "Word interop" in a server environment.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, October 5, 2012 8:30 AM
    Moderator
  • (1) It is in any case NOT recommended and NOT supported to use office on a production server. The Word Automation Services, mentioned at the end of my last reply, are the correct way to do what you want to do if you want to use the Word application's converters.

    (2) Word 2007 files are the same file format as Word 2010...


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, October 6, 2012 4:07 PM
    Moderator

All replies

  • Hi LoginId

    The method ExportAsFixedFormat can only work if that Add-in is installed - it was designed to work with the add-in. The reason there's an add-in is because in the original release of Office 2007 Microsoft was not allowed to include a PDF file converter as part of its software.

    In later releases the converter is part of the Office programs, but this only works via the SaveAs command.

    This command won't work properly in Word 2010 because the Add-in is not present and the 2010 file format is not identical to the 2007 file format.

    << I am working on a web app where i need to merge word doc and pdf. For that, the only way i think would be to convert the word doc to pdf and then merge those 2 pdf's(Correct me if i am wrong). >>

    The Word 2010 file formats are "zip packages" of XML files. Theoretically (and that's what every converter does) you could roll your own conversion by "transforming" the Open XML to PDF if you don't want to use a third-party tool.

    The Word Automation Services, introduced in Word 2010 lets you convert Word documents to other file formats in a server environment. You shouldn't try to use the "Word interop" in a server environment.


    Cindy Meister, VSTO/Word MVP, my blog

    Friday, October 5, 2012 8:30 AM
    Moderator
  • Cindy,

     Thank you for your information. I will try installing the add-in. I have two more questions on this.

    1) Do i have to install the office and add-in on the production server as well? If so, i am not sure if i'll be going this way.

    2)Regarding this, "The Word 2010 file formats are "zip packages" of XML files. Theoretically (and that's what every converter does) you could roll your own conversion by "transforming" the Open XML to PDF if you don't want to use a third-party tool."

      I would not know what version of the word is being used by the user. In that case, how can i handle this versioning problem if i have to merge diif formats(word,pdf) having diff versions(2007,2010).

    Any help is greatly appreciated.

    Thanks

    Friday, October 5, 2012 12:47 PM
  • (1) It is in any case NOT recommended and NOT supported to use office on a production server. The Word Automation Services, mentioned at the end of my last reply, are the correct way to do what you want to do if you want to use the Word application's converters.

    (2) Word 2007 files are the same file format as Word 2010...


    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, October 6, 2012 4:07 PM
    Moderator