• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

CFDOCUMENT times out on generating simple PDF

Explorer ,
Jun 23, 2006 Jun 23, 2006

Copy link to clipboard

Copied

I generate content from query and it takes some seconds to show up corresponding HTML piece.
When I enclose this into cfdocument tag - it hangs, then gives me the following error:
"The content of this document process takes more than 60000 milliseconds to process.."
Sometimes, after also quite a long time, it gives me "pdf contains no pages" error.

I tried to remove some tags, like <DIV> - instead, i put <P> (i tried this on simple example). Other from this, I have <A> tags. Somebody of you said, it could have a problem with evaluating some hrefs - so I used <CFSAVECONTENT> tag to save whole output to var, and then used content var inside of <CFDOCUMENT> - no luck, error is the same...

I use MX7 Enterprise edition.

Please, help!
TOPICS
Advanced techniques

Views

4.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 25, 2006 Jun 25, 2006

Copy link to clipboard

Copied

Could we have a look at the code?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

Sure, here it is:

quote:

<cfif IsDefined("form.execute") and drplantemplateDetails.recordCount GT 0>
<cfdocument marginbottom="2" marginleft="2" marginright="2" margintop="2" fontembed="yes" format="pdf" name="drplandoc" backgroundvisible="yes" orientation="portrait" pagetype="a4" filename="C:\UserResources\#checkuser.userid#\#drplantemplateDetails.drplan_name#.pdf" overwrite="yes" unit="cm">
<cfdocumentsection>
<cfoutput query="drplantemplatestepDetails">
<cfdocumentitem type="header">
<p><a name="#drstep_id#">#step_name#</a></p>
</cfdocumentitem>
<p>#content#</p>
<cfdocumentitem type="pagebreak"/>
</cfoutput>
</cfdocumentsection>
</cfdocument>
</cfif>


This is a shortened version of code, that also doesn't work. Full version also contains images INLINE, i.e.
<img src="viewresource.cfm?resource_id=blablabla>, which output image using cfheader + cfcontent. I once tried this inside cfdocument, but got only image placeholders... WHether there is no way to build-in inline images into PDF documents, using cfdocument tag?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

Place <cfoutput query="drplantemplatestepDetails"> before <cfdocumentsection>, and </cfoutput> after </cfdocumentsection>.

Ensure that this path exists and that it is unique: C:\UserResources\#checkuser.userid#\#drplantemplateDetails.drplan_name#.pdf. For example, I would be careful when assigning the filename dynamically from a resultset. The query might bring up two or more names. In any case, test the code first with filename="C:\UserResources\user123\drplan_name123.pdf".


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

BKBK, thanks, I've tried exactly like you had proposed: no luck.

But i forgot to mention, that sometime my initial (and '123', that you offered also) code produces the following error:
timeout when listing directory content - this code follows cfdocument code to determine generated pdf file size, if it exists:

quote:


<cfif FileExists("C:\UserResources\123\drplan_name123.pdf")>
<cfdirectory action="list" filter="drplan_name123.pdf" name="getFileInfo" directory="C:\UserResources\123">
blablabla...



I.e. sometimes I get cfdocument timeout error, sometimes - timeout for listing directory error. In last case pdf file IS created, but
1) anyway, it takes unallowable looong time for such short output (several strings)
2) full code leaves empty image placeholder, where images are generated by cfheader + cfcontent, like i described in my first post.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

Did you manually create the folder C:\UserResources\123? Another suggestion:

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

At last seems like I've found the problem. The problem is #content# field. It contains inline images, like this:
quote:


Here is the resource image <img src="showresource.cfm?resource_id=blablabla">



And showresource.cfm gets image path from database by resource_id and then uses this path +
cfheader and cfcontent tag with 'Content-Disposition: inline' to show image right away. HTML displays properly. But cfdocument hangs...

Any ideas how to handle this situation?

BTW, when instead of #content# I just put 'blabla' - this word is displayed with distortion on every page: visible is only about 25% of text from below. The rest part looks like erased to background (white) in graphic editor... 😞

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

<img> should display an image directly within cfdocument, without any need for <cfheader and <cfcontent>.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

But these are 'secure' images (screen dumps of 'secret pages') - i can't store them in www folder, so like other types of secure resources (these could be pdfs, docs, xls, etc) I store them ABOVE www root and use cfheader + cfcontent to access them.. The only difference is that other types of resources are offered for downloading (content-disposition: attachment) and images are generated inline... How can I get without this in my situation? Do I need to save them temporary on 'backstage' to some wwwfolder for cfdocument and delete later? Uhhm... it's getting clumsy and complicated...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

<cfheader> and <cfcontent> appear to be the problem. If you save any one of the following 3 code combinations as the file testPage1.cfm, then the page will display the image.

1) <cfheader name="Content-Disposition" value="inline; photo1.jpg">
<cfcontent type="image/pjpeg" file="c:\photos\photo1.jpg" deletefile="no">

2) <cfcontent type="image/pjpeg" file="c:\photos\photo1.jpg" deletefile="no">

3) <img src="photo1.jpg">

For a second image, you could also change from photo1.jpg to photo2.jpg and save the code as testPage2.cfm. When I tested the various combinations, I discovered that the only one that works with the code below is:

testPage1.cfm
============
<img src="photo1.jpg">

testPage2.cfm
============
<img src="photo2.jpg">

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

Thanks for information. Ok, I've created parser (i will anyway need parser for content field - i will be evaluating variable by names there, etc...) So - parser temporary copies all resources into current www folder, especially for cfdocument. Then replace command replaces corresponding links. Again - html shows ok. But damned cfdocument doesn't work, anyway!
And now i even can't name all the reasons it doesn't work! It works only when i remove almost everything from my output!
Seems it even doesn't like my css style! I don't have idea what to do...

Here is the code

quote:



<cfoutput>

blablabla...

<cfdocument filename="C:\UserResources\#checkuser.userid#\#drplantemplateDetails.drplan_name#.pdf" format="pdf" overwrite="yes">
<cfdocumentsection>
<html>
<head>
<title>
</title>
<link rel="stylesheet" title="#client.theme##client.fontSize#" type="text/css" href="/#client.theme##client.fontSize#.css" title="Default"/>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body class="headerStyle">
#drplantemplateDetails.header#
</cfdocumentsection>
<cfloop query="drplantemplatestepDetails">
<cfdocumentsection>
<cfdocumentitem type="header">
<H2>#drplantemplateDetails.header#</H2>
</cfdocumentitem>
<p><a name="#drstep_id#">#step_name#</a></p>
<p>#parseDRPlan(content, "pdf", GetDirectoryFromPath(GetCurrentTemplatePath()), "/members/Planning/resources", "create")#</p>
<cfloop index="i" from="1" to="3">
<cfset step_id = Evaluate("step_" & i & "_id")>
<cfset step_header = Evaluate("step_" & i & "_header")>
<cfset step_description = Evaluate("step_" & i & "_description")>
<cfif step_id is not "" and (not IsDefined("form.drstep_id") or IsDefined("form.drstep_id") and ListFind(form.drstep_id, step_id) is not false)>
<p><a href="#ListGetAt(CGI.SCRIPT_NAME, ListLen(CGI.SCRIPT_NAME, "//"), "//")#?#CGI.QUERY_STRING####step_id#"><cfif step_header is "">Unnamed<cfelse>#step_header#</cfif></a></p>
<cfif step_description is not ""><p>#step_description#</p></cfif>
</cfif>
</cfloop>
<cfdocumentitem type="pagebreak"/>
</cfdocumentsection>
</cfloop>
<cfdocumentsection>
#drplantemplateDetails.footer#
</body>
</html>
</cfdocumentsection>
</cfdocument>

blabla...

</cfoutput>


Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

You forgot to add a few cfoutput tags.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2006 Jun 27, 2006

Copy link to clipboard

Copied

Thanks for your replies!
About cfoutput - I used one, but the only one in whole cfm document - at the top and bottom. But ok, thinking that output may preferably be used inside cfdocument, I copied the code of BKBK instead of mine - no luck again! :(
Again timeout error and, sometimes, other error:
"The request has exceeded the allowable time limit Tag: CFLOOP".
It's also a lie, because without cfdocument this loops works several seconds!


P.S. BTW: right now i've ensured, that I don't need to copy images into current www folder! Instead, i can use "file:///" prefix and it works with local folders as is. Since I direct output to file, all local folder names are stayed insivible in page source! I've successfully generated pdf file with shortened piece of code. However, I still have a problem with some other parts - it keeps hanging and timeouting: weird, but the reason is <html>...<head>...<body> starting and ending tags and/or style... Dunno why.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jun 27, 2006 Jun 27, 2006

Copy link to clipboard

Copied

LATEST
I have removed these enclosing tags, left only viscera and it works ok.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 26, 2006 Jun 26, 2006

Copy link to clipboard

Copied

I don't see one cfoutput tag...you need them inside the cfdocument tag.
Also I would get rid of the pagebreak every loop, I think it's implied
with the closing cfdocumentsection tag.
HTH
--
Tim Carley
www.recfusion.com
info@NOSPAMINGrecfusion.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
Documentation