Welcome! Log In Create A New Profile

Advanced

Using data URI scheme inside pdfcrowd

Posted by rvedam 
Using data URI scheme inside pdfcrowd
March 07, 2012 10:46AM
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?

Ram
Re: Using data URI scheme inside pdfcrowd
March 07, 2012 02:42PM
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.
Re: Using data URI scheme inside pdfcrowd
March 07, 2012 04:37PM
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?
Re: Using data URI scheme inside pdfcrowd
March 08, 2012 02:13PM
Please, could you post sample HTML code that demonstrates the problem? Thanks.
Re: Using data URI scheme inside pdfcrowd
March 13, 2012 10:34AM
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.
Attachments:
open | download - test.html (50.6 KB)
Re: Using data URI scheme inside pdfcrowd
March 15, 2012 07:14PM
Any ideas or thoughts on this problem? Is there any other information I may need to provide?
Re: Using data URI scheme inside pdfcrowd
March 16, 2012 06:45AM
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:

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

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

I have modified and attached your test file; it works now.
Attachments:
open | download - test-i.html (52.2 KB)
Sorry, only registered users may post in this forum.

Click here to login