Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Feb 24, 2021 12:59 pm

Hello

I am trying to draw an image onto the PDF page.
This works very well, except for the following problem:

My PNG has a transparent background.
When I draw it onto the PDF the background is black.

This is the code I have (C#):
Code: Select all
Bitmap bitmap = new Bitmap(image, size, size);
PdfBitmap pdfBitmap = new PdfBitmap(bitmap);
pdfBitmap.Draw(pdfTextField.Page, pdfTextField.Location);


So, what do I have to do, to keep the background transparent?
I have found a few examples on how to make the whole image transparent, which is not what I want.
I just want the PNG to be displayed correctly with the transparent background.

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Thu Feb 25, 2021 2:20 am

Hello,

Thanks for your inquiry!

I have tested the code you provided to draw a transparent background .png image to a PDF with the latest Spire.PDF V7.2.9 but did not reproduce your issue. If you were not using the latest version, I recommend you have a try first. If the issue still exists, please provide us with your .png image and your input file for further investigation. Thanks in advance!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Feb 25, 2021 8:04 am

Hey

I was using version 7.2 and version 7.2.9 has fixed this issue!

Sorry for the unnecessary extra work :(

RicoScheller
 
Posts: 52
Joined: Tue Jul 02, 2019 10:34 am

Thu Feb 25, 2021 8:29 am

Hello,

Thanks for your feedback!

It doesn't matter and glad to hear that your issue has been solved.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF

cron