70002762 Force PDF image transparency

Article 70002762
Type HowTo
Product Engine
Date Added 9/24/2025 12:00:00 AM
Fixed 11.4.21 (9/25/2025 12:00:00 AM)
Submitted by Dominique Premillieu

Summary

Howto Force PDF image transparency

Solution

In order to force PDF image transparency use the following code:

vdDocument doc;
doc.OnAfterOpenDocument += new vdDocument.AfterOpenDocument(doc_OnAfterOpenDocument);

void doc_OnAfterOpenDocument(object sender)
{
    vdDocument mdoc = sender as vdDocument;
    if(mdoc.FileName.EndsWith(".pdf", StringComparison.InvariantCultureIgnoreCase))
    {
        foreach (vdImageDef item in mdoc.Images)
        {
           if(item.Transparency == Color.Empty)  item.Transparency = Color.White;
        }
    }
}

Send comments on this topic.