本文整理匯總了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);
}
示例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;
}
}
示例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;
}
示例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;
}