Document Structure (DocumentMetadata II)

Beside previews, meta data contains a set of structrued information regarding the document spreads, comet groups, placeholders, general elements and products / items... referred in this document.

All this information can be requested from the DocumentMetadata object connected to a OpenedDocument. As for previews, data is invalidated automatically, if the document structure changes and is generated on demand.

The original format of the data is XML, the Java Rendering Library provides classes to unmarshall all entity types provided by DocumentMetadata.

Please examine the API documentation, particularly classes in the com.priint.comet.metadata package and sub-packages

String w2mlString = "";
try (OpenedDocument document = renderer.openDocument(
                                      "DSN", 
                                      new TmpCopyFromString(w2mlString, W2MLDocumentType.class))) {
  DocumentMetadata metadata    = document.getMetadata();
  // spread document contains a list of spreads, masterspreads and general document 
  // information, such as path, name, version of the renderer used to build this
  // document, grids, guides etc.
  SpreadDocument     spreadDoc = metadata.getSpreadDocument();
  // shortcut for metadata.getSpreadDocument().getSpreads()
  List     spreads     = metadata.getSpreads();
}
catch (RendererException e) {
} 
catch (Exception e) {
}