New to Telerik Document ProcessingStart a free 30-day trial

Replace Image in PDF Document

Updated on Feb 19, 2026
Product VersionProductAuthor
2021.1.212RadPdfProcessingMartin Velikov

Description

How to replace image in a PDF document.

Solution

In the example below, we are demonstrating how to find a specific image in the imported into a RadFixedDocument PDF document, preserve its size and Position and replace it with another Image.

Replace Image in Imported PDF Document

csharp

    RadFixedPage firstPage = document.Pages[0];

    Image image = firstPage.Content.First(ce => ce is Image) as Image;

    string newImagePath = "image.png";
    ImageSource newImageSource;
    using (FileStream source = File.Open(newImagePath, FileMode.Open))
    {
        newImageSource = new ImageSource(source);
    }

    Image newImage = new Image
    {
        ImageSource = newImageSource,
        Position = image.Position,
        Width = image.Width,
        Height = image.Height
    };

    int imageIndex = firstPage.Content.IndexOf(image);
    firstPage.Content.RemoveAt(imageIndex);
    firstPage.Content.Add(newImage);
	
In this article
DescriptionSolution
Not finding the help you need?
Contact Support