【问题标题】:How to get the rectangular coordinates of the annotation using ice pdf viewer如何使用ice pdf查看器获取注释的直角坐标
【发布时间】:2015-04-20 10:00:14
【问题描述】:

我需要使用ice pdf 查看器获取注释的直角坐标。有没有办法做到这一点?

【问题讨论】:

    标签: java pdf icepdf


    【解决方案1】:

    您需要进入 Viewer RI 源代码进行一些更改,然后重建 icepdf-viewer.jar。

    org.icepdf.ri.common.tools.SquareAnnotationHandler 类处理所有鼠标事件和绘图以创建方形注释。这是开始扩展或将其用作参考的好地方。

    在 mouseReleased 下添加消息对话框

    JOptionPane.showMessageDialog(null, "Rectangle coordinates x ---> "+rectToDraw.x+" y --> "+ rectToDraw.y+" Width --> "+ rectToDraw.width+" height --> "+ rectToDraw.height);
    

    【讨论】:

      【解决方案2】:

      如果有人还在寻找答案。

      Icepdf 的 Annotation 类保存这些坐标。可以像这样检索它们:

           Rectangle2D.Float box = annotation.getUserSpaceRectangle();
           Map<String, Double> bounds = new HashMap<String, Double>();
              bounds.put("height", box.getHeight());
              bounds.put("width", box.getWidth());
              bounds.put("x", box.getX());
              bounds.put("y", box.getY());
      

      【讨论】:

        猜你喜欢
        • 2019-12-03
        • 2018-04-25
        • 1970-01-01
        • 2021-03-08
        • 2011-01-10
        • 1970-01-01
        • 1970-01-01
        • 2013-01-22
        • 2020-04-25
        相关资源
        最近更新 更多