Class Reader

  • public class Reader
    extends Object
    Client-side Reader to load a document from the server.
    • Constructor Detail

      • Reader

        public Reader()
    • Method Detail

      • complete

        public void complete​(<Document> callback)
        Initiates server side document loading. Please note that prior to calling complete() all Sources must have been added or appended to the Reader. The client is notified via AsyncCallback about the read status. The AsyncCallbacks onSuccess() method will be called after the first DocumentReadResult has successfully been processed. Then a document will be available on the client side and the client can start to load the document into the viewer. Usually this will be done by calling viewer.getPageView().setDocument(result) (where "result" is the callback's result object, a Document instance). Subsequent pages will be loaded asynchronously - processing these will be handled by appropriate listeners.
        callback - Called when the Document is available for the client.
      • append

        public SourceConfiguration append​(Source source)
        Appends a Source to a Document at the current position. The Source can also be a CompositeSource. The CompositeSource can consist of several Sources. Thus the feature can be used to create composite documents created from several document parts which are simply appended one to another in the CompositeSource.

        Important: This append(Source) method can only be called once before calling complete(AsyncCallback). For a code example, please see Server side document composition

        source - The source to append
        Configuration of the Source that was appended, like its target DocumentLayer
      • add

        public SourceConfiguration add​(Source source)
        Add a Source to the Document at the position of the last appended document, on top of the last document.

        This feature can be used to add additional layers to a Document, like an Annotation DocumentLayer as an overlay to the document's default layer.

        Deprecation: To append a document on top of the last document, you can use server side adding of a layer instead. See demo implementations of DocumentDataProvider and documentation about Reader API read method. It is important to reset the targetIndex after reading of the document and before reading the annotations. Reset the value to the one prior to the reading of the document.
        source - The source to read.
        Configuration of the source to add, especially its DocumentLayer .