CFDocument is blocking background:url images

Hi all. Im a newbie to Lucee, and somewhat novice to CF. I am porting over a site from CF18 to Lucee, and have found a problem with one of my pages that uses CFDocument. I cannot get the images specified in my background:url style tags to display when enclosed in CFDocument. When I remove that tag and just use CFOutput they display just fine. Any ideas on what I am missing here?

Lucee version is 5.3.10.97
PDF Extension version 1.1.0.19

My code is:

<!---cfoutput--->
<cfdocument format="pdf" localUrl="true">
	<html>
	<cfoutput>
	<table cellspacing="0" cellpadding="2" align="center">
		<tr style="height:162px;background: url('../images/blue_header.gif') no-repeat;display:block;width:700px;">
			<td>test row1</td>
		</tr>
		<tr style="height:162px;background: url('../images/NF89RBody.png') no-repeat;display:block;width:700px;">
			<td>test row2</td>
		</tr>
	</table>
	</cfoutput>
	<html>
<!---/cfoutput--->	
</cfdocument>

problem is what does "…/ " point to ? try using a full url

full URL gives the same result. Ive verified the URL is correct, and even tried URLs from external sites to see if its something with my config with the same result. As I said, Ive narrowed it down to the CFDocument tag as removing that allows the images to display, but Im not seeing this issue in my CF18 instance

@Chris_King Please always specify your installed Lucee version and PDF extension version

he did!!! :slight_smile:

Chris, what happens if you do a cfhttp to that full url of the image? You’re testing so far has had your browser requesting it, rather than the cfml engine–which is what cfdocument would do, also.

Im able to display the images using a separate img tag, unfortuntely I need it to be the background so I can overlay text onto the image. Im not sure how I would incorporate the cfhttp tag into the style background.

No, Chris. I meant merely for diagnostic purposes. Please do try it, and let us know what you get in response, such as in a cfdump (or writdump/dump) of the cfhttp variable that the cfhttp returns. If it’s other than a binary (representing the image), there may be a clue to why your img src fails to respond correctly within the cfdocument.

This is simply another diagnostic arrow in the quiver of things you wisely thought to attempt, to try to understand the problem. It’s just looking at things from a different perspective.

1 Like

There are several ways to achieve that. Have you tried absolute positioning the image instead? Don’t know how that would look like in your pdf, but that would work with css/html.

thanks carehart, makes sense. I was able to do a dump friday and the response indicated my SSL Cert was not installed correct. I have rectified that and now am getting a different error response that doesnt seem to indicate what is wrong. It came back with an errordetail Native Array and a filecontent Raw array of bytes, and then some other fields at the bottom. I see a header field and the info contained there matches the image file, so it seems its finding the file correctly. The only other thing I see that stands out is a status_code of “number 200” and the text returned is boolean false.

Im not sure where to go from here.

for future reference, I have solved this issue. I discovered that I could get it to work with images that were external to my network but not internal ones. After days of attempting to figure our a fix I decided to start at the beginning and compare a working instance of IIS to the one I had set up on this new server and discovered that the IIS installation was not complete and was missing several features. Once I installed the missing features the issue cleared up.

1 Like