HTMLDOC works fine with ColdFusion, but.... you need to check couple things
first.
1. Make sure HTMLDOC.exe works fine with the static htm file.
Create the htm on the harddisk.
Use HTMLDOC.exe application to generate the pdf.
Open the generated pdf with Adobe Reader.
If Acrobat can't open the file or HTMLDOC crashes then check the
static htm file.
2. Validate the static HTML code. You can use ColdFusion(Tools, Validate
Document from the top menu) to validate the code. I found that <TR></TR>
sequence crashes HTMLDOC.exe version 1.8. You might find other cases where
HTMLDOC is not going to be able to create the pdf file. So, you need 100%
valid HTML. The browsers are very forgiving....HTMLDOC is not.
3. Check the HTMLDOC documentation for the supported HTML tags.
4. Good luck.
Sample:
<CFSET gcPDFPath = "c:/inetpub/wwwroot/PDF/"><!--- physical path on
the server --->
<CFSET HtmlDocExe = "c:\cfusion\htmldoc\htmldoc.exe"><!--- full path
to htmldoc.exe --->
<CFSCRIPT>
//cfCode contains HTML static code.
rv = cfCode;
rv = REReplaceNoCase(rv,'<TR>
*</TR>','<TR><TD></td></tr>','ALL'); // <TR></TR> crashing HTMLDOC
// add date and time to filename to solve "delete pdf file too
slow" problem
uniqueKey = DateFormat(now(),"yyyymmdd") &
TimeFormat(now(),"HHmmss");
path = gcPDFPath;
// from setvars.cfm
htmtempfile = path & 'f_' & Client.CFToken & '_' &
URL.RptID & '_' & uniqueKey & "_pdf.htm"; // result of this tag
pdffilename = 'f_' & Client.CFToken & '_' & URL.RptID &
'_' & uniqueKey & "_pdf.pdf"; // name of pdf file
pdftempfile = path & pdffilename;
// full path and name of pdf file
cfCodetempfile = path & 'f_' & Client.CFToken & '_' & URL.RptID &
'_' & uniqueKey & "_cfCode.htm"; // for debug purposes only. cfCode.
</CFSCRIPT>
<CFX_html2PDF
htmldoc = "#HtmlDocExe# -t pdf13 --webpage --landscape --footer
... --header ... --left 20 --no-title --no-toc --right 20 --pagemode
document --top 20 --bodyfont Arial --textfont Arial --fontsize 12"
INPUTFILE = "#htmtempfile#"
OUTPUTFILE = "#pdftempfile#">
<!--- I found that OPTIONS attribute doesn't work as described in the
documentation.
I used the command line instead... --->
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists