当前位置: 首页>>代码示例>>Java>>正文


Java Chunk.setGenericTag方法代码示例

本文整理汇总了Java中com.lowagie.text.Chunk.setGenericTag方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.setGenericTag方法的具体用法?Java Chunk.setGenericTag怎么用?Java Chunk.setGenericTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.lowagie.text.Chunk的用法示例。


在下文中一共展示了Chunk.setGenericTag方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPhrase

import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
 * Creates a Phrase object based on a list of properties.
 * @param attributes
 * @return a Phrase
 */
public static Phrase getPhrase(Properties attributes) {
	Phrase phrase = new Phrase();
	phrase.setFont(FontFactory.getFont(attributes));
	String value;
	value = attributes.getProperty(ElementTags.LEADING);
	if (value != null) {
		phrase.setLeading(Float.parseFloat(value + "f"));
	}
	value = attributes.getProperty(Markup.CSS_KEY_LINEHEIGHT);
	if (value != null) {
		phrase.setLeading(Markup.parseLength(value,
				Markup.DEFAULT_FONT_SIZE));
	}
	value = attributes.getProperty(ElementTags.ITEXT);
	if (value != null) {
		Chunk chunk = new Chunk(value);
		if ((value = attributes.getProperty(ElementTags.GENERICTAG)) != null) {
			chunk.setGenericTag(value);
		}
		phrase.add(chunk);
	}
	return phrase;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:29,代码来源:ElementFactory.java

示例2: 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;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:21,代码来源:IndexEvents.java

示例3: 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;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:57,代码来源:ElementFactory.java

示例4: main

import com.lowagie.text.Chunk; //导入方法依赖的package包/类
/**
 * Generic page event.
 * 
 * @param args
 *            no arguments needed here
 */
public static void main(String[] args) {

	System.out.println("Generic");

	// step 1: creation of a document-object
	Document document = new Document();
	try {
		// step 2:
		// we create a writer that listens to the document
		PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "Generic.pdf"));
		writer.setPageEvent(new Generic());

		// step 3: we open the document
		document.open();
		// step 4:
		Paragraph p = new Paragraph("Generic page event");
		document.add(p);
		Chunk box = new Chunk("box");
		box.setGenericTag("box");
		Chunk ellipse = new Chunk("ellipse");
		ellipse.setGenericTag("ellipse");
		p = new Paragraph("In this example, we will add chunks that are tagged as an ");
		p.add(ellipse);
		p.add(" and chunks that are tagged as a ");
		p.add(box);
		p.add(". Can you see the difference between ");
		Chunk c1 = new Chunk("this");
		c1.setGenericTag("box");
		Chunk c2 = new Chunk("that");
		c2.setGenericTag("ellipse");
		p.add(c1);
		p.add(" and ");
		p.add(c2);
		p.add("? One is a ");
		p.add(box);
		p.add("; the other an ");
		p.add(ellipse);
		document.add(p);
	} catch (DocumentException de) {
		System.err.println(de.getMessage());
	} catch (IOException ioe) {
		System.err.println(ioe.getMessage());
	}

	// step 5: we close the document
	document.close();
}
 
开发者ID:fc-dream,项目名称:PDFTestForAndroid,代码行数:54,代码来源:Generic.java


注:本文中的com.lowagie.text.Chunk.setGenericTag方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。