• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Anchor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.lowagie.text.Anchor的典型用法代码示例。如果您正苦于以下问题:Java Anchor类的具体用法?Java Anchor怎么用?Java Anchor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Anchor类属于com.lowagie.text包,在下文中一共展示了Anchor类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: writeDatabaseVersionAndDataSourceDetails

import com.lowagie.text.Anchor; //导入依赖的package包/类
private void writeDatabaseVersionAndDataSourceDetails(JavaInformations javaInformations) {
	if (!noDatabase && javaInformations.getDataBaseVersion() != null) {
		addCell(getString("Base_de_donnees") + ':');
		addCell(javaInformations.getDataBaseVersion());
	}
	if (javaInformations.getDataSourceDetails() != null) {
		addCell(getString("DataSource_jdbc") + ':');
		addCell(javaInformations.getDataSourceDetails());
		addCell("");
		final Anchor anchor = new Anchor("DataSource reference", PdfFonts.BLUE.getFont());
		anchor.setName("DataSource reference");
		anchor.setReference(
				"http://commons.apache.org/dbcp/apidocs/org/apache/commons/dbcp/BasicDataSource.html");
		currentTable.addCell(anchor);
	}
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:17,代码来源:PdfJavaInformationsReport.java


示例2: addImage

import com.lowagie.text.Anchor; //导入依赖的package包/类
protected void addImage(Image img) throws EmptyStackException {
    // if there is an element on the stack...
    Object current = stack.pop();
    // ...and it's a Chapter or a Section, the Image can be
    // added directly
    if (current instanceof Chapter
            || current instanceof Section
            || current instanceof Cell) {
        ((TextElementArray) current).add(img);
        stack.push(current);
        return;
    }
    // ...if not, we need to to a lot of stuff
    else {
        Stack newStack = new Stack();
        while (!(current instanceof Chapter
                || current instanceof Section || current instanceof Cell)) {
            newStack.push(current);
            if (current instanceof Anchor) {
                img.setAnnotation(new Annotation(0, 0, 0,
                        0, ((Anchor) current).getReference()));
            }
            current = stack.pop();
        }
        ((TextElementArray) current).add(img);
        stack.push(current);
        while (!newStack.empty()) {
            stack.push(newStack.pop());
        }
        return;
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:33,代码来源:SAXiTextHandler.java


示例3: processActions

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Processes all actions contained in the cell.
 * @param element	an element in the cell
 * @param action	an action that should be coupled to the cell
 * @param allActions
 */

protected void processActions(Element element, PdfAction action, ArrayList allActions) {
    if (element.type() == Element.ANCHOR) {
        String url = ((Anchor) element).getReference();
        if (url != null) {
            action = new PdfAction(url);
        }
    }
    Iterator i;
    switch (element.type()) {
        case Element.PHRASE:
        case Element.SECTION:
        case Element.ANCHOR:
        case Element.CHAPTER:
        case Element.LISTITEM:
        case Element.PARAGRAPH:
            for (i = ((ArrayList) element).iterator(); i.hasNext();) {
                processActions((Element) i.next(), action, allActions);
            }
            break;
        case Element.CHUNK:
            allActions.add(action);
            break;
        case Element.LIST:
            for (i = ((List) element).getItems().iterator(); i.hasNext();) {
                processActions((Element) i.next(), action, allActions);
            }
            break;
        default:
            int n = element.getChunks().size();
            while (n-- > 0)
                allActions.add(action);
            break;
    }
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:42,代码来源:PdfCell.java


示例4: getAnchor

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Creates an Anchor object based on a list of properties.
 * @param attributes
 * @return an Anchor
 */
public static Anchor getAnchor(Properties attributes) {
	Anchor anchor = new Anchor(getPhrase(attributes));
	String value;
	value = attributes.getProperty(ElementTags.NAME);
	if (value != null) {
		anchor.setName(value);
	}
	value = (String) attributes.remove(ElementTags.REFERENCE);
	if (value != null) {
		anchor.setReference(value);
	}
	return anchor;
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:19,代码来源:ElementFactory.java


示例5: addPsCommandReference

import com.lowagie.text.Anchor; //导入依赖的package包/类
private void addPsCommandReference() throws DocumentException {
	final Anchor psAnchor = new Anchor("ps command reference", PdfFonts.BLUE.getFont());
	psAnchor.setName("ps command reference");
	psAnchor.setReference("http://en.wikipedia.org/wiki/Ps_(Unix)");
	psAnchor.setFont(PdfFonts.BLUE.getFont());
	final Paragraph psParagraph = new Paragraph();
	psParagraph.add(psAnchor);
	psParagraph.setAlignment(Element.ALIGN_RIGHT);
	addToDocument(psParagraph);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:11,代码来源:PdfProcessInformationsReport.java


示例6: addConfigurationReference

import com.lowagie.text.Anchor; //导入依赖的package包/类
private void addConfigurationReference() throws DocumentException {
	final Anchor ehcacheAnchor = new Anchor("Configuration reference", PdfFonts.BLUE.getFont());
	ehcacheAnchor.setName("Ehcache configuration reference");
	ehcacheAnchor.setReference(
			"http://ehcache.sourceforge.net/apidocs/net/sf/ehcache/config/CacheConfiguration.html#field_summary");
	ehcacheAnchor.setFont(PdfFonts.BLUE.getFont());
	final Paragraph ehcacheParagraph = new Paragraph();
	ehcacheParagraph.add(ehcacheAnchor);
	ehcacheParagraph.setAlignment(Element.ALIGN_RIGHT);
	addToDocument(ehcacheParagraph);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:12,代码来源:PdfCacheInformationsReport.java


示例7: addConfigurationReference

import com.lowagie.text.Anchor; //导入依赖的package包/类
private void addConfigurationReference() throws DocumentException {
	final Anchor quartzAnchor = new Anchor("Configuration reference", PdfFonts.BLUE.getFont());
	quartzAnchor.setName("Quartz configuration reference");
	quartzAnchor.setReference("http://www.quartz-scheduler.org/docs/index.html");
	quartzAnchor.setFont(PdfFonts.BLUE.getFont());
	final Paragraph quartzParagraph = new Paragraph();
	quartzParagraph.add(quartzAnchor);
	quartzParagraph.setAlignment(Element.ALIGN_RIGHT);
	addToDocument(quartzParagraph);
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:11,代码来源:PdfJobInformationsReport.java


示例8: main

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Generates simple PDF, RTF and HTML files using only one Document object.
 * 
 * @param args
 *            no arguments needed here
 */
public static void main(String[] args) {

	System.out.println("Hello World in PDF, RTF and HTML");

	// step 1: creation of a document-object
	Document document = new Document();
	try {
		// step 2:
		// we create 3 different writers that listen to the document
		PdfWriter pdf = PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "HelloWorldPdf.pdf"));
		HtmlWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "HelloWorldHtml.html"));

		// step 3: we open the document
		document.open();
		// step 4: we add a paragraph to the document
		document.add(new Paragraph("Hello World"));
		// we make references
		Anchor pdfRef = new Anchor("see Hello World in PDF.");
		pdfRef.setReference("./HelloWorldPdf.pdf");
		Anchor rtfRef = new Anchor("see Hello World in RTF.");
		rtfRef.setReference("./HelloWorldRtf.rtf");

		// we add the references, but only to the HTML page:

		pdf.pause();
		document.add(pdfRef);
		document.add(Chunk.NEWLINE);
		document.add(rtfRef);
		pdf.resume();

	} 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,代码行数:46,代码来源:HelloWorldMultiple.java


示例9: main

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Demonstrates some Anchor functionality.
 * 
 * @param args
 *            no arguments needed here
 */
public static void main(String[] args) {

	System.out.println("the Anchor object");

	// step 1: creation of a document-object
	Document document = new Document();
	try {
		// step 2:
		PdfWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "AHref.pdf"));
		HtmlWriter.getInstance(document, new FileOutputStream(android.os.Environment.getExternalStorageDirectory() + java.io.File.separator + "droidtext" + java.io.File.separator + "AHref.html"));

		// step 3: we open the document
		document.open();

		// step 4:
		Paragraph paragraph = new Paragraph("Please visit my ");
		Anchor anchor1 = new Anchor("website (external reference)", FontFactory.getFont(FontFactory.HELVETICA, 12,
				Font.UNDERLINE, new Color(0, 0, 255)));
		anchor1.setReference("http://www.lowagie.com/iText/");
		anchor1.setName("top");
		paragraph.add(anchor1);
		paragraph.add(new Chunk(".\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"));
		document.add(paragraph);
		Anchor anchor2 = new Anchor("please jump to a local destination", FontFactory.getFont(
				FontFactory.HELVETICA, 12, Font.NORMAL, new Color(0, 0, 255)));
		anchor2.setReference("#top");
		document.add(anchor2);
	} 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,代码行数:43,代码来源:AHref.java


示例10: main

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Generates simple PDF, RTF and HTML files using only one Document object.
 */
@Test
public void main() throws Exception {

	// step 1: creation of a document-object
	Document document = new Document();
	// step 2:
	// we create 3 different writers that listen to the document
	PdfWriter pdf = PdfWriter.getInstance(document,PdfTestBase.getOutputStream("HelloWorldPdf.pdf"));
	RtfWriter2 rtf = RtfWriter2.getInstance(document, PdfTestBase.getOutputStream("HelloWorldRtf.rtf"));
	HtmlWriter.getInstance(document, PdfTestBase.getOutputStream("HelloWorldHtml.html"));

	// step 3: we open the document
	document.open();
	// step 4: we add a paragraph to the document
	document.add(new Paragraph("Hello World"));
	// we make references
	Anchor pdfRef = new Anchor("see Hello World in PDF.");
	pdfRef.setReference("./HelloWorldPdf.pdf");
	Anchor rtfRef = new Anchor("see Hello World in RTF.");
	rtfRef.setReference("./HelloWorldRtf.rtf");

	// we add the references, but only to the HTML page:

	pdf.pause();
	rtf.pause();
	document.add(pdfRef);
	document.add(Chunk.NEWLINE);
	document.add(rtfRef);
	pdf.resume();
	rtf.resume();

	// step 5: we close the document
	document.close();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:38,代码来源:HelloWorldMultipleTest.java


示例11: main

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Demonstrates some Anchor functionality.
 * 
 */
@Test
public void main() throws Exception {

	// step 1: creation of a document-object
	Document document = new Document();
	// step 2:
	PdfWriter.getInstance(document, PdfTestBase.getOutputStream("AHref.pdf"));
	HtmlWriter.getInstance(document, PdfTestBase.getOutputStream("AHref.html"));

	// step 3: we open the document
	document.open();

	// step 4:
	Paragraph paragraph = new Paragraph("Please visit my ");
	Anchor anchor1 = new Anchor("website (external reference)", FontFactory.getFont(FontFactory.HELVETICA, 12,
			Font.UNDERLINE, new Color(0, 0, 255)));
	anchor1.setReference("http://www.lowagie.com/iText/");
	anchor1.setName("top");
	paragraph.add(anchor1);
	paragraph.add(new Chunk(".\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"));
	document.add(paragraph);
	Anchor anchor2 = new Anchor("please jump to a local destination", FontFactory.getFont(FontFactory.HELVETICA,
			12, Font.NORMAL, new Color(0, 0, 255)));
	anchor2.setReference("#top");
	document.add(anchor2);

	// step 5: we close the document
	document.close();
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:34,代码来源:AHrefTest.java


示例12: main

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Creates a document with Named Actions.
 * 
 */
@Test
public void main() throws Exception {

	// step 1: creation of a document-object
	Document document = new Document();

	// step 2:
	HtmlWriter.getInstance(document, PdfTestBase.getOutputStream("JavaScriptAction.html"));
	// step 3: we add Javascript as Metadata and we open the document

	StringBuffer javaScriptSection = new StringBuffer();
	javaScriptSection.append("\t\tfunction load() {\n");
	javaScriptSection.append("\t\t  alert('Page has been loaded.');\n");
	javaScriptSection.append("\t\t}\n");

	javaScriptSection.append("\t\tfunction unload(){\n");
	javaScriptSection.append("\t\t  alert('Page has been unloaded.');\n");
	javaScriptSection.append("\t\t}\n");

	javaScriptSection.append("\t\tfunction sayHi(){\n");
	javaScriptSection.append("\t\t  alert('Hi !!!');\n");
	javaScriptSection.append("\t\t}");

	document.add(new Header(HtmlTags.JAVASCRIPT, javaScriptSection.toString()));
	document.setJavaScript_onLoad("load()");
	document.setJavaScript_onUnLoad("unload()");

	document.open();
	// step 4: we add some content
	Phrase phrase1 = new Phrase(
			"There are 3 JavaScript functions in the HTML page, load(), unload() and sayHi().\n\n"
					+ "The first one will be called when the HTML page has been loaded by your browser.\n"
					+ "The second one will be called when the HTML page is being unloaded,\n"
					+ "for example when you go to another page.\n");
	document.add(phrase1);

	// add a HTML link <A HREF="...">
	Anchor anchor = new Anchor("Click here to execute the third JavaScript function.");
	anchor.setReference("JavaScript:sayHi()");
	document.add(anchor);

	// step 5: we close the document
	document.close();

}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:50,代码来源:JavaScriptActionTest.java


示例13: addRegisteredPlayers

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Add all registered players to the document
 * 
 * @throws DocumentException
 *             When the data can not be added to the document
 */
public void addRegisteredPlayers() throws DocumentException {
    /* Add a section for the players */
    Anchor playerAnchor = new Anchor(PreferencesManager.getInstance()
            .localizeString("pdfoutput.players.title"),
            PDFExporter.BIG_HEADER_FONT);
    playerAnchor.setName(PreferencesManager.getInstance().localizeString(
            "pdfoutput.players.title"));
    Chapter playerChapter = new Chapter(new Paragraph(playerAnchor),
            this.chapterNumber);
    playerChapter.add(Chunk.NEWLINE);

    for (Player player : this.event.getRegisteredPlayers()) {
        String[][] playerAttributes = {
                { "Name",
                        player.getFirstName() + " " + player.getLastName() },
                { "Nickname", player.getNickName() },
                { "Mail", player.getMailAddress() },
                { "Starting number", player.getStartingNumber() } };

        for (String[] attribute : playerAttributes) {
            if (attribute[1].equals("")) {
                if (attribute[0].equals("Starting number")) {
                    playerChapter.add(new Paragraph(PreferencesManager
                            .getInstance().localizeString(
                                    "pdfoutput.players.nostartingnumber"),
                            PDFExporter.TEXT_FONT));
                } else if (attribute[0].equals("Name")) {
                    playerChapter.add(new Paragraph(PreferencesManager
                            .getInstance().localizeString(
                                    "pdfoutput.players.noname"),
                            PDFExporter.SMALL_BOLD));
                }
            } else {
                if (attribute[0].equals("Name")) {
                    playerChapter.add(new Paragraph(attribute[1],
                            PDFExporter.SMALL_BOLD));
                } else if (attribute[0].equals("Starting number")) {
                    playerChapter.add(new Paragraph(PreferencesManager
                            .getInstance().localizeString(
                                    "pdfoutput.players.startingnumber")
                            + " " + attribute[1], PDFExporter.TEXT_FONT));
                } else {
                    playerChapter.add(new Paragraph(attribute[1],
                            PDFExporter.TEXT_FONT));
                }
            }
        }

        if (player.hasPayed()) {
            playerChapter.add(new Paragraph(PreferencesManager
                    .getInstance().localizeString(
                            "pdfoutput.players.payed.true"),
                    PDFExporter.TEXT_FONT));
        } else {
            playerChapter.add(new Paragraph(PreferencesManager
                    .getInstance().localizeString(
                            "pdfoutput.players.payed.false"),
                    PDFExporter.TEXT_FONT));
        }

        if (player.isDisqualified()) {
            playerChapter.add(new Paragraph(PreferencesManager
                    .getInstance().localizeString(
                            "pdfoutput.players.disqualified.true"),
                    PDFExporter.TEXT_FONT));
        }

        playerChapter.add(Chunk.NEWLINE);
    }

    this.chapterNumber++;
    this.document.add(playerChapter);
}
 
开发者ID:Novanoid,项目名称:Tourney,代码行数:80,代码来源:PDFDocument.java


示例14: RtfAnchor

import com.lowagie.text.Anchor; //导入依赖的package包/类
/**
 * Constructs a RtfAnchor based on a RtfField
 * 
 * @param doc The RtfDocument this RtfAnchor belongs to
 * @param anchor The Anchor this RtfAnchor is based on
 */
public RtfAnchor(RtfDocument doc, Anchor anchor) {
    super(doc);
    this.url = anchor.getReference();
    this.content = new RtfPhrase(doc, anchor);
}
 
开发者ID:albfernandez,项目名称:itext2,代码行数:12,代码来源:RtfAnchor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CSVWriter类代码示例发布时间:2022-05-23
下一篇:
Java RestorableMeter类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap