<html>
<head>
<title>PD4ML under CFMX 6.x Std
Edition</title>
</head>
<body>
<!---
BEFORE RUNNING :
Idea 1 :
put the
JAR file : pd4ml_demo.jar
in the
same folder as current CFM page
Idea 2 :
maybe you
can put the JAR file : pd4ml_demo.jar
into the ColfdFusion's CustomTags
directory
Idea 3 :
use the ColdFusion Admin to configure classpath
to use the jar
--->
<cfscript>
// The source file to convert (http:// or file:)
inURI="file:n:/web/tests/pd4ml/test.html";
// The pdf file to generate (full pathname)
fileOut="n:/web/tests/pd4ml/test.pdf";
unnitsvalue="mm"; // Millimeters
// A4 'vertical' in mm
format = createObject("java","java.awt.Dimension").init(210,297);
topValue = 10; // mm
leftValue = 10; // mm
rightValue = 10; // mm
bottomValue = 10; // mm
landscapevalue="yes";
userSpaceWidth=780; // px
splitValue=0;
patchValue=1;
authorName="";
// PD4ML Object instantiation
pd4ml = createObject("java","org.zefer.pd4ml.PD4ML");
// Format, orientation, insets
if (landscapeValue) format = pd4ml.changePageOrientation(format);
insets = createObject("java","java.awt.Insets")
.init(topValue,leftValue,bottomValue,rightValue);
if (unnitsvalue EQ "mm") {
pd4ml.setPageSizeMM(format);
pd4ml.setPageInsetsMM(insets);
} else {
pd4ml.setPageSize(format);
pd4ml.setPageInsets(insets);
}
if(authorName NEQ "")
pd4ml.setAuthorName(authorname);
if (userSpaceWidth NEQ "") pd4ml.setHtmlWidth( userSpaceWidth );
pd4ml.enableImgSplit( splitValue );
pd4ml.enableRenderingPatch( patchValue );
fos = createObject("java","java.io.FileOutputStream").init(fileOut);
pd4ml.render(inURI,fos); // Start rendering
</cfscript>
<cfoutput>File '#inURI#' converted to '#fileOut#'</cfoutput>
</body>
</html>
|