This is an archived forum post. The information may be outdated. Contact us if you have any questions.

PDFCrowd displays black background instead of transparent background

Ameer91 wrote on 2014-06-22:

I am using PDFCrowd in my web application to generate PDF files for a certain HTML page that contains PNG images with transparent background.

Sometimes the PDF downloaded doesn't display these images clearly, it displays them with Black background instead of the Transparent background.

Other times, it displays the images as supposed with transparent background.

I tried to see if there are problems in the received HTML page, or in the request being sent, but all things behaved as expected.

Attached an original image and its resulted image from PDFCrowd in one of the cases.

Is the problem in the way that PDFCrowd renders PNG images or am I missing something ?
support wrote on 2014-06-23:

When I paste the following to our online conversion form (, the resulting PDF looks fine.
<img src=",file=154,filename=original.png" />

If you can post a full HTML code which demonstrates the problem with the png transparency, I will look into it.
kajari.verma wrote on 2014-07-25:
PDFCrowd displays black background instead of transparent background
support wrote on 2014-07-27:

If you can send me an example that demonstrates the problem, I will look into it.
whyknott wrote on 2016-06-16:
I too am having this problem with my pdf generation, the little dot layers are PNG images that are supposed to be transparent but have black underneath, looks bad! You can clearly see black background under the dots.

admin_kpg wrote on 2017-11-16:
Hello I am having the same issue as other folks previously explained.

Some pictures appear with an unexpected black background and some don't.

Please find in attached file the Html with the src="https://...." type in the <img>.

It works if you change the path of images to i.e your own server but it means that you need to have them in advance, which is not generic and maintainable.

I thank you in advance for your help.

Sincerely Yours
support wrote on 2017-11-16:

Could you please try the new version of our API to see if it resolves your issue?

You can activate access to the new API here:

You need to install the latest API client library:

Update your code according to the new documentation:
admin_kpg wrote on 2017-11-16:
Thank you for your quick answer.

I just tried the new version of the API but unfortunately it does not work.

Actually, Pdfcrowd squeezes all the columns (I use a template working with 1 to 4 columns) from the html to the pdf version.

The previous API version was working pretty well except for the black background color issue for certain png image

I thank you in advance for your help.
support wrote on 2017-11-16:
I have tried your HTML via Pdfcrowd web form (original and new) and the new looks better. I have used the default settings.

Please send your settings to

Note: HTML validator shows 117 errors in your HTML, maybe one of them can be responsible for the problems.
admin_kpg wrote on 2017-11-17:

Thanks you for your quick answer.

Are you talking about the PDFCrowd settings such as the page size and margin?

How do I retrieve them? I did not use any "SetPageMargin()" or "SetPageSize()" methods, just treating the html with the code in the attached file.

I thank you in advance for your precious answers.
support wrote on 2017-11-17:

If you don't change any settings, defaults are used.

I'm sending 2 PDFs created by original and beta API to email because they can't be attached due to the size. The beta version seems better (e.g. all images are presented, text on the 1st page is more readable).
Could you be more specific what is the issue with beta?
admin_kpg wrote on 2017-11-20:

The issue is that I still have the black background on certain icons and buttons (without changing the settings).

Furthermore the new version of pdfcrowd squeezes all the columns that I have in my document

I have saved html (fopen fwrite and fclose) and it works properly so even if there are mistakes in the html, I think they are not responsible for this issue.

I just sent you to the pdf generated with the new and the old version because they are too heavy for the forum.

Thank you once again for your precious help.
support wrote on 2017-11-21:

The layout of your HTML depends on the viewport width. Try the following (new API beta):
$client = new \Pdfcrowd\HtmlToPdfClient("***", "***");
$client->setViewport(1600, 1200);
$client->convertFileToFile("html_file.html", 'out.pdf');
admin_kpg wrote on 2017-11-21:

It works perfectly!

Thank you very much for your precious help! great tools!
okahara wrote on 2018-01-08:
Hi Admin_kpg,

How did you remove/fix the black background on your PNG images?

We are seeing similar issues with our PNGs.

Thank you