fgiova/jodconverter

Using JODConverter to connect to launch OOo process for printing

Closed this issue · 1 comments

Hello
I'm asking how can I use JODConverter to launch OOo instance not for converting 
files but to print documents?

I used 
OfficeManager officeManager = config.buildOfficeManager();
officeManager.start();

But it doesn't work for printing service
My print service connect to open office API using this code

    private void doInitUnoByServlet() throws Exception {


        /*
        * Bootstraps a component context with the jurt base components registered. Component context to be granted to a component for running. Arbitrary values can be retrieved
        * from the context.
        */
        XComponentContext xcomponentcontext = com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);

        /*
        * Gets the service manager instance to be used (or null). This method has been added for convenience, because the service manager is a often used object.
        */
        XMultiComponentFactory xmulticomponentfactory = xcomponentcontext.getServiceManager();

        /*
        * Creates an instance of the component UnoUrlResolver which supports the services specified by the factory.
        */
        Object objectUrlResolver = xmulticomponentfactory.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", xcomponentcontext);

        // Create a new url resolver
        XUnoUrlResolver xurlresolver = (XUnoUrlResolver) UnoRuntime.queryInterface(XUnoUrlResolver.class, objectUrlResolver);

        // Resolves an object that is specified as follow:
        // uno:<connection description>;<protocol description>;<initial object name>
        Object objectInitial = xurlresolver.resolve("uno:socket,host=localhost,port=8100;urp;StarOffice.ServiceManager");

        // Create a service manager from the initial object
        xmulticomponentfactory = (XMultiComponentFactory) UnoRuntime.queryInterface(XMultiComponentFactory.class, objectInitial);

        // Query for the XPropertySet interface.
        XPropertySet xpropertysetMultiComponentFactory = (XPropertySet) UnoRuntime.queryInterface(XPropertySet.class, xmulticomponentfactory);

        // Get the default context from the office server.
        Object objectDefaultContext = xpropertysetMultiComponentFactory.getPropertyValue("DefaultContext");

        // Query for the interface XComponentContext.
        xcomponentcontext = (XComponentContext) UnoRuntime.queryInterface(XComponentContext.class, objectDefaultContext);

        /*
        * A desktop environment contains tasks with one or more frames in which components can be loaded. Desktop is the environment for components which can instanciate within
        * frames.
        */
        xCompLoader = (XComponentLoader) UnoRuntime.queryInterface(XComponentLoader.class, xmulticomponentfactory.createInstanceWithContext("com.sun.star.frame.Desktop",
        xcomponentcontext));



        }

I appreciate your help

Original issue reported on code.google.com by bilou1...@gmail.com on 19 Oct 2010 at 8:59

The issue tracker is not for asking questions.

Original comment by mirko.na...@gmail.com on 12 Mar 2011 at 5:12

  • Changed state: Invalid