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

Using data URI scheme inside pdfcrowd

rvedam wrote on 2012-03-07:
I tried creating a pdf using the pdfcrowd api for a HTML file that has an embedded image in it (i.e. an img tag with a data URI scheme conforming src URL), and the output doesn't show the image. Instead it shows a gray border box in the location where the image is. Does PDF crowd support generate pdfs from HTML source that contains images using the data URI scheme?

support wrote on 2012-03-07:
Hello Ram,

generally, we support embedded images. However, the embedded images often use an efficient but otherwise infrequently used PNG sub-format (tRNS alpha transparency, indexed color) which we do not support at the moment. So my guess is that your image is encoded using this PNG sub-format and therefore not printed to pdf correctly.
rvedam wrote on 2012-03-07:
I tried using jpeg and gif with the same results. The HTML is dynamically generated from an application that I am writing. I can see it in a web browser, but when I pass the same HTML (as a string) to pdfcrowd I get the HTML with no picture. Could it be something related to the content type that is being passed in? I set the content-type as a x-www-form-urlencoded as it states in the API to pass in the HTML raw code to pdfcrowd to generate the PDF. Is there something else I may need?
support wrote on 2012-03-08:
Please, could you post sample HTML code that demonstrates the problem? Thanks.
rvedam wrote on 2012-03-13:
The attached file contains the HTML code. Now I must explain how i'm utilizing the PDFcrowd API in order for you to reproduce the issue.

1) I'm using the REST API examples inside C++ to utilize pdfcrowd (this shouldn't matter, but I thought I'd mention it anyway).
2) I'm using the example where you would convert raw HTML code instead of reading it from a file (this is just a sample HTML code that gets generated dynamically).
3) I don't pipe the data like curl. I just put the raw HTML code directly into the query string.

Hope this is enough information to help you reproduce the problem.

Thanks so much.
rvedam wrote on 2012-03-15:
Any ideas or thoughts on this problem? Is there any other information I may need to provide?
support wrote on 2012-03-16:
Hello Ram, sorry for the late reply.

It seems that we have some problem with handling data URI scheme defined within HTML code. It works only if specified with CSS. Here is an example:

#embeddedImage {
   width: 320px;
   height: 200px;
   background: url(data:image/jpeg;base64,......) no repeat:

<div id="embeddedImage"> </div>

I have modified and attached your test file; it works now.