?
Solved

Export to PDF and SWF to JPG

Posted on 2007-08-03
6
Medium Priority
?
1,351 Views
Last Modified: 2013-11-05
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?



0
Comment
Question by:identityless
  • 2
  • 2
  • 2
6 Comments
 
LVL 14

Expert Comment

by:Scott Bennett
ID: 19628151
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
 

Author Comment

by:identityless
ID: 19629238
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
 
LVL 12

Expert Comment

by:pigmentarts
ID: 19631876
SBennettt: <cfdocument> is not a cf5 tag - CF 5 there is no way to NATIVELY create a PDF (on the fly)
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 12

Expert Comment

by:pigmentarts
ID: 19631880
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
 
LVL 14

Accepted Solution

by:
Scott Bennett earned 1500 total points
ID: 19639186
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
 

Author Comment

by:identityless
ID: 19672791
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

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, I will be creating today a basic tutorial on how we can create a Mail Custom Function and use it where ever we want. The main advantage about creating a custom function is that we can accommodate a range of arguments to pass to the Function and …
I spent nearly three days trying to figure out how incorporate OAuth in Coldfusion for the Eventful API. Hopefully, this article will allow Coldfusion Programmers to buzz through the API when they need to. Basically, what this script does is authori…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month14 days, 19 hours left to enroll

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question