Some test text!

Loading...
Guides
Remove content

Removing images from PDF page in Go

To remove all images from a document page.

doc := NewPDFDoc(filename)
page := doc.GetPage(1)

writer := NewElementWriter()
reader := NewElementReader()
reader.Begin(page)
writer.Begin(page, ElementWriterE_replacement, false)

element := reader.Next()     
for element.GetMp_elem().Swigcptr() != 0{ // Read page contents
    etype := element.GetType()
    if etype == ElementE_image || etype == ElementE_inline_image{
        // remove all images by skipping them
    }else{
        writer.WriteElement(element)
    }
    element = reader.Next()
}

reader.End()
writer.End()

PDF Editor (Programmatic)
Full code sample which strips all images from the page and changes text color to blue.

Get the answers you need: Support