This document describes two fully runnable Java applications for pdf renderer and InDesign® Server. The application just opens a document and creates a PDF beside the original document location.
We expect the following installation layout:
priint-renderer-core-4.3-R37133.jarpriint-renderer-pdf-4.3-R37133.jarlib/native/your-platform/native-librarieslib/java/required jarsconfig/color profiles, fontmapping, empty (null) project etc.Any Java Development environment can be used (Eclipse, IntelliJ), a test editor plus JDK >= 1.8 will also do.
com.priint.renderer.hellocom.priint.renderer.hello.HelloWorld"/path/to/w2ml/example.w2ml"):
                  package com.priint.renderer.hello;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.priint.comet.renderer.Constants;
import com.priint.comet.renderer.OpenedDocument;
import com.priint.comet.renderer.Renderer;
import com.priint.comet.renderer.exception.RendererException;
import com.priint.comet.renderer.io.providers.TmpCopyFromString;
import com.priint.comet.renderer.pdf.PdfRendererFactory;
import com.priint.comet.renderer.pdf.W2MLDocumentType;
public class HelloWorld {
  public static void main(String args[]) {
    String w2mlPath = "/path/to/w2ml/example.w2ml";
    try {
      String w2mlData = new String(Files.readAllBytes(Paths.get(w2mlPath)));
      
      Renderer renderer = new Renderer();
      renderer.registerFactory(PdfRendererFactory.class, W2MLDocumentType.class);
      
      // initialize using default parameters 
      renderer.initialize();
      
      // open document based on string read from file
      OpenedDocument document = renderer.openDocument(
          Constants.ZEROCONF, 
          new TmpCopyFromString(w2mlData));
      
      // create pdf 
      byte[] pdfBytes = document.getPdf();
      
      Files.write(Paths.get(w2mlPath + ".pdf"), pdfBytes);
      
      document.close();
    }
    catch (IOException e) {
      // exceptions during reading and writing files
      e.printStackTrace();
    } 
    catch (RendererException e) {
      // exceptions during rendering 
      e.printStackTrace();
    }
    catch (Exception e) {
      // exceptions during closing
      e.printStackTrace();
    }
  }
}
          
ZEROCONF XML Offline folder is available on that host under the same path.See the Installation section for details. You don't need to bother about licensing at this stage, though you must regard platform specific hints.
priint-renderer-core-4.3-R37133.jarpriint-renderer-ids-4.3-R37133.jarlib/java/required jarsconfig/color profiles, fontmapping, empty (null) project etc.Any Java Development environment can be used (Eclipse, IntelliJ), a test editor plus JDK >= 1.8 will also do.
-cometport 4711com.priint.renderer.hellocom.priint.renderer.hello.HelloInDesignServer"/path/to/indesign/document.indd"):
package com.priint.renderer.hello;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import com.priint.comet.renderer.Constants;
import com.priint.comet.renderer.OpenedDocument;
import com.priint.comet.renderer.Renderer;
import com.priint.comet.renderer.exception.RendererException;
import com.priint.comet.renderer.io.providers.TmpCopyFromPath;
public class HelloInDesignServer {
  public static void main(String args[]) {
    String inddPath = "/path/to/indesign/document.indd";
    try {
      Renderer renderer = new Renderer();
      renderer.registerFactory(InDesignServerFactory.class, InDesignDocumentType.class);
      
      // initialize using default parameters 
      renderer.initialize();
      
      // configure InDesignServer instance
      InDesignServerConfiguration config = new InDesignServerConfiguration();
      config.setEndpoint("http://localhost:4711");
      
      InDesignServerFactory.addInstance(config);
      
      
      // open document based on string read from file
      OpenedDocument document = renderer.openDocument(
          Constants.ZEROCONF,
          new TmpCopyFromPath(Paths.get(inddPath))
          );
      
      // create pdf 
      byte[] pdfBytes = document.getPdf();
      
      Files.write(Paths.get(inddPath + ".pdf"), pdfBytes);
      
      document.close();
    }
    catch (IOException e) {
      // exceptions during reading and writing files
      e.printStackTrace();
    } 
    catch (RendererException e) {
      // exceptions during rendering 
      e.printStackTrace();
    }
    catch (Exception e) {
      // exceptions during closing
      e.printStackTrace();
    }
  }
}
          
You may have noticed, that we use two different ways in the pdf renderer and InDesign® Server example to access the actual documents. TmpCopyFromString and TmpCopyFromPath are both DocumentAccessProvider implementations. Basically, this interface decouples from the "physical" document presentation - Stream, String, File or whatever. Any DocumentAccessProvider can be used for any rendering engine (except for the fact, that InDesign® documents hardly can be packed into a Java String object).
Using the DocumentAccessProvider abstraction, we can open any document from any source in any environment using the same rendering API. All required file system actions, path translations, network operations and similar are handled in the respective DocumentAccessProvider implementations. The core library contains some common implementations (e.g. open a temporary copy, open just in place etc.). If you have further requirements in your project or IT infrastructure, you can easily implement own DocumentAccessProvider, see the Document Access section for details.