Coldfusion: display TIFF blob as a PDF

I must read a blob (a TIFF image) from an Oracle database and display it in a browser as a PDF. I write the blob to a TIFF file, then use <cfdocument> to display the TIFF image as a PDF. The second step is very slow, and on the largest blobs there is not enough memory:

java.lang.OutOfMemoryError: Java heap space.

Converting TIFF to PDF in ImageMagick from ColdFusion is even slower.

Is there a better way to do this in ColdFusion?

Here is my code:

<cfimage action="write" source="#queryName.theTIFFblob#" destination="newfile.tif" > 
<cfdocument format="pdf" >
    <img src="newfile.tif">

Thank you.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Been working with cfdocument/cfimage pretty extensively for a while now.  I hope someone can prove me wrong, but the cfimage tag has it's limits.  Sounds like you're hitting them.  Specific tasks (like resizing) can take FOREVER for the tag to keep up.  There's a few studies that I've seen regarding times that it can take to complete requests for the cfimage tag and none of them are blazing fast.  You can reduce quality in some cfimage cases to speed up the function, but in the end it's no photoshop.  I have some functions that take over 5 minutes to complete.  In my case though, I'm actually able to schedule the function to run instead of making people wait for it, so it works out for my needs.  Maybe that's a workaround for you too.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pretty sure you can just use cffile to write out that blob:

<cffile action="write" output="#queryName.theTIFFblob#" file="newfile.tiff" >

I know cfimage has its limits but in this example your not manipulating it in any way that will stress the server.  I woudl say its the PDF generation thats causeing the issue.

2 things I would try.  In cfadmin bump up the ram to 1024mb

Upgrade the JDK to 1.6.10 atleast preferable 1.6.13
eejonesAuthor Commented:
galadore and Jones911:

Thanks to you both. I suspected there was a limitation to the tools but hoped to get that confirmed by experts before considering other methods.

Jones911 I upped the CF ram to 1024mb and still hit the wall.

galadore if I find no other solution I may do the conversion offline, using cfschedule perhaps, and email it to the user.

eejonesAuthor Commented:
I do not think there is a solution - in the end we are using a different tool than ColdFusion image processing (Java)  -  but the comments were helpful. Thanks for the input to both of you.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.