Some test text!

menu
Remove contentkeyboard_arrow_down

Remove images from a page

To remove all images from a document page.

PDFDoc doc = new PDFDoc(fileName)
Page page = doc.GetPage(1);

ElementWriter writer = new ElementWriter();
ElementReader reader = new ElementReader();
reader.Begin(page);
writer.Begin(page, ElementWriterWriteMode.e_replacement, false);

Element element;
while ((element = reader.Next()) != null) // Read page contents
{
    switch (element.GetType())
    {
        case ElementType.e_image:
        case ElementType.e_inline_image:
            // remove all images by skipping them
            continue;
        default:
            writer.WriteElement(element);
            break;
    }
}

writer.End();
reader.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

close

Free Trial

Get unlimited trial usage of PDFTron SDK to bring accurate, reliable, and fast document processing capabilities to any application or workflow.

Select a platform to get started with your free trial.

Unlimited usage. No email address required.