you may olso want to use jtidy
with flying saucer with wrapper (
http://groups.google.com/group/openbd/browse_thread/thread/dc3045e3ee08c359?pli=1):
<cfset f.pdf = createobject("component","pdf") />
<cfset f.tidy = createobject("component","tidy") />
<cffile action="READ" file="#fun_fichero#" variable="local.content"
charset="iso-8859-1" />
<cfset local.content = f.tidy.clean(local.content) />
<cfset f.pdf.encode(local.content,fun_fichero ) />
<cffile action="WRITE" file="#fun_fichero#" output="#local.content#"
charset="iso-8859-1" />
----------------------- pdf.cfc ------------------------
<cfcomponent displayname="htmlToPdf" output="true">
<cffunction name="encode" access="public" output="true" returntype="void"
>
<cfargument name="content" type="string" required="true">
<cfargument name="pdffile" type="string" required="true">
<cfargument name="downloadFile" type="Boolean" required="false"
default="0">
<cfset local.outputPath = GetDirectoryFromPath(arguments.pdffile)>
<cfset local.outputFile = GetFileFromPath(arguments.pdffile)>
<cfset local.outputFile =
replace(arguments.pdffile,listLast(local.outputFile,'.'),'pdf','ALL')>
<cfset CFDocument =
Createobject("java","com.myproject.CFWrapper.CFDocument") />
<cfset objOutput = CreateObject("java", "java.io.FileOutputStream"
).Init(CreateObject("java", "java.io.File" ).Init(JavaCast("string",
local.outputFile))) />
<cfset
CFDocument.convertToPDF(objOutput,arguments.content,"file://#expandpath('.')#/")
/>
<cfif arguments.downloadFile>
<cfcontent type="application/pdf" file="#local.outputFile#"
reset="yes">
<cfheader name="Content-Disposition"
value="filename=#getFileFromPath(local.outputFile)#">
</cfif>
</cffunction>
</cfcomponent>
---------------------- tidy.cfc ----------------------
<cfcomponent name="jtidy" displayname="jTidy" hint="clean out invalid html">
<cffunction name="clean" displayname="Tidy parser" hint="Takes a string as
an argument and returns parsed and valid xHTML" output="true">
<cfargument name="strToParse" required="true" type="string" default=""
/>
<cfscript>
/**
* This function reads in a string, checks and corrects any invalid
HTML.
* By Greg Stewart
*
* @param strToParse The string to parse (will be written to file).
* accessible from the web browser
* @return returnPart
* @author Greg Stewart (gregs(at)tcias.co.uk)
* @version 1, August 22, 2004
* @version 1.1, September 09, 2004
* with the help of Mark Woods this UDF no longer requires temp files
and only accepts
* the string to parse
*/
var returnPart = ""; // return variable
parseData = trim(arguments.strToParse);
jTidy = createObject("java","org.w3c.tidy.Tidy");
jTidy.setQuiet(true);
jTidy.setMakeClean(true);
jTidy.setIndentContent(true);
jTidy.setSmartIndent(true);
jTidy.setIndentAttributes(true);
jTidy.setWraplen(1024);
jTidy.setXHTML(true);
// create the in and out streams for jTidy
readBuffer =
CreateObject("java","java.lang.String").init(parseData).getBytes();
inP =
createobject("java","java.io.ByteArrayInputStream").init(readBuffer);
//ByteArrayOutputStream
outx = createObject("java", "java.io.ByteArrayOutputStream").init();
// do the parsing
jTidy.parse(inP,outx);
// close the stream
// outx.close();
outstr = outx.toString();
// ok now strip all the header/body stuff
// startPos = REFind("<body>", outstr)+6;
// endPos = REFind("</body>", outstr);
// returnPart = Mid(outstr, startPos, endPos-startPos);
returnPart = outstr;
</cfscript>
<cfreturn returnPart />
</cffunction>
</cfcomponent>
regards
Héctor
coolbleiben.net
On Wed, Dec 10, 2008 at 3:47 PM, asantiago <[EMAIL PROTECTED]> wrote:
>
> If it can help or give you ideas there is also this project
> https://xhtmlrenderer.dev.java.net/ which also uses iText.
> I used it for simple HTML pages (with some CSS) and works fine.
>
>
> On Dec 10, 3:33 pm, Andy Wu <[EMAIL PROTECTED]> wrote:
> > Hi Anthony,
> >
> > I'm planning to look at implementing CFDOCUMENT soon and will probably
> > leverage the iText library in doing so (http://www.lowagie.com/iText/).
> > It may offer some or all of the functionality that CFPDF offers so I may
> > delve further into it in future.
> >
> > Which functions of CFPDF are most critical to you?
> >
> > Thanks
> > Andy
> >
> > On 10/12/2008 04:11, ahixon2112 wrote:
> >
> > > I have outgrown my Adobe CF 8 Standard server, but as a small non-
> > > profit hospital, we just don't have the budget for a multi-thousand
> > > dollar enterprise license. That said, I want to get away from Windows
> > > completely on the server side and migrate to an Ubuntu, OpenBD, MySQL
> > > solution. A couple of the projects I have coming up call for a way to
> > > convert uploaded Word documents to a PDF to be displayed to normal
> > > users.
> >
> > > My question is this: Is there an alternative solution that other
> > > OpenBD users have implemented sans cfpdf type tags (I'm assuming those
> > > are proprietary to Adobe)?
> >
> > > Thanks in advance!
> >
> > > Anthony
> >
> > > From - Wed
> >
>
--~--~---------~--~----~------------~-------~--~----~
Open BlueDragon Public Mailing List
http://groups.google.com/group/openbd?hl=en
official blog @ http://blog.openbluedragon.org/
!! save a network - trim replies before posting !!
-~----------~----~----~----~------~----~------~--~---