On Dec 17, 2007 6:15 PM, Xavier Le Vourch <[EMAIL PROTECTED]>
wrote:

> >
> > so basicly my questions are whether this is a windows only solution and
> > if not, how do i add the libraries to the classpath?
>
> The gsdll32 dll is only needed for Windows. For Linux, the javastub
> shared library uses the GS library from /usr/lib directly.
>
> So in order for it to work on Windows, you need to have the gsdll32.dll
> and javastub.dll libraries in your path and on Linux, only
> libjavastub.so is needed. The dll/src directory contains everything to
> build the library on Linux.


if i understand correctly those two dll files are precompiled for windows
and they contain the
Java_com_lowagie_tools_plugins_IdentifyColorPages_colordetectnative method
signature.

I have put them in a jar and made them available in my WEB-INF/lib

But i still get an error:
java.lang.UnsatisfiedLinkError: no gsdll32 in java.library.path

i would have expected an error that the method can not be found or so,
because i created my own class.

public class PdfColorInfo {

    private ArrayList<Boolean> colortable = new ArrayList<Boolean>();
    protected final Log logger = LogFactory.getLog(getClass());

    public PdfColorInfo(){
    LibLoader.loadlib();
    }

    public native void colordetectnative(String infile);

    private void colorcallback() {
      colortable.add(new Boolean(true));
    }


    private void greycallback() {
      colortable.add(new Boolean(false));
    }

    public void identifyColor(Document document){
    try{
        colortable = new ArrayList<Boolean>();
        colordetectnative(document.getFile().getAbsolutePath());
        Iterator<Boolean> iter = colortable.iterator();
        int i = 0;
        while(iter.hasNext()){
        Boolean bool = iter.next();
        logger.debug("page " + (++i) + (bool.booleanValue()?" color":"
mono"));
        }

    } catch (Exception e){
        logger.error(e);
    }

    }

}

that i would call in a controller with

PdfColorInfo colorInfo = new PdfColorInfo();
colorInfo.identifyColor(document);

(i have copied the Libloaded

FYI: Document is not the iText Document class, but BO from my project.

I d like to get the JNI link working on both windows and linux in a separate
project. i like the toolbox but the plugins are really tied to the swing
interface and std.out.

Can you give me some feedback on how i should try to get this working ?

I also tried to compile the linux part of the code. but i am getting some
weird errors:
debian-etch:~/thingy# make
gcc -c -Wall -I/root/thingy/gs-gpl-8.54.dfsg.1/src
-I/opt/java/jdk1.6.0/include -I/opt/java/jdk1.6.0/include/linux javastub.c-o
javastub.o
javastub.c: In function âgsdll_stdinâ:
javastub.c:72: warning: unused variable âinitâ
javastub.c: In function
âJava_com_lowagie_tools_plugins_IdentifyColorPages_colordetectnativeâ:
javastub.c:262: error: âgs_main_instanceâ undeclared (first use in this
function)
javastub.c:262: error: (Each undeclared identifier is reported only once
javastub.c:262: error: for each function it appears in.)
javastub.c:262: error: âminstâ undeclared (first use in this function)
javastub.c:268: warning: initialization discards qualifiers from pointer
target type
javastub.c:306: warning: passing argument 3 of âgsapi_init_with_argsâ from
incompatible pointer type
make: *** [javastub.o] Error 1



i hope i don't get too much off-topic on this mailinglist, but i have found
really little info on how to make your own JNI-ghostscript links.

thanks in advance ,
bruno
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to