Results 1 to 2 of 2

Thread: extracting a pdf from a word document in vb.net

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2018
    Posts
    4

    extracting a pdf from a word document in vb.net

    I have set of word 97-2003 documents with embedded files. I'm using the following code to extract them and save them to a folder. This code works for embedded word documents but when it get to a pdf document it has an error that says:

    "An unhandled exception of type 'System.MissingMemberException' occurred in Microsoft.VisualBasic.dll

    Additional information: Public member 'SaveAs' on type 'IAcroAXDoc' not found."

    Can anyone tell me how to fix this?


    With doc
    Dim objEmbeddedShape As Word.InlineShape
    Dim strShapeType As String
    Dim objEmbeddedDoc As Object
    For Each objEmbeddedShape In .InlineShapes
    'Find and open the embedded doc.
    strShapeType = objEmbeddedShape.OLEFormat.ClassType
    objEmbeddedShape.OLEFormat.Open()
    'Initialization
    objEmbeddedDoc = objEmbeddedShape.OLEFormat.Object
    Extract(objEmbeddedDoc)
    'Save embedded files with names as same as those of icon label
    Dim objEmbedFileName As String = System.IO.Path.Combine(FolderPath, objEmbeddedShape.OLEFormat.IconLabel)
    If objEmbedFileName.Contains("pdf") Then
    objEmbeddedDoc.SaveAs(objEmbedFileName)
    End If
    objEmbeddedDoc.SaveAs(objEmbedFileName) <------------------------- This is where it hits the error
    objEmbeddedDoc.Close
    'Reset objEmbeddedDoc for next object
    objEmbeddedDoc = Nothing
    Next objEmbeddedShape
    End With

  2. #2
    New Member
    Join Date
    Jul 2018
    Posts
    1

    Re: extracting a pdf from a word document in vb.net

    I wonder if there is any chance actually exists to create something like this edit-pdf.pdffiller.com yet using VB, not JS. I had a free trial of this thing to take a look, it works with pdf's only, but if to upload there a documnet of another extension with a pdf in it, it will extract it automatically. Maybe someone here had a clue how it goes actually?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width