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

CSS in external files for 'Pdfcrowd::Client#convertHtml'

jan_at_ctt wrote on 2012-08-24:
Hello,

I ran into a problem using the Pdfcrowd API 's convertHtml method. I have a html string which references css files in its head like this:

<head>
<link href="/stylesheets/jquery-ui-1.8.2.custom.css?1344953055" media="all" rel="stylesheet" type="text/css" />
...
</head>

but the styling is not reflected in the resulting pdf. My first thought was that you will need to make additional requests for these files as you parse the html string. So I made my application available using localtunnel, but still no luck. Am I doing any mistake? Is there some other way to supply the CSS files?

Thank You very much,
Jan
support wrote on 2012-08-25:
Jan,

If you use the convertHtml() method the stylesheets must be publicly accessible somewhere and you need to link to them using an absolute URL. A very easy way to make them public is to use dropbox.com.

Another option is to zip the stylesheets/images together with the html document into a single .zip file and upload it with the convertFile() method.

Or you can use inline CSS.
jan_at_ctt wrote on 2012-08-27:
Works, thank you!!!