How to remove images from "e_form" objects.

Q:
I need to remove images from "e_form" objects.
Do you have any example in VB?
----
A:

Do you need to
a) edit PDF document so that all images are removed from the pages in
the output PDF document
b) or to extract embedded images?

In case you need to edit the PDF by removing the images from all pages
and form XObjects, you could start with the code from ElementEdit
sample project
(http://www.pdftron.com/net/samplecode.html#PDFDraw#ElementEdit).

To process forms you would need to process forms as illustrated in
ElementReader sample project
(http://www.pdftron.com/net/samplecode.html#ElementReader).

So, altogether the code would look as follows:

Sub ProcessElements(ByVal reader As ElementReader, ByVal writer As
ElementWriter)
  Dim element As Element = reader.Next()
  While Not IsNothing(Element) ' Read page contents
    If element.GetType() = element.Type.e_image Then
      ' remove all images by skipping them
    ElseIf element.GetType() = element.Type.e_form Then
      ' Process form XObjects
        reader.FormBegin()
        ProcessElements(reader, writer)
        reader.End()
    Else
      writer.WriteElement(element)
    End If

    element = reader.Next()
  End While
End Sub

Min Sub ----
PDFNet.Initialize()
PDFNet.SetResourcesPath(...)
...
Dim doc As PDFDoc = New PDFDoc("my.pdf")
doc.InitSecurityHandler()
Dim num_pages As Integer = doc.GetPagesCount()
Dim writer As ElementWriter = New ElementWriter
Dim reader As ElementReader = New ElementReader
Dim element As Element

Dim i As Integer
For i = 1 To num_pages Step 1
  Dim itr As PageIterator = doc.PageFind(i)
  reader.Begin(itr.Current())

  Dim new_page As Page = doc.PageCreate(New Rect(0, 0, 612, 794))
  doc.PageInsert(itr.Next(), new_page)
  writer.Begin(new_page)

  ProcessElements(reader, writer)

  writer.End()
  reader.End()

  doc.PageRemove(doc.PageFind(i))
Next i

doc.Save("out.pdf", PDFTRON.SDF.Doc.SaveOptions.e_remove_unused)
doc.Close()
---

In case, you just need to extract embedded images you can use
Image.Extract(...) method (as illustrated in ImageExtract sample
project - http://www.pdftron.com/net/samplecode.html#ImageExtract).