Lumpia,
You're probably going to have do it through a little trial
and error. But it looks like there are only a few patterns you have
to translate to CF, and they're repeated throughout the code.
For example the string array:
String pdffiles[] = ...
Probably translates to a CF array (ignoring 0/1 based index
issues)
<cfset pdffiles =
listToArray("PDFlib-real-world.pdf,PDFlib-datasheet.pdf,....")>
The call to
p = new pdflib();
Should translate to a createObject() call
<cfset p = createObject("java",
"com.pdflib.pdflib").init() />
Once you've created the object, the methods from CF are
almost exactly the same. Though you might need to use javacast() in
a few places.
java:
p.set_info("Creator", "PDFlib Cookbook");
p.set_info("Title", title + " $Revision: 1.8 $");
cf:
<cfset p.set_info("Creator", "PDFlib Cookbook") >
<cfset p.set_info("Title", title + " $Revision: 1.8
$")>
The rest looks pretty standard. Try/catch becomes
<cftry><cfcatch>. If becomes <cfif>. The for loop
becomes <cfloop>. etc.
Keep in mind you can also use <cfscript> syntax. Though
I didn't use it here, its probably closer to the java code in terms
of syntax.
HTH