0 Replies Latest reply on Aug 30, 2006 8:50 AM by Coldfusionstudent

    pdf/convert html to pdf butoon option

    Coldfusionstudent Level 1
      Hello I have 2 pages menu page and act_citywide
      Menu page has a menu to select pdf or other 2 option. and a button.
      Act_citywide has the query and action.

      I wish to create a button that will have a convert to pdf as opposed to these option of radio buttons and button.
      What do I add to this program and where?
      thanks or maybe just add another button that will convert to pdf


      Thanks



      ----------------------------------------
      Menu Page
      ------------------------------------------------------------------------------------------ ---------------
      <cfquery name="getCityWideCases" datasource="cts9i">
      SELECT
      --PROP.STR_NBR
      --,PROP.STR_FRAC_NBR
      --,PROP.STR_FRAC_NBR_RNG_END
      --,PROP.STR_DIR_CD
      PROP.STR_NM
      --,PROP.STR_SFX_CD
      --,PROP.STR_SFX_DIR_CD
      --,PROP.STR_UNIT_TYP_CD
      --,PROP.UNIT_NBR
      --,PROP.PROP_ID
      --,PROP.ZIP_CD
      ,CASE.CASE_NBR
      --,CASE.CASE_ID
      --,CASE.CASE_TYP_CD
      ,CASE.CRTN_DT
      --,APLC.PROJ_DESC_TXT
      --,TYP.CASE_TYP_DESC
      FROM
      CTS.TLA_PROP PROP
      ,CTS.TLOC L
      ,CTS.TCASE CASE
      --,CTS.TAPLC APLC
      --,CTS.TREF_CASE_TYP TYP
      WHERE
      PLAN_AREA_NBR = '1'
      AND L.LOC_ID = PROP.PROP_ID
      AND CASE.APLC_ID = L.APLC_ID
      AND PROP.STR_NM != 'TEST'
      --AND CASE.PARNT_CASE_ID IS NULL

      ORDER BY

      <cfswitch expression="#Form.orderBy#">
      <cfcase value="CASENUMBER">
      CASE.CASE_NBR
      </cfcase>
      <cfcase value="CREATIONDATE">
      CASE.CRTN_DT
      </cfcase>
      </cfswitch>


      </cfquery>


      <!---html report--->
      <cfswitch expression="#Form.outputFormat#">
      <cfcase value="HTML,PDF">

      <cfsavecontent variable="htmlData">
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Citywide Cases Report</title>
      </head>
      <style type="text/css">

      td{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      }
      th{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      font-weight:bold;
      background-color:#FFFF99;
      }
      h2{
      font-family:Arial, Helvetica, sans-serif;
      font-size:14px;
      }
      h3{
      font-family:Arial, Helvetica, sans-serif;
      font-size:15px;
      }
      </style>

      <body>
      <cfoutput>
      <table border="0" cellpadding="3" cellspacing="0">
      <tr>

      <td align="center">
      <h3>Citywide Cases Report</h3><br><br></td>
      </tr>
      <tr>
      <td align="center">
      </h2>Your query returned #getCityWideCases.RecordCount# records</h2></td>
      </tr>
      <tr>
      <td>
      <table border="2" cellpadding="2" cellspacing="0">
      <tr>
      <th>Record Number</th>
      <th width="120">Case Number</th>
      <TH>Creation Date</TH>

      </tr>

      <cfloop query="getCityWideCases">


      <tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
      <td>#CurrentRow#</td>
      <Td>#CASE_NBR#</td>
      <td>#dateformat(CRTN_DT,"mm/dd/yyyy")#</td>



      </tr>
      </cfloop>

      </table>
      </td>
      </tr>
      </table>

      </BODY>
      </HTML>
      </cfoutput>
      </cfsavecontent>

      <cfswitch expression="#Form.outputFormat#">

      <cfcase value="HTML">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfcase>
      <cfcase value="PDF">
      PDF
      <cfdocument format="pdf">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfdocument>
      </cfcase>

      </cfswitch>





      </cfcase>

      <cfcase value="CSV">


      <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=citywide.csv">
      <cfcontent type="application/msexcel">"Case Number","Creation Date"
      <cfoutput query="getCityWideCases">#ltrim(CASE_NBR)#,"#dateformat(CRTN_DT,"mm/dd/yyyy")#"
      </cfoutput>

      <cfabort>
      </cfcase>
      </cfswitch>

      <cfquery name="getCityWideCases" datasource="cts9i">
      SELECT
      --PROP.STR_NBR
      --,PROP.STR_FRAC_NBR
      --,PROP.STR_FRAC_NBR_RNG_END
      --,PROP.STR_DIR_CD
      PROP.STR_NM
      --,PROP.STR_SFX_CD
      --,PROP.STR_SFX_DIR_CD
      --,PROP.STR_UNIT_TYP_CD
      --,PROP.UNIT_NBR
      --,PROP.PROP_ID
      --,PROP.ZIP_CD
      ,CASE.CASE_NBR
      --,CASE.CASE_ID
      --,CASE.CASE_TYP_CD
      ,CASE.CRTN_DT
      --,APLC.PROJ_DESC_TXT
      --,TYP.CASE_TYP_DESC
      FROM
      CTS.TLA_PROP PROP
      ,CTS.TLOC L
      ,CTS.TCASE CASE
      --,CTS.TAPLC APLC
      --,CTS.TREF_CASE_TYP TYP
      WHERE
      PLAN_AREA_NBR = '1'
      AND L.LOC_ID = PROP.PROP_ID
      AND CASE.APLC_ID = L.APLC_ID
      AND PROP.STR_NM != 'TEST'
      --AND CASE.PARNT_CASE_ID IS NULL

      ORDER BY

      <cfswitch expression="#Form.orderBy#">
      <cfcase value="CASENUMBER">
      CASE.CASE_NBR
      </cfcase>
      <cfcase value="CREATIONDATE">
      CASE.CRTN_DT
      </cfcase>
      </cfswitch>


      </cfquery>


      <!---html report--->
      <cfswitch expression="#Form.outputFormat#">
      <cfcase value="HTML,PDF">

      <cfsavecontent variable="htmlData">
      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
      <title>Citywide Cases Report</title>
      </head>
      <style type="text/css">

      td{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      }
      th{
      font-family:Arial, Helvetica, sans-serif;
      font-size:12px;
      font-weight:bold;
      background-color:#FFFF99;
      }
      h2{
      font-family:Arial, Helvetica, sans-serif;
      font-size:14px;
      }
      h3{
      font-family:Arial, Helvetica, sans-serif;
      font-size:15px;
      }
      </style>

      <body>
      <cfoutput>
      <table border="0" cellpadding="3" cellspacing="0">
      <tr>

      <td align="center">
      <h3>Citywide Cases Report</h3><br><br></td>
      </tr>
      <tr>
      <td align="center">
      </h2>Your query returned #getCityWideCases.RecordCount# records</h2></td>
      </tr>
      <tr>
      <td>
      <table border="2" cellpadding="2" cellspacing="0">
      <tr>
      <th>Record Number</th>
      <th width="120">Case Number</th>
      <TH>Creation Date</TH>

      </tr>

      <cfloop query="getCityWideCases">


      <tr bgcolor="<cfif currentrow mod 2>GHOSTWHITE<cfelse>WHITE</cfif>">
      <td>#CurrentRow#</td>
      <Td>#CASE_NBR#</td>
      <td>#dateformat(CRTN_DT,"mm/dd/yyyy")#</td>



      </tr>
      </cfloop>

      </table>
      </td>
      </tr>
      </table>

      </BODY>
      </HTML>
      </cfoutput>
      </cfsavecontent>

      <cfswitch expression="#Form.outputFormat#">

      <cfcase value="HTML">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfcase>
      <cfcase value="PDF">
      PDF
      <cfdocument format="pdf">
      <cfoutput>
      #htmldata#
      </cfoutput>
      </cfdocument>
      </cfcase>

      </cfswitch>





      </cfcase>

      <cfcase value="CSV">


      <CFHEADER NAME="Content-Disposition" VALUE="attachment; filename=citywide.csv">
      <cfcontent type="application/msexcel">"Case Number","Creation Date"
      <cfoutput query="getCityWideCases">#ltrim(CASE_NBR)#,"#dateformat(CRTN_DT,"mm/dd/yyyy")#"
      </cfoutput>

      <cfabort>
      </cfcase>
      </cfswitch>