This content has been marked as final. Show 7 replies
No it shouldn't generate a valid pdf file. Nice try though.
What you have to do is somehow, read the word file, save the content in a variable, and put the variable in your cfdocument. Or something like that.
or shell out 300 bucks and buy neevia.com docconverter. it's outstanding.
we've been using it for over a year now for all to-from conversion when
dealing with PDF. pretty easy API, too.
"drforbin1970" <firstname.lastname@example.org> wrote in message
> Shouldn't the following generate a valid PDF file? Well, it does NOT, the
> format is PDF but the output is garbage. The entire output is 'crunched'
> the first quarter of the first page of the PDF (for lack of a better
> description). Tried closing IE, rerunning, etc, etc, - no change.
> <cfdocument name="report" format="PDF" filename="temp.pdf"
> mimetype="application/msword" overwrite="yes" fontembed="Yes"
> encryption="40-bit" permissions="AllowPrinting,AllowCopy" margintop="0.1"
> marginleft="0.1" marginright="0.1">
> <cfinclude template="mywords.doc">
> Any ideas????
There is also thing called "SolidConverter". Cheap. Something like $40-$50. No API. Have to use command-line mode. Tricky and ugly, but works.
going from this:
One could save a file as html and then include it in the pdf.
I've only tried simple docs. (CFMX 7, M$ Word needs to be on the machine)
<!--- If it exists, connect to it --->
<CFOBJECT ACTION="CONNECT" CLASS="Word.Application" NAME="WordApp"
<!--- The object doesn't exist, so create it --->
<CFOBJECT ACTION="CREATE" CLASS="Word.Application" NAME="WordApp"
<!--- grab the content; add line breaks; few other fixes --->
WordApp.Visible = FALSE;
WordDoc = WordApp.Documents;
//myRange = newDoc.Range(0);
WordApp = "Nothing";
//documentContent = Replace(documentContent, Chr(13), "<BR>", "ALL") ;
//documentContent = Replace(documentContent, "�", "'", "ALL") ;
//documentContent = Replace(documentContent, " � ", " - ",
// apostrophes are interpreted as =; change
//documentContent = Replace(documentContent, "=s", "'s", "ALL") ;
//documentContent = "<P>" & documentContent & "</P>" ;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<!--- <cfoutput>#documentContent#</cfoutput> --->
<!--- <cfdump var="#newDoc#" > --->
<cfdocument name="report" format="PDF" filename="testdoctopdf.pdf"
overwrite="yes" fontembed="Yes" pagetype="letter"
encryption="40-bit" permissions="AllowPrinting,AllowCopy" margintop="0.1"
I also tried that using CFFILE to read the Word .doc, save in a variable and then put the variable in the CFDOCUMENT.
Didn't work. Same result.
I think I'll look into one of the suggestions here about having Word on the server to use it's object. I don't believe we have Word on the server box.
>No it shouldn't generate a valid pdf file. Nice try though.
>What you have to do is somehow, read the word file, save the content in a variable, and put the variable in your cfdocument. Or >something like that.
CFDocument is meant for creating dynamic documents. It generates PDF/Flashpaper from a given HTML content. It is not an universal to-from converter. So you can not use this tag to convert a word file into pdf. You might need to take a look at some other solution.
Mimetype attribute in the cfdocument tag is used to define the mimetype for the content that you would get in 'src' attribute. This is provided so that you can have plain text/ only image /HTML in the pdf.
From Coldfusion cfdocument documentation:
"The cfdocument tag does not support the Internet Explorer-specific HTML generated by Microsoft Word."