I've figured out the Java image part:
<cfset jpg = ImageNew(foo)>
<cfimage action="write" source="#jpg#" destination="test.jpg" overwrite="yes">
This works.
But the fact that the two jars seem to conflict with one another throws a real
spanner into the works... Is there any way I could separate them and have both
present in CF?
Regards,
Stefan
On 24 Jan 2011, at 13:30, Stefan Richter wrote:
> I've got two further questions.
>
> Now that I got the syntax right I can run
>
> <cfset jpedal =
> createObject("java","org.jpedal.examples.images.HiResThumbnailExtractor") />
> <cfset jpedal.init()>
> <cfset img = jpedal.getHiresPage(1, 1,
> '/Applications/MAMP/htdocs/testbed/test.pdf')>
>
> and I get back a java.awt.image.BufferedImage
>
> What's the best/easiest way to now save this as a jpg to disk?
>
>
> Also the jpedal.jar that comes with CF seems to be interfering with the one
> I'd like to use. I can only get my example to work if I remove the CF version
> of the jar - but I think this will break other core CF features. Is there a
> way so that I can use both jars even though they contain some overlapping
> classes? Apparently the CF version is a custom version of jpedal and not the
> same as the one I downloaded from their site.
>
> Regards,
>
> Stefan
>
>
>
>
> On 24 Jan 2011, at 12:53, Stefan Richter wrote:
>
>> DOH!
>>
>> Thanks Scott!
>>
>>
>>
>> On 24 Jan 2011, at 12:47, Scott Stewart wrote:
>>
>>>
>>> Should be org.jpedal. rest of path
>>> On Jan 24, 2011 7:18 AM, "Stefan Richter" <[email protected]> wrote:
>>>>
>>>> I'm trying to use a Java library called jpedal (http://www.jpedal.org) in
>>> order to convert PDF files to images. The following works great from the
>>> commandline on my Mac:
>>>>
>>>> java -cp ./jpedal_trial.jar
>>> org/jpedal/examples/images/HiResThumbnailExtractor "test.pdf" "jpg"
>>>>
>>>> However I'm not sure how to invoke the same from CF. I added the jpedal
>>> trial jar to ColdFusion9/lib and then tried the following:
>>>> <cfset jpedal =
>>> createObject("java","org/jpedal/examples/images/HiResThumbnailExtractor") />
>>>> and got the error:
>>>> An exception occurred while instantiating a Java object. The class must
>>> not be an interface or an abstract class. Error: IllegalName:
>>> org/jpedal/examples/images/HiResThumbnailExtractor.
>>>>
>>>> I've spoken to the developer of jpedal, Mark Stephens, who told me that
>>> HiResThumbnailExtractor is not an interface or abstract class.
>>>>
>>>> As some of you may know, jpedal is already part of CF as Adobe have
>>> licensed the library for some of their PDF handling. I wondered if this was
>>> causing problems, but even after removing the original jpedal.jar from CF I
>>> got the same error.
>>>> I was using CFPDF up until now to do the conversion but find the resulting
>>> images not good enough in terms of quality. For example even after
>>> specifying scale="100" in cfpdf, the resulting images are smaller than the
>>> original PDF.
>>>>
>>>> Any tips on how I can use the .jar file successfully would be much
>>> appreciated.
>>>>
>>>> Regards,
>>>>
>>>> Stefan
>>>>
>>>>
>>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:341121
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm