You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Arjan Bokx <ar...@akb-ls.nl> on 2013/01/04 08:46:11 UTC

RE: FOP 1.1 embedded examples - step 3 (final step)

Now for step 3 of my 'calling Java from Delphi' project...
So far, everything seems to work.

Var
  Cls: JClass;
  Mid: JMethodID;
  ExampleFO2PDF: JObject;

//Construct ExampleFO2PDF object
  ExampleFO2PDF := CreateJavaObject(FJNIEnv, 'embedding/ExampleFO2PDF', Cls);
//Locate the 'convertFO2PDF' method
  Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/io/File;Ljava/io/File;)V');



After this, I wish to actually call the method from Delphi:
// Call the method
 FJNIEnv.CallObjectMethod(...);


In ExampleFO2PDF.java, it says
public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException {

What, now, is the type of the parameters that I should pass with FJNIEnv.CallObjectMethod()? I couldn't find any examples of this.
I tried some Delphi file types but they didn't work.



Regards,
Arjan Bokx



---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


RE: FOP 1.1 embedded examples - step 3 (final step)

Posted by Robert Meyer <rm...@hotmail.co.uk>.
Hi Arjan,

Its been about 10 years since I did any Delphi, so unfortunately I doubt i'll be much help. However, from looking around there does seem to be another method in the jni called FindClass.

This is a guess as I don't have Delphi to hand, but using jni.FindClass("java.io.File") should either directly or indirectly allow you to create an equivalent java file object [1]. I am guessing then you should be able to pass those objects along with the methodID (returned from GetMethodID) into the CallObjectMethod routine. 

If you are still having problems, I would suggest asking this same question on a Delphi forum as they would be best suited to help you.

[1] http://docs.unity3d.com/Documentation/Manual/PluginsForAndroid.html

Regards,

Robert Meyer

> From: arjan.bokx@akb-ls.nl
> To: fop-users@xmlgraphics.apache.org
> Subject: RE: FOP 1.1 embedded examples - step 3 (final step)
> Date: Fri, 4 Jan 2013 07:46:11 +0000
> 
> Now for step 3 of my 'calling Java from Delphi' project...
> So far, everything seems to work.
> 
> Var
>   Cls: JClass;
>   Mid: JMethodID;
>   ExampleFO2PDF: JObject;
> 
> //Construct ExampleFO2PDF object
>   ExampleFO2PDF := CreateJavaObject(FJNIEnv, 'embedding/ExampleFO2PDF', Cls);
> //Locate the 'convertFO2PDF' method
>   Mid := FJNIEnv.GetMethodID(Cls, 'convertFO2PDF', '(Ljava/io/File;Ljava/io/File;)V');
> 
> 
> 
> After this, I wish to actually call the method from Delphi:
> // Call the method
>  FJNIEnv.CallObjectMethod(...);
> 
> 
> In ExampleFO2PDF.java, it says
> public void convertFO2PDF(File fo, File pdf) throws IOException, FOPException {
> 
> What, now, is the type of the parameters that I should pass with FJNIEnv.CallObjectMethod()? I couldn't find any examples of this.
> I tried some Delphi file types but they didn't work.
> 
> 
> 
> Regards,
> Arjan Bokx
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
>