How can I extract File Attachments from PDF?

Q: I have a pdf file that has Word docs attached to it. I need to
extract theWord docs from the file. What steps and library of yours
would you recommend?
A: You may want to search for "file attachment" in PDFNet Knowledge
Base. I
found couple of relevant articles:

Q: I have been playing with this for a few days and have not gotten
this to work but I do have a better understanding now. Can you give me
the underlying strategy for extracting file attachments from a pdf
file. It seems there is a collections of objects to iterate thru and
find file attachment then extract it. (Is that true?). Do you have any
sample code or c#?
The following sample code can be used to extract file attachments that
are embedded within a PDF document or are attached on specific PDF

// In VB.NET (C#/JAVA/C/C++ is essentailly the same).

Imports System

Imports PDFTRON.Common

Module Module1
' Relative path to the folder containing test files.
Dim input_path As String = "../../../TestFiles/"
Dim output_path As String = "../../../TestFiles/Output/"

Sub Main()
   Dim doc As PDFDoc = New PDFDoc(input_path + "FileAttachment.pdf")

   ' Extract file attachments associated with a document.
   Dim names As NameTree = NameTree.Find(doc.GetSDFDoc(),
   If names.IsValid() Then
    Dim itr As NameTreeIterator = names.GetIterator()
    While itr.HasNext()
     Dim fs As FileSpec = New FileSpec(itr.Value())
     fs.Export(output_path + fs.GetFilePath())
    End While
   End If

   ' Extract all file attachments associated with pages.

   Dim pgitr As PageIterator = doc.GetPageIterator()
   While pgitr.HasNext()
    Dim pg As Page = pgitr.Current()
    Dim num_annots = pg.GetNumAnnots() - 1
    Dim i As Integer = 0
    For i = 0 To num_annots
     Dim ann As Annot = pg.GetAnnot(i)
     If ann.IsValid And ann.GetType() = Annot.Type.e_FileAttachment
      Dim fs As FileSpec = ann.GetFileAttachment()
      fs.Export(output_path + fs.GetFilePath())
     End If

   End While

  Catch ex As PDFNetException
  Catch ex As Exception
  End Try

End Sub
End Module