绝对位置碰撞的div

时间:2015-11-18 08:59:00

标签: javascript css pdf.js

我需要注释pdf文件。我使用了pdf.js并突出显示所选文本我使用了https://gist.github.com/yurydelendik/f2b846dae7cb29c86d23中给出的代码。  代码为每个选定的div创建div,背景颜色和左上角.div为绝对位置.pdf中突出显示的文本的快照如下: - highligted text in pdf

每行是div或单个div的组合,左上角和高度和宽度值

public void should_test_furture() throws Exception {
    ListeningExecutorService service = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(10));

    ListenableFuture future1 = service.submit(new Callable<Integer>() {
        public Integer call() throws InterruptedException {
            Thread.sleep(1000);
            System.out.println("call future 1.");
            return 1;
        }
    });

    ListenableFuture future2 = service.submit(new Callable<Integer>() {
        public Integer call() throws InterruptedException {
            Thread.sleep(1000);
            System.out.println("call future 2.");
  //       throw new RuntimeException("----call future 2.");
            return 2;
        }
    });

    final ListenableFuture allFutures = Futures.successfulAsList(future1, future2);

    final ListenableFuture transform = Futures.transform(allFutures, new AsyncFunction<List<Integer>, Boolean>() {
        @Override
        public ListenableFuture apply(List<Integer> results) throws Exception {
            return Futures.immediateFuture(String.format("success future:%d", results.size()));
        }
    });

    Futures.addCallback(transform, new FutureCallback<Object>() {

        public void onSuccess(Object result) {
            System.out.println(result.getClass());
            System.out.printf("success with: %s%n", result);
        }

        public void onFailure(Throwable thrown) {
            System.out.printf("onFailure%s%n", thrown.getMessage());
        }
    });

    System.out.println(transform.get());
}

你可以清楚地看到每个div都与另一个div相撞。有没有办法省略碰撞或任何方法去除由于div碰撞而产生的暗下划线.div必须定位为绝对值,因为左上角的值是保存在后端。碰撞因pdf.js中的pdf浏览器和缩放级别而异。

0 个答案:

没有答案
相关问题