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

CONVERT WORD .DOC TO PDF W/CFDOCUMENT

Contributor ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

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' into 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" pagetype="letter" encryption="40-bit" permissions="AllowPrinting,AllowCopy" margintop="0.1" marginleft="0.1" marginright="0.1">
<cfinclude template="mywords.doc">
</cfdocument>

Any ideas????
TOPICS
Advanced techniques

Views

2.2K

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 ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

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.

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
Contributor ,
Apr 19, 2006 Apr 19, 2006

Copy link to clipboard

Copied

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.

Thanks.

>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.

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 ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

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" <webforumsuser@macromedia.com> wrote in message
news:e2120n$t85$1@forums.macromedia.com...
> 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'
> into
> 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"
> pagetype="letter"
> encryption="40-bit" permissions="AllowPrinting,AllowCopy" margintop="0.1"
> marginleft="0.1" marginright="0.1">
> <cfinclude template="mywords.doc">
> </cfdocument>
>
> Any ideas????
>


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
Participant ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

There is also thing called "SolidConverter". Cheap. Something like $40-$50. No API. Have to use command-line mode. Tricky and ugly, but works.

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 ,
Apr 17, 2006 Apr 17, 2006

Copy link to clipboard

Copied

going from this:
http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/cfobje28.htm
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)

<CFTRY>
<!--- If it exists, connect to it --->
<CFOBJECT ACTION="CONNECT" CLASS="Word.Application" NAME="WordApp"
TYPE="COM">
<CFCATCH>
<!--- The object doesn't exist, so create it --->
<CFOBJECT ACTION="CREATE" CLASS="Word.Application" NAME="WordApp"
TYPE="COM">
</CFCATCH>
</CFTRY>
<!--- grab the content; add line breaks; few other fixes --->
<cfscript>
WordApp.Visible = FALSE;
WordDoc = WordApp.Documents;
newDoc =
WordDoc.open('#GetDirectoryFromPath(GetBaseTemplatePath())#test.doc');
//myRange = newDoc.Range(0);
newDoc.saveAs('#GetDirectoryFromPath(GetBaseTemplatePath())#testdoctohtml.html',
Val(8));
//documentContent=myRange.text;
newDoc.Close();
WordApp.Quit();
WordApp = "Nothing";
//documentContent = Replace(documentContent, Chr(13), "<BR>", "ALL") ;
//documentContent = Replace(documentContent, "�", "'", "ALL") ;
//documentContent = Replace(documentContent, " � ", " - ",
"ALL") ;
// apostrophes are interpreted as =; change
//documentContent = Replace(documentContent, "=s", "'s", "ALL") ;
//documentContent = "<P>" & documentContent & "</P>" ;
</cfscript>
<cfsavecontent variable="thehtmldoc">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
</head>

<body>
<!--- <cfoutput>#documentContent#</cfoutput> --->
<!--- <cfdump var="#newDoc#" > --->
<cfinclude template="testdoctohtml.html">
</body>
</html>
</cfsavecontent>
<cfdocument name="report" format="PDF" filename="testdoctopdf.pdf"
overwrite="yes" fontembed="Yes" pagetype="letter"
encryption="40-bit" permissions="AllowPrinting,AllowCopy" margintop="0.1"
marginleft="0.1" marginright="0.1">
<cfdocumentsection ><cfoutput>#thehtmldoc#</cfoutput></cfdocumentsection>
</cfdocument>
<cfoutput>#thehtmldoc#</cfoutput>

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
New Here ,
May 04, 2006 May 04, 2006

Copy link to clipboard

Copied

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.

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 ,
May 06, 2006 May 06, 2006

Copy link to clipboard

Copied

LATEST
From Coldfusion cfdocument documentation:
"The cfdocument tag does not support the Internet Explorer-specific HTML generated by Microsoft Word."

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