none
Add PDF to Word via VB.net RRS feed

  • Question

  • hi,

    i need some help to solve this problem. I have to implement addpdf() to a reportgenerator software.

    i had already read some thread about the adding the pdf, but most of them using the "AcroExch.Document.7"

    and i dont know how to get that class? 

    should i use:

    WordApp.Selection.InsertFile(path & "/" & name, , , , )

    or 

    WordApp.Selection.InlineShapes.AddOLEObject(, path, , True, , , name)

    ?

    i had already tried them but both of them give the wrong result. with insertfile, i got the bytecode of the file and the other one, i got an error? did i missing something?

    Thank before for your help.

    Monday, February 24, 2014 10:17 AM

Answers

  • Which version of Word are you targeting? Only Word 2013 can "break down" a PDF file and integrate it into a Word document. Prior versions of Word can, at best, insert a PDF document as an OLE object (graphic, basically). The second set of code you show us attempts to do that. You say it gives you an error message, but without the details of the error we can't help you.

    However, I should mention that embedding as OLE will show only the first page of the PDF document and will require an "OLE Server" application capable of editing the PDF file. I'm guessing lack of such an application is what's causing the error.

    AcroExch.Document.7 is probably an Adobe software. In any case, it's not part of Microsoft Word and will only be available to you if you have that software installed (and probably licensed).

    The only other approach would be to learn how to access both the PDF file format as well as the Word Open XML file format and code a converter or transformation to write the Adobe content to Word content.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by FRXMW Monday, February 24, 2014 7:26 PM
    Monday, February 24, 2014 1:35 PM
    Moderator

All replies

  • Which version of Word are you targeting? Only Word 2013 can "break down" a PDF file and integrate it into a Word document. Prior versions of Word can, at best, insert a PDF document as an OLE object (graphic, basically). The second set of code you show us attempts to do that. You say it gives you an error message, but without the details of the error we can't help you.

    However, I should mention that embedding as OLE will show only the first page of the PDF document and will require an "OLE Server" application capable of editing the PDF file. I'm guessing lack of such an application is what's causing the error.

    AcroExch.Document.7 is probably an Adobe software. In any case, it's not part of Microsoft Word and will only be available to you if you have that software installed (and probably licensed).

    The only other approach would be to learn how to access both the PDF file format as well as the Word Open XML file format and code a converter or transformation to write the Adobe content to Word content.


    Cindy Meister, VSTO/Word MVP, my blog

    • Marked as answer by FRXMW Monday, February 24, 2014 7:26 PM
    Monday, February 24, 2014 1:35 PM
    Moderator
  • hi, thank for the answer. in the end, i already got my solution by using the "AcroExch.Document.7".

    Monday, February 24, 2014 7:26 PM