Skip to content

Does not display annotations in a pdf document. #712

Open
@Kyython

Description

@Kyython

I use a pdf.js for displaying a pdf document. I needed to create annotations in this document, so I used your library of the latest version to implement my task.

I came across a problem that when there is a request to get annotations, they are not shown in the document. There are no errors or warnings. The incoming Json matches the one specified in the documentation. I do everything as specified in your documentation, but I can't understand what the problem is.

This is my connection script

<script>
    var pageUri = function () {
      return {
        beforeAnnotationCreated: function (ann) {
          ann.uri = window.location.href;
        }
      };
    };

    var app = new annotator.App()
      .include(annotator.ui.main, {
        viewerExtensions: [
          annotatormeltdown.viewerExtension
        ],
        editorExtensions: [
          annotatormeltdown.getEditorExtension({ min_width: '200px' })
        ]
      })
      .include(annotator.storage.http, {
        prefix: 'http://localhost/api/annotator'
      })
      .include(pageUri);

    app.start()
      .then(function () {
        app.annotations.load({ uri: window.location.href });
      });

  </script>

This is my json that comes with a get query search

{
  "id": "ad8415fd-b40b-48c9-a2a9-6ad1a2728b59",
  "text": "text",                  
  "quote": "someone text",   
  "uri": "http://localhost...",        
  "ranges": [                               
    {
      "start":"/div[4]/div[2]/div[4]/div[1]/div[1]/div[2]/div[1]",
      "end":"/div[4]/div[2]/div[4]/div[1]/div[1]/div[2]/div[1]",   
      "startOffset": 0,                
      "endOffset": 120
    }
  ]
}

Any help would be welcome, thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions