Skip to main content
Inspiring
April 8, 2008
Question

image links in PDF document

  • April 8, 2008
  • 3 replies
  • 609 views
I am embedding images in a pdf diocument and it works great when I am on the local server or if I VPN into the production server and reference the server using internal IP. I get red x's when I am not VPN'ed in on the same pages. The image references also work perfectly in HTML pages on the production server when I am not VPN'ed in..

I have tried the following referencing and nothing works:
<img src=" http://#HTTP_HOST#/torq/icons/gradient.jpg" align="left">
<img src="torq/gradient.jpg" align="left">
<img src=" http://208.66.59.195//torq/gradient.jpg" align="left">
<img src=" http://workxresearch.com//torq/gradient.jpg" align="left">

It also refuses to link in the referenced css.

I am calling it thus:

<cfdocument format="pdf" fontembed="yes" >
<link rel="stylesheet" type="text/css" href="stylePDF.css" />

Any ideas on why this is???? My hair is turning grey.....
    This topic has been closed for replies.

    3 replies

    Inspiring
    April 9, 2008
    yes, the hoops one has to jump through to make cfdocument work as needed
    are plenty...
    happy you sorted it all out!

    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/
    KDN0211Author
    Inspiring
    April 9, 2008
    Thanks for the info. Actually, it was a firewall issue. I got around it by referencing the images thus:
    <img src="file:///#expandpath(icons/wrench.png)#>

    For the css, using the <style> </style> as you suggested worked great! Unfortunately I cannot use the expandpath within the <style> brackets, but used a fully qualified, local server path instead (hard coded - ugh!)

    Thanks again!

    Inspiring
    April 9, 2008
    it *looks* like all your atempts to reference images are not correct:

    <img src=" http://#HTTP_HOST#/torq/icons/gradient.jpg" align="left">
    #http_host# should be #cgi.http_host#? and it needs cfoutput around it?

    <img src="torq/gradient.jpg" align="left">
    this does not work in cfdocument

    <img src=" http://208.66.59.195//torq/gradient.jpg" align="left">
    <img src=" http://workxresearch.com//torq/gradient.jpg" align="left">
    both have // after server ip/name, when it shoudl be just / (?)

    as for the css file:
    1) make sure the html you remnder into pdf is valid. make sure you have
    all necessary sections of html code defined - doctype declaration,
    <html>, <head>, <body> - and you reference your css in the HEAD section.

    2) the images referenced in your external css file are relative to the
    css file location, right?

    3) if external css still does not work, try in-page css instead, in the
    <style></style> section of HEAD

    hth


    Azadi Saryev
    Sabai-dee.com
    http://www.sabai-dee.com/