This is a migrated thread and some comments may be shown as answers.

Can a Transparent PNG be added to a PDF

2 Answers 387 Views
PdfProcessing
This is a migrated thread and some comments may be shown as answers.
Carlos
Top achievements
Rank 1
Carlos asked on 02 Apr 2020, 07:33 PM

I have been banging my head on adding a PNG to a PDF.  I can do it with a JPG but no joy with PNG.

public void AddImage(RadFixedDocument document)
{
    FixedContentEditor editor = new FixedContentEditor(document.Pages[0]);
    using (FileStream fs = new FileStream("ADC.jpg", FileMode.Open, FileAccess.Read))
    {
        editor.Position.Translate(50, 50);
        editor.DrawImage(new ImageSource(fs, ImageQuality.High), 50, 50);
    }
}

 

Change the jpg to a png and I get this error:  System.NotSupportedException: 'Can not export other than Jpeg and Jpeg2000 and ImageQuality different than High'

I can change the ImageQuality to low and same error.  Is there an example of DrawImage with a png?

2 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 03 Apr 2020, 09:58 AM

Hi Carlos,

I am sorry to hear you are experiencing issues due to unsupported functionality. I saw from your profile you are using our libraries with ASP.NET Core (please, correct me if I am wrong), so you are using Telerik Document Processing libraries built against .NET Standard. Currently, adding PNG images and exporting to PDF documents is supported only in the .NET Framework version. We have an item logged in our backlog to provide this functionality for the .NET Standard as well: PdfProcessing: NETStandard: Add support for exporting PNG images. You can follow the task by clicking the Follow button so you can receive updates about status changes.

Until this feature is developed, I would like to suggest you to use the currently supported image types (Jpeg and Jpeg2000, with ImageQuality not different than High).

Regards,
Martin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Carlos
Top achievements
Rank 1
answered on 03 Apr 2020, 10:06 AM
Thanks for your reply.  Yes I am using net standard. I will attempt to save to jpeg in memory and add that to the pdf.  Thanks.
Tags
PdfProcessing
Asked by
Carlos
Top achievements
Rank 1
Answers by
Martin
Telerik team
Carlos
Top achievements
Rank 1
Share this question
or