Export to PDF and SWF to JPG

I'm using Coldfusion 5.

I know that to export my table to an Excel format I can use:

<cfheader name="content-disposition" value="inline;filename=confidenceinterval_#client.surveyID#.xls">
<cfcontent type="application/msexcel">
<table><tr><td>blah</td></tr></table>

But let's say I want to do it in PDF, is it possible to do on Coldfusion 5?
Additionally, I want to export a SWF to a JPEG to be included in the EXCEL/PDF as well.

Can anyone help?



identitylessAsked:
Who is Participating?
 
Scott BennettConnect With a Mentor Manager TechnologyCommented:
Sorry, I didn't notice you were using CF 5. I would suggest that you upgrade to 7 or 8 if possible. If not possible you will have to use some 3rd party utility as pigmentarts suggested. if you did upgrade then you would form your code like this because you can't put the start tag and end tag in separate <cfif> blocks:

<cfoutput>
<cfsavecontent variable="PageContent">
<table border="1">
      <tr>
      <td><b>Hello</b></td>
      <td><b>World</b></td>
      </tr>
</table>
</cfsavecontent>

<cfif attributes.exportPDF EQ 1>
<cfdocument format="pdf">#PageContent#</cfdocument>
<cfelse>
#PageContent#
</cfif>  
</cfoutput>

if you want if to appear as flashpaper you would use format="flashpaper" in your cfdocument tag.
0
 
Scott BennettManager TechnologyCommented:
you can use the <cfdocument> tag to generate a PDF or flashpaper like

<cfdocument format="pdf" >
<img src="/img/logo.gif">
<table border="1">
      <tr>
      <td><b>Hello</b></td>
      <td><b>World</b></td>
      </tr>
</table>
</cfdocument>

images will be automaticaly processed into the pdf as well.
0
 
identitylessAuthor Commented:
I'm trying:

<cfif attributes.exportPDF EQ 1>
      <cfdocument format="pdf">
</cfif>
table border="1">
      <tr>
      <td><b>Hello</b></td>
      <td><b>World</b></td>
      </tr>
</table>
<cfif attributes.exportPDF EQ 1>
      </cfdocument>
</cfif>            
                  
I'm giving users an option to export the table to a PDF or not with a checkbox. If they dont check it, it will show the table; else, it will output to PDF.

Also, what about SWF file?

Thanks.
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
pigmentartsCommented:
SBennettt: <cfdocument> is not a cf5 tag - CF 5 there is no way to NATIVELY create a PDF (on the fly)
0
 
pigmentartsCommented:
There is no direct way to generate pdf or flashpaper documents in Coldfusion 5. you need CF7-8 do use the cfdocument tag. if you have to use CF5 then there are 3rd parties which can help you...


http://tutorial135.easycfm.com/
0
 
identitylessAuthor Commented:
Thanks for the link to the tutorial; however, that one did not output CSS.

Are there ways to generate PDF including CSS on CF5?

I was thinking perhaps transforming the output to build an XML, and then using XSL for style formatting, which then can be render in PDF. I'm not sure how that process would work.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.