dawes4000
asked on
How to make cfdocument load pdf faster?
The rendering of <cfdocument format="pdf"> takes FOREVER.
I have tried using a progressbar and <cfflush> but the document just doesn't render fast enough.
Any suggestions?
<!--- Code Begins --->
<cfquery name="qryClassDetail" datasource="#session.connS tring#">
SELECT tblParts.PartID, tblParts.Description, tblParts.Price, tblParts.Unitofmeasure, tblParts.resale, tblParts.NetPricing, tblClass.class AS Class,
tblClass.Description AS classDescription
FROM tblParts INNER JOIN
tblClass ON tblParts.class = tblClass.class
WHERE (tblParts.resale = 'y') AND (tblParts.Price <> '0') AND (tblParts.PartID NOT LIKE '%BLANK%') AND (tblParts.class NOT LIKE '%2') AND (tblParts.class <> 'DBME') AND (tblParts.class <> 'ELE') AND
(tblParts.class <> 'RMB') AND (tblParts.class <> 'SCC') AND (tblParts.class <> 'TP') AND (tblParts.class <> 'MISC') AND (tblParts.class <> 'M&C')
GROUP BY tblClass.class, tblParts.PartID, tblParts.Description, tblParts.Price, tblParts.Unitofmeasure, tblParts.resale, tblParts.NetPricing,
tblClass.Description
ORDER BY tblClass.class
</cfquery>
<body bgcolor="#FFFFFF" leftmargin="65">
<h3>Please Wait</h3><br>
The pages are loading...<br>
<img name="meter" width="200" height="16" src="../images/progressbar /PercentBl ank.gif" border="0" alt="">
<cfflush>
<cfloop from="0" to="100" step="25" index="i">
<cfdocument format="pdf">
<table cellpadding="1" cellspacing="0" border="0" width="620">
<cfoutput query="qryClassDetail" group="Class">
<tr><td colspan="4"> </td></t r>
<tr bgcolor="##4E8FD1">
<td colspan="4"><font color="##F2F2F2"><h3>  ; #cl assDescrip tion#</h3> </font></t d>
</tr>
<tr bgcolor="##CCCCCC">
<td width="140"><strong> Image</strong></td>
<td width="100"><strong>PartID </strong>< /td>
<td width="328"><strong>Descri ption</str ong></td>
<td align="center" width="52"><strong>Retail< /strong></ td>
</tr>
<cfoutput>
<cfif qryClassDetail.resale NEQ "n">
<cfset PartID = trim(qryClassDetail.PartID )>
<cfset netPrice=qryClassDetail.ne tPricing>
<tr>
<td align="left">
<img height="40" src="../images/parts/#trim (PartID)#. jpg" border="0">
</td>
<td> #PartID#</font>< /td>
<td>
#qryClassDetail.Desc ription# (#trim(qryClassDetail.Unit ofMeasure) #)
</td>
<td align="right">
#NumberFormat(qryClassDeta il.price,' ______.__' )#
<cfif netPrice EQ "n">
<br />
<font style="text-align:right">( net)</font >
</cfif>
</td>
</tr>
</cfif>
</cfoutput>
</cfoutput>
</table>
</cfdocument>
<cfoutput>
<script language="javascript">
document.images["meter"].s rc = '../images/progressbar/Per cent#i#.gi f';
</script>
</cfoutput>
<cfflush>
</cfloop>
I have tried using a progressbar and <cfflush> but the document just doesn't render fast enough.
Any suggestions?
<!--- Code Begins --->
<cfquery name="qryClassDetail" datasource="#session.connS
SELECT tblParts.PartID, tblParts.Description, tblParts.Price, tblParts.Unitofmeasure, tblParts.resale, tblParts.NetPricing, tblClass.class AS Class,
tblClass.Description AS classDescription
FROM tblParts INNER JOIN
tblClass ON tblParts.class = tblClass.class
WHERE (tblParts.resale = 'y') AND (tblParts.Price <> '0') AND (tblParts.PartID NOT LIKE '%BLANK%') AND (tblParts.class NOT LIKE '%2') AND (tblParts.class <> 'DBME') AND (tblParts.class <> 'ELE') AND
(tblParts.class <> 'RMB') AND (tblParts.class <> 'SCC') AND (tblParts.class <> 'TP') AND (tblParts.class <> 'MISC') AND (tblParts.class <> 'M&C')
GROUP BY tblClass.class, tblParts.PartID, tblParts.Description, tblParts.Price, tblParts.Unitofmeasure, tblParts.resale, tblParts.NetPricing,
tblClass.Description
ORDER BY tblClass.class
</cfquery>
<body bgcolor="#FFFFFF" leftmargin="65">
<h3>Please Wait</h3><br>
The pages are loading...<br>
<img name="meter" width="200" height="16" src="../images/progressbar
<cfflush>
<cfloop from="0" to="100" step="25" index="i">
<cfdocument format="pdf">
<table cellpadding="1" cellspacing="0" border="0" width="620">
<cfoutput query="qryClassDetail" group="Class">
<tr><td colspan="4"> </td></t
<tr bgcolor="##4E8FD1">
<td colspan="4"><font color="##F2F2F2"><h3> 
</tr>
<tr bgcolor="##CCCCCC">
<td width="140"><strong> Image</strong></td>
<td width="100"><strong>PartID
<td width="328"><strong>Descri
<td align="center" width="52"><strong>Retail<
</tr>
<cfoutput>
<cfif qryClassDetail.resale NEQ "n">
<cfset PartID = trim(qryClassDetail.PartID
<cfset netPrice=qryClassDetail.ne
<tr>
<td align="left">
<img height="40" src="../images/parts/#trim
</td>
<td> #PartID#</font><
<td>
#qryClassDetail.Desc
</td>
<td align="right">
#NumberFormat(qryClassDeta
<cfif netPrice EQ "n">
<br />
<font style="text-align:right">(
</cfif>
</td>
</tr>
</cfif>
</cfoutput>
</cfoutput>
</table>
</cfdocument>
<cfoutput>
<script language="javascript">
document.images["meter"].s
</script>
</cfoutput>
<cfflush>
</cfloop>
ASKER
gdemaria,
I stripped all of the progress bar caode out and the time to deliver the PDF is 10 minutes, at times never. This same data is presented in html within 30 sec. Basically working with only 1600 records. Each has a thumb nail img less than 6kb. I need to style the text and enter page breaks. So i'm wondering if the css has something to do with the cfdocument.
I stripped all of the progress bar caode out and the time to deliver the PDF is 10 minutes, at times never. This same data is presented in html within 30 sec. Basically working with only 1600 records. Each has a thumb nail img less than 6kb. I need to style the text and enter page breaks. So i'm wondering if the css has something to do with the cfdocument.
ASKER
Tested again, code crashed the cf server. Not sure what is going on here. I have used cfdocument successfully before.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, commenting the imgs out had the pdf output in no time. I guess the issue then is to find a way that users can print this list. If they print the page through the browser then page breaks can not be made. I'm not familiar with flashpaper.
Can on print from flash paper? Otherwise, there may not be an effecient means to print the list.
Can on print from flash paper? Otherwise, there may not be an effecient means to print the list.
Looks like you are generating the PDF file FOUR times..
<cfloop from="0" to="100" step="25" index="i">
<cfdocument format="pdf">
The generation of the PDF file is INSIDE a CFLOOP that runs from 0-100 in steps of 25. That means you are creating the PDF four times.
I see that you are attempting to create a progress bar using this loop. I don't think this is the way to do it. CFFLUSH works by dumping to the screen every X number of bytes generated. You are writing to a PDF file so you haven't generated anything to the page, so your progress bar won't show until the PDF is done, then the progress bar will go from 0 to 100 immediately and you're done.
Strip out the progress bar and see if it speeds up...
<body bgcolor="#FFFFFF" leftmargin="65">
<h3>Please Wait</h3><br>
The pages are loading...<br>
<cfdocument format="pdf">
<table cellpadding="1" cellspacing="0" border="0" width="620">
<cfoutput query="qryClassDetail" group="Class">
<tr><td colspan="4"> </td></t
<tr bgcolor="##4E8FD1">
<td colspan="4"><font color="##F2F2F2"><h3> 
</tr>
<tr bgcolor="##CCCCCC">
<td width="140"><strong> Image</strong></td>
<td width="100"><strong>PartID
<td width="328"><strong>Descri
<td align="center" width="52"><strong>Retail<
</tr>
<cfoutput>
<cfif qryClassDetail.resale NEQ "n">
<cfset PartID = trim(qryClassDetail.PartID
<cfset netPrice=qryClassDetail.ne
<tr>
<td align="left">
<img height="40" src="../images/parts/#trim
</td>
<td> #PartID#</font><
<td>
#qryClassDetail.Desc
</td>
<td align="right">
#NumberFormat(qryClassDeta
<cfif netPrice EQ "n">
<br />
<font style="text-align:right">(
</cfif>
</td>
</tr>
</cfif>
</cfoutput>
</cfoutput>
</table>
</cfdocument>