chapter31

development in a land far far away…

at the moment

History is not what happened. History is what was written down.

I was debugging a legacy app today which I’d just migrated to a new server running ColdFusion 8. A part of this application generates a PDF using <cfdocument>. As usual it was working fine on my development and staging environments…but not on production! Damn.

After a bit of fiddling I found a related post by Rupesh Kumar where he mentions that you may have problems if ColdFusion is behind a firewall.

CF server needs to send an HTTP request for the images. If the firewall prevents any outgoing connection from the server, CF will not be able to retrieve them

Now I already had outbound HTTP access, but I couldn’t call a site which was setup on the production machine from where I was browsing. Bugger, I was about to make a the necessary firewall changes when I looked at the updated docs for CF8 and noticed a new attribute called “localURL” which;

Specifies whether to retrieve image files directly from the local drive:

  • yes: ColdFusion retrieves image files directly from the local drive rather than by using HTTP, HTTPS, or proxy.
  • no: ColdFusion uses HTTP, HTTPS, or proxy to retrieve image files even if the files are stored locally.

Nice!

Now <cfdocument> can simply call images from a local (relative) path instead of a full HTTP request as it did before.

I love CF8 :)

There are a few additions to this particular tag and you can view them on the online docs which have had a much needed facelift.


Related Pages

10 Responses to ““localURL” attribute added to cfdocument in ColdFusion 8”

  1. Awesome! This is a problem that I have had to deal with several times already. CF8 really does rock.

    Ben Nadel

  2. Nice! There are few more changes related to cfdocument that have gone in CF8. Check them out here.
    http://coldfused.blogspot.com/2007/07/enhancements-to-cfdocument-in.html

    Rupesh Kumar

  3. We recently upgraded to CF8 but my cfdocument creation of pdf caused my document to shrink by a 1/3. I can’t figure it out. HELP!!

    Jeff Martin

  4. Hi Jeff,

    I must admit to (after writing this post) having a LOT of problems with the way CF8 actually generates and parses HTML as compared to CF7.

    I’m not sure what ‘rendering’ engine cfdocument is using for this, one thing I need to try is using having my PDF generated from a cfhttp request, that might help my case.

    Don’t forget you really need clean, validated markup (HTML) to work accurately. And CSS can be tricky which others have already noted.

    As for your problem, I haven’t had that myself so I’m not sure. Can you post some code samples?

    Michael Sharman

  5. Thanks for the help! This was driving me mad - images were working without a problem in CF7 but didn’t work at all in CF8. The “LocalURL” attribute worked like a charm.

    James Basco

  6. Has anyone found a fix to the cfdocuments pdf shrinking by 1/3? Despartly needed. Thx

    Scott Terrell

  7. @James, no problem!

    @Scott, there is a cumulative hot fix out for CF8 which you can find here:

    http://www.adobe.com/go/kb402466

    One of the fixes is “certain cfdocument table rendering”.

    Apart from that Tony Petruzzi has a post (http://rip747.wordpress.com/2007/09/10/cfdocument-it-works-if-you-know-how/) which might be of assistance to you.

    Michael Sharman

  8. Trying to access cfdocument.currentpagenumber throws an error. This ran in CF7. Error says that cfdocument does not contain variable currentpagenumber. But I access it fine within cfdocumentitem tags. As I said, this syntax worked OK in CF7, but not in CF8….TIA

    Roy Arnold

  9. Does anybody knows how to make auto conversion of pdf to flashpaper on linux server ?
    is there a cf7 or cf8 tag for pdf to flashpaper conversion ?

    Divjak V

  10. Hello!
    I think this try.

    Floroskop

Leave a Reply