當前位置: 首頁>>代碼示例>>Java>>正文


Java PDBorderStyleDictionary類代碼示例

本文整理匯總了Java中org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary的典型用法代碼示例。如果您正苦於以下問題:Java PDBorderStyleDictionary類的具體用法?Java PDBorderStyleDictionary怎麽用?Java PDBorderStyleDictionary使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


PDBorderStyleDictionary類屬於org.apache.pdfbox.pdmodel.interactive.annotation包,在下文中一共展示了PDBorderStyleDictionary類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: addHyperlink

import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; //導入依賴的package包/類
private void addHyperlink(
        final float x, final float y,
        final String hyperlink,
        final PDPage pdPage) throws IOException {

    PDAnnotationLink txtLink = new PDAnnotationLink();

    PDRectangle position = new PDRectangle();
    PDBorderStyleDictionary underline = new PDBorderStyleDictionary();
    underline.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
    txtLink.setBorderStyle(underline);

    position.setLowerLeftX(x);
    position.setLowerLeftY(y);
    position.setUpperRightX(X_MARGIN_LEFT + BOX_WIDTH);
    position.setUpperRightY(y + TEXT_LINE_HEIGHT);
    txtLink.setRectangle(position);

    PDActionURI action = new PDActionURI();
    action.setURI(hyperlink);
    txtLink.setAction(action);
    pdPage.getAnnotations().add(txtLink);
}
 
開發者ID:estatio,項目名稱:estatio,代碼行數:24,代碼來源:PdfManipulator.java

示例2: addLink

import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; //導入依賴的package包/類
private float addLink(PDDocument document, int pageNumber, float startX, float startY, PdfTextStyle textConfig) {
    PDAnnotationLink txtLink = new PDAnnotationLink();
    txtLink.setColor(textConfig.getColor());

    PDBorderStyleDictionary underline = getLinkUnderline();
    txtLink.setBorderStyle(underline);

    try {
        float textWidth = (textConfig.getFont().getStyle(textConfig.getStyle()).getStringWidth(text) / 1000) * textConfig.getFontSize();

        float startLinkY = startY + textConfig.getFontSize();
        float endLinkY = startY - underline.getWidth();

        PDRectangle position = new PDRectangle();
        position.setLowerLeftX(startX);
        position.setLowerLeftY(startLinkY);
        position.setUpperRightX(startX + textWidth);
        position.setUpperRightY(endLinkY);
        txtLink.setRectangle(position);

        PDActionURI action = new PDActionURI();
        action.setURI(link);
        txtLink.setAction(action);

        PDPage page = document.getDocumentCatalog().getPages().get(pageNumber);
        page.getAnnotations().add(txtLink);

        return endLinkY;
    } catch (IOException e) {
        LOG.warn("Could not add link: " + e.getClass() + " - " + e.getMessage());
        return startY;
    }
}
 
開發者ID:Catalysts,項目名稱:cat-boot,代碼行數:34,代碼來源:ReportLink.java

示例3: toBorderStyle

import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; //導入依賴的package包/類
private static PDBorderStyleDictionary toBorderStyle(
    final LinkStyle linkStyle) {
if (linkStyle == LinkStyle.none) {
    return getNoBorder();
}
PDBorderStyleDictionary borderStyle = new PDBorderStyleDictionary();
borderStyle.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
return borderStyle;
   }
 
開發者ID:ralfstuckert,項目名稱:pdfbox-layout,代碼行數:10,代碼來源:CompatibilityHelper.java

示例4: getLinkUnderline

import org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary; //導入依賴的package包/類
private PDBorderStyleDictionary getLinkUnderline() {
    PDBorderStyleDictionary underline = new PDBorderStyleDictionary();
    underline.setStyle(PDBorderStyleDictionary.STYLE_UNDERLINE);
    return underline;
}
 
開發者ID:Catalysts,項目名稱:cat-boot,代碼行數:6,代碼來源:ReportLink.java


注:本文中的org.apache.pdfbox.pdmodel.interactive.annotation.PDBorderStyleDictionary類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。