Solved

cfdocument producing blank browser page

Posted on 2010-08-18
5
657 Views
Last Modified: 2013-12-24
I use cfdocument to produce pdf files that contain purchase order information.  I have successfully used cfdocument on other pages of my site.  This particular page will render all correct information to the browser until I add the cfdocument tags.  At this point I get a blank browser screen.  The pdf reader does not even open. I am confused!
<cfsetting requestTimeOut = "120" >





<cfoutput>

<cfdocument name="Create" format="pdf" backgroundvisible="yes" scale="65">

<cfdump var="#session#">

            <cfset Cost = 0>

			<cfset Occurrences = 0>

            <cfset Total = 0>

            <cfset Price = 0>



<cfloop list="session.transid" index="x">

     <cfquery name="qryUpdateEmbr" datasource="#application.dsn#">

        update tblTransaction

        Set EmbroideryPOCreated = #Now()#

        where transactionid in (#session.transid#)

    </cfquery> 



</cfloop>



  <cfquery name="qryFanshop" datasource="#application.dsn#">

    	Select distinct fanshop

        from tblTransaction

        where transactionid in (#session.transid#)

    </cfquery>

    

<cfset fanshoplist = ''>

    

<cfloop query="qryfanshop">

	<cfif fanshoplist EQ ''>

    	<cfset fanshoplist = #fanshop#>

    <cfelse>

    	<cfset fanshoplist = #fanshoplist# & ',' & #fanshop#>

    </cfif>	    

</cfloop> 

   





<!--- Loop over the transid list--->



<cfloop list="#fanshoplist#" index="j">  <!--- Begin the transid loop ---> 

      





	<cfquery name="qryTransactions" datasource="#application.dsn#">

    	Select distinct a.logo, b.productStyleNumber, a.color, a.fanshop

        from tblTransaction a

        left outer join skorsports.dbo.ppiproducts b

        on a.productid = b.productid

        where fanshop = '#j#'

        and a.transactionid in (#session.transid#)

    </cfquery>

    <cfquery name="qryVendor" datasource="#application.dsn#">

    	Select *

        from tblVendor

        where vendorid = #session.vendor#

    </cfquery>

    

              <!--- Find Valid PO Number--->	

                <cfquery name="qryPONUM" datasource="#application.dsn#">

                    select PONum

                    from tblPurchaseOrder

                    Order by PONum DESC

                </cfquery>

                

                <cfset PONUM = #qryPONUM.PONUM# + 1>

        

	<!--- BEGIN:  First Create the pdf file to attach to the email message --->



    







<body>



        <table border="0" cellspacing="0" align="center">

        	<tr>

                

                <td colspan="3">

                    <img src="../images/SKOR_FAN_SHOP_LOGO.jpg" height="150px" width="200px" />

                </td>

                <td colspan="4">

                    <font size="+2">SkorFanShop Purchase Order #PONUM#</font>

                </td>

             </tr> 

             <tr height="75px">

            	<td colspan="9">

             		<hr />

                </td>

           	</tr> 

            <tr>

            	<td colspan="3" style="border-style:solid;">

                	<table border="0">

                    	

                         <tr>

                        	<td colspan="3"><b>Skor Sports</b></td>

                        </tr>

                         <tr>

                        	<td colspan="3">952 Big Tree Rd</td>

                        </tr>

                        <tr>

                        	<td>South Daytona</td>

                            <td>FL</td>

                            <td>32119</td>

                        </tr>

                        <tr>

                        	<td colspan="3">&nbsp;</td>

                        </tr>

                        <tr>

                        	<td colspan="1">Phone:</td>

                            <td colspan="2">(386) 258-1900</td>

                        </tr>

                         <tr>

                        	<td colspan="1">Fax:</td>

                            <td colspan="2">(386) 255-2980</td>

                        </tr>

                    	<tr height="50px" valign="bottom">

                        	

                        </tr>

                         <tr>

                        	<td colspan="3"><hr /></td>

                        </tr>

                        <tr>

                        	<td colspan="3">#qryVendor.VendorName#</td>

                        </tr>

                         <tr>

                        	<td colspan="3">#qryVendor.ContactName#</td>

                        </tr>

                         

                        <tr>

                        	<td colspan="3">#qryVendor.Address#</td>

                        </tr>

                        <tr>

                        	<td>#qryVendor.City#,</td>

                            <td>#qryVendor.State#</td>

                            <td>#qryVendor.zip#</td>

                        </tr>

                        <tr>

                        	<td colspan="1">Phone:</td>

                            <td colspan="2">#qryVendor.telephone#</td>

                        </tr>

                         <tr>

                        	<td colspan="3">&nbsp;</td>

                        </tr>

                         <tr>

                        	<td colspan="1">Fax:</td>

                            <td colspan="2">#qryVendor.fax#</td>

                        </tr>

                        <tr>

                        	<td colspan="1">Email:</td>

                            <td colspan="2">#qryVendor.emailAddress#</td>

                        </tr>

                    </table> 

                </td>

               

                <td align="center" colspan="2" valign="top">

                	<table>

                    	<tr height="75px">

            				<td colspan="9">&nbsp;

                				

                			</td>

           				 </tr>    

                        <tr>

                        	<td colspan="3">Ship To:</td>

                        </tr>

                         <tr>

                        	<td colspan="3"><hr /></td>

                        </tr>

                         <tr>

                        	<td colspan="3">Skor Sports</td>

                        </tr>

                        <tr>

                        	<td colspan="3">952 Big Tree Rd</td>

                        </tr>

                        <tr>

                        	<td>South Daytona</td>

                            <td>FL</td>

                            <td>12345</td>

                        </tr>

                        <tr>

                        	<td colspan="3">

                            	<hr />

                            </td>

                        </tr>  

                        <tr>

                        	<td colspan="3">

                            	<b>Please Ship Using:</b>

                            </td>

                        </tr>  

                        <tr>

                        	<td colspan="3">

                            UPS Account Number

                            </td>

                        </tr> 

                        <tr>

                        	<td colspan="3" align="center">

                            <b>A40T11</b>

                            </td>

                        </tr>   

                    </table> 

                </td>

            </tr>

            <tr><td colspan="9">&nbsp;</td></tr>

            <tr><td colspan="9">&nbsp;</td></tr>

            <tr bgcolor="##CCCCCC"><td colspan="2" align="left"><b>Product List:</b></td><td><b>Vendor:</b></td>

                        	<td colspan="1"><b>#qryVendor.VendorName#</b></td><td colspan="2"><b>Account Number:</b></td>

                        	<td colspan="2"><b>#qryVendor.AccountNumber#</b></td></tr> 

           <tr><td colspan="9">&nbsp;</td></tr>

           <tr><td colspan="9">&nbsp;</td></tr>

            <tr bgcolor="##CCCCCC">

            	<!---<td width="150px" align="center">Vendor Name</td>--->

                <td width="100px" align="center">Logo</td>

                <td width="100px" align="center">Product Style Number</td>

                <td width="200px" align="center">Color</td>

                <td width="150px" align="center">Quantity</td>

                <td width="150px" align="center">Cost</td>

                <td width="150px" align="center">Per Item Total</td>

                <td width="250px" align="center">Running Total</td>

            </tr>

            <tr><td colspan="9"><hr /></td></tr> 

             <tr><td colspan="9">&nbsp;</td></tr>

             

             



            

            

            <cfloop query="qryTransactions">

            

             

				

                 

                 <cfquery name="qryColors" datasource="#application.dsn#">

                 	select distinct color, COUNT(color) AS ColorNumOccurrences,b.productStyleNumber, Sum(quantity) AS numProducts, b.productcost, a.transactionid

                    from tblTransaction a

                    left outer join skorsports.dbo.ppiProducts b

                    on a.productid = b.productid

                    left outer join tblVendor c

                    on b.vendorid = c.vendorid

                    where b.productStyleNumber = '#productStyleNumber#'

                    and color = '#color#'

                    GROUP BY a.productid, a.color,b.productStyleNumber, b.productcost, a.transactionid

                 </cfquery>

                 

                <!--- Insert details into tblPODetails--->

               	<cfquery name="qryDetail" datasource="#application.dsn#">

                	insert into tblPODetail(transactionID, PONUM)

                    values('#qryColors.transactionid#', #PONUM#)

                </cfquery>   

               

               	<!---<cfloop query="qryColors">--->

                

                

                

                	<cfif #qryColors.numProducts# NEQ ''>

                    	 <cfset Occurrences = #qryColors.numProducts#>   

                    </cfif>

                    

                	

                    	

                    

                      

                    <cfif #session.POType# EQ 1>

                    	<cfset Cost =  4.00>       

                    <cfelse>

                    	<cfset Cost =  #productCost#>   

                    </cfif> 

                       

               		<cfset Price = #Cost# * #Occurrences#>

                 	<cfset Total = #Total# + #Price#>

                    

              <!--- Get the correct Vendor Color --->      

                	<cfset colorlist = listtoarray(color,"[]")>

                    <cfset VendorColor = #colorlist[1]#>

                    <cfset VendorColor = #REPLACE(VendorColor,'_',' ','All')#>

                    

                	<tr height="50px" <CFIF (CurrentRow MOD 2) IS 0> bgcolor="##82CAFF"<cfelse>bgcolor="##AFC7C7"</cfif>>

                    	<!---<td align="center">#qryTransactions.VendorName#</td>--->

                        <td align="center" ><img src="http://www.#fanshop#.skorfanshop.com/images/Logo/#logo#" height="75px" width="75px"/></td>

                        <td align="center">#qryTransactions.productStyleNumber#</td>

                        <td align="center">#color#</td>

                        <td align="center">#qryColors.numProducts#</td>

                        <td align="center">#LSCurrencyFormat(Cost,"local")#</td>

                        <td align="center">#LSCurrencyFormat(Price, "local")#</td>

                        <td align="center">#LSCurrencyFormat(Total, "local")#</td>

                    </tr>

                    

                     

             

              

            </cfloop>

             <tr><td colspan="9">&nbsp;</td></tr>

            <tr><td colspan="9"><hr style="border:none;" /></td></tr>

            <tr><td colspan="9" align="right" bgcolor="##CCCCCC"><font size="+3"><b>Total: #LSCurrencyFormat(Total, "local")#</b></font></td></tr>

        </table>

       

</body>        





        <!--- BEGIN:  Now that we have the pdf, mail it to the right person --->

<!---<cfdocumentitem type="pagebreak"/> --->			

        </cfloop><!--- End the transid loop --->  

</cfdocument>         



</cfoutput>

Open in new window

0
Comment
Question by:clayo
  • 3
  • 2
5 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 500 total points
Comment Utility
>> <cfdocument name="Create"

It's because you're using the "name" attribute.  That will send the output to a variable named "create" instead of displaying the pdf in the browser.  Remove that attribute and the pdf will display in the browser as you expect.
0
 

Author Comment

by:clayo
Comment Utility
Wow that is kind of embarassing...  But very greatful for your post
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
No need to be embarrassed.  How do you think I knew that was the problem so fast ... ;-)
0
 
LVL 52

Expert Comment

by:_agx_
Comment Utility
... I've um.... done the same thing myself ;-)
0
 

Author Comment

by:clayo
Comment Utility
thanks for your help
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Script 12 114
Database set up 5 60
Is it true tt IIS7 can't support TLSv1.2 if OS is on Win2008 1 40
listing all functions in JavaScript 19 96
Most ColdFusion developers get confused between the CFSet, Duplicate, and Structcopy methods of copying a Structure, especially which one to use when. This Article will explain the differences in the approaches with examples; therefore, after readin…
Hi, Even though I have created this Tutorial on My personal Blog, Some people might not able to find my website, So here i am posting it again Today, from the topic it is very clear that i will be showing you here the very basic usage of how we …
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now