如何使用itext添加pdf链接以在新选项卡上打开远程链接?

时间:2017-02-17 08:46:30

标签: java pdf itext

我添加了一个pdf链接,带有lowagie itext 2.0.8。当我点击链接时,它正在工作,但它会在同一页面中打开它。我想在新页面中打开它,但我无法找到该怎么做。有没有办法用itext做?

    PdfAction action = new PdfAction(uri);
    //uri like http://stackoverflow.com/questions/ask
    com.lowagie.text.Rectangle targetArea = checkLinkArea(c, box);
    if (targetArea == null) {
        return;
    }
    PdfAnnotation annot = PdfAnnotation.createLink(
            _writer, targetArea, PdfAnnotation.HIGHLIGHT_INVERT, action);

    annot.setBorderStyle(new PdfBorderDictionary(0.0f, 0));

    _writer.addAnnotation(annot);

0 个答案:

没有答案