Free Support Forum - groupdocs.com

Transparency is lost when PDF is converted to PNG using .NET

Hi,

I would like to convert some source file (TIFF, PDF, PSD…) containing transparency (like clipping path or alpha channel) to PNG.
The conversion works but transparency is always lost despite PNG being a format which supports transparency - is there any setting to keep transparency durch conversion?

Thanks in advance.

Best Regards
Yahia

1 Like

@it-yeq

Please share following details and we’ll investigate this scenario:

  • API variant (.NET or Java) and version (e.g. 19.10, 20.4)
  • Sample PDF and the expected output
  • Source code that you are using for the conversion process

1103248.pdf (892.4 KB)
1103248.png (38.8 KB)
Hi,

It is .NET latest version (NuGet - V 20.6).

Please find the source code below.

Any of the source files (EPS, PDF, PSD) should lead to the result (PNG) I attached.

Best Regards
Yahia

    private void button3_Click(object sender, EventArgs e)
    {
        string vSourceFile = "";

        using (OpenFileDialog vOD = new OpenFileDialog())
        {
            if (vOD.ShowDialog() == DialogResult.OK)
            { vSourceFile = vOD.FileName ?? ""; }
        };

        if (string.IsNullOrEmpty(vSourceFile))
        { return; }

        var vLic = new GroupDocs.Conversion.License();
        vLic.SetLicense(new System.IO.MemoryStream(Properties.Resources.Conholdate_Total_NET));

        var vConverter = new GroupDocs.Conversion.Converter(vSourceFile);

        var vInfo = vConverter.GetDocumentInfo();
        var vPossibleConversions = vConverter.GetPossibleConversions();

        vConverter.Convert(vSourceFile + ".png", new GroupDocs.Conversion.Options.Convert.ImageConvertOptions() { Format = GroupDocs.Conversion.FileTypes.ImageFileType.Png });

    }

Test1103248.zip (1.3 MB)

1 Like

@it-yeq

This issue is reproduced at our end. Hence, we’ve logged it in our internal issue tracking system with ID CONVERSIONNET-3967 for further investigation and resolution. As there’s any update, you’ll be notified.

Thank you very much!

1 Like

@it-yeq

You’re welcome.