本文整理汇总了Java中com.lowagie.text.Chunk.setLocalDestination方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setLocalDestination方法的具体用法?Java Chunk.setLocalDestination怎么用?Java Chunk.setLocalDestination使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.lowagie.text.Chunk
的用法示例。
在下文中一共展示了Chunk.setLocalDestination方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writePageAnchor
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
protected void writePageAnchor(int pageIndex) throws DocumentException
{
Map<Attribute,Object> attributes = new HashMap<Attribute,Object>();
fontUtil.getAttributesWithoutAwtFont(attributes, new JRBasePrintText(jasperPrint.getDefaultStyleProvider()));
Font pdfFont = getFont(attributes, getLocale(), false);
Chunk chunk = new Chunk(" ", pdfFont);
chunk.setLocalDestination(JR_PAGE_ANCHOR_PREFIX + reportIndex + "_" + (pageIndex + 1));
tagHelper.startPageAnchor();
ColumnText colText = new ColumnText(pdfContentByte);
colText.setSimpleColumn(
new Phrase(chunk),
0,
pageFormat.getPageHeight(),
1,
1,
0,
Element.ALIGN_LEFT
);
colText.go();
tagHelper.endPageAnchor();
}
示例2: setAnchor
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
protected void setAnchor(Chunk chunk, JRPrintAnchor anchor, JRPrintElement element)
{
String anchorName = anchor.getAnchorName();
if (anchorName != null)
{
chunk.setLocalDestination(anchorName);
if (anchor.getBookmarkLevel() != JRAnchor.NO_BOOKMARK)
{
int x = OrientationEnum.PORTRAIT.equals(pageFormat.getOrientation())
? getOffsetX() + element.getX()
: getOffsetY() + element.getY();
int y = OrientationEnum.PORTRAIT.equals(pageFormat.getOrientation())
? getOffsetY() + element.getY()
: getOffsetX() + element.getX();
addBookmark(anchor.getBookmarkLevel(), anchor.getAnchorName(), x, y);
}
}
}
示例3: create
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Create an index entry.
*
* @param text The text for the Chunk.
* @param in1 The first level.
* @param in2 The second level.
* @param in3 The third level.
* @return Returns the Chunk.
*/
public Chunk create(final String text, final String in1, final String in2,
final String in3) {
Chunk chunk = new Chunk(text);
String tag = "idx_" + (indexcounter++);
chunk.setGenericTag(tag);
chunk.setLocalDestination(tag);
Entry entry = new Entry(in1, in2, in3, tag);
indexentry.add(entry);
return chunk;
}
示例4: getChunk
import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
* Creates a Chunk object based on a list of properties.
* @param attributes
* @return a Chunk
*/
public static Chunk getChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.setFont(FontFactory.getFont(attributes));
String value;
value = attributes.getProperty(ElementTags.ITEXT);
if (value != null) {
chunk.append(value);
}
value = attributes.getProperty(ElementTags.LOCALGOTO);
if (value != null) {
chunk.setLocalGoto(value);
}
value = attributes.getProperty(ElementTags.REMOTEGOTO);
if (value != null) {
String page = attributes.getProperty(ElementTags.PAGE);
if (page != null) {
chunk.setRemoteGoto(value, Integer.parseInt(page));
} else {
String destination = attributes
.getProperty(ElementTags.DESTINATION);
if (destination != null) {
chunk.setRemoteGoto(value, destination);
}
}
}
value = attributes.getProperty(ElementTags.LOCALDESTINATION);
if (value != null) {
chunk.setLocalDestination(value);
}
value = attributes.getProperty(ElementTags.SUBSUPSCRIPT);
if (value != null) {
chunk.setTextRise(Float.parseFloat(value + "f"));
}
value = attributes.getProperty(Markup.CSS_KEY_VERTICALALIGN);
if (value != null && value.endsWith("%")) {
float p = Float.parseFloat(value.substring(0, value.length() - 1)
+ "f") / 100f;
chunk.setTextRise(p * chunk.getFont().getSize());
}
value = attributes.getProperty(ElementTags.GENERICTAG);
if (value != null) {
chunk.setGenericTag(value);
}
value = attributes.getProperty(ElementTags.BACKGROUNDCOLOR);
if (value != null) {
chunk.setBackground(Markup.decodeColor(value));
}
return chunk;
}