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


Java Anchor类代码示例

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


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

示例1: addContent

import com.itextpdf.text.Anchor; //导入依赖的package包/类
private void addContent(PdfWriter writer) throws DocumentException, PdfFormatierungsException {		
	Anchor anchor = new Anchor("Lernentwicklungsbericht", lernentwicklungsberichtUeberschriftFont);
	Chapter chapterLEB = new Chapter(new Paragraph(anchor), 1);
	chapterLEB.setNumberDepth(0);
	Paragraph paragraphHeader = new Paragraph();
	paragraphHeader.setLeading(FIXED_LEADING_TEXT, 1);
	sectionCount += 1;
	Section headerSection = chapterLEB.addSection(paragraphHeader);
	headerSection.setNumberDepth(0);

	paragraphHeader.add(Chunk.NEWLINE);
	paragraphHeader.add(PdfFormatHelper.buildHeaderNameLine(lebData.getSchuelername() , headerFont));
	paragraphHeader.add(Chunk.NEWLINE);
	paragraphHeader.add(PdfFormatHelper.buildHeaderKlassendatenLine(lebData, headerFont));
	headerSection.add(Chunk.NEWLINE);		
	headerSection.add(Chunk.NEWLINE);
	document.add(chapterLEB);
	insertDummyLineIfNecessary(writer);
	
	addKlassenbrief(chapterLEB, writer);
	addIndividuelleEinschaetzung(chapterLEB, writer);
	addFacheinschaetzungen(chapterLEB, writer);
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:24,代码来源:PdfStreamSource.java

示例2: process

import com.itextpdf.text.Anchor; //导入依赖的package包/类
@Override
public void process(int level, Node node, InvocationContext context) {
    ExpLinkNode linkNode = (ExpLinkNode) node;
    String url = context.variableResolver().resolve(linkNode.url);

    Font anchorFont = new FontCopier(context.peekFont())
            .style(Font.UNDERLINE)
            .color(Colors.DARK_RED)
            .get();

    context.pushFont(anchorFont);
    List<Element> subs = context.collectChildren(level, node);
    context.popFont();

    Phrase p = new Phrase();
    p.addAll(subs);

    Anchor anchor = new Anchor(p);
    anchor.setReference(url);
    context.append(anchor);
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:22,代码来源:ExpLinkNodeProcessor.java

示例3: documentFooter

import com.itextpdf.text.Anchor; //导入依赖的package包/类
/**
 * Footer of the document Adds table, new line Adds company web address
 */
private void documentFooter(Document doc, PdfPTable table) {
    try {
        //add the PDF table to the paragraph
        Paragraph paragraph = new Paragraph();
        paragraph.add(table);

        // add the paragraph to the document
        doc.add(paragraph); //this paragraph contains table

        Paragraph line = new Paragraph("\n\n");
        doc.add(line);

        //insert anchor tag in pdf
        Paragraph anchorPara = new Paragraph();
        anchorPara.add(new Phrase("our website : "));
        Anchor anchor = new Anchor("http://yourwebsite.com");
        anchor.setReference("http://yourwebsite.com");

        anchorPara.add(anchor);
        doc.add(anchorPara);

    } catch (DocumentException ex) {
        Logger.getLogger(ReportController.class
                .getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:budthapa,项目名称:Create-PDF-in-Java-,代码行数:30,代码来源:createPDF.java

示例4: renderTextToContainer

import com.itextpdf.text.Anchor; //导入依赖的package包/类
private void renderTextToContainer(final String text) { 
  	String str = ctx.stringTransform(ITextUtil.normalizeSpaces(text));
final Chunk c = new Chunk(str);
c.setFont(ctx.getFont(Font.NORMAL));
if (ctx.isMustAddAnchor()) {
	Anchor a = new Anchor(c);
	a.setFont(ctx.getFont(Font.NORMAL));
	a.setName(ctx.getCurrentId());
	ctx.addToContainer(a);
	ctx.setMustAddAnchor(false);
} else {
	ctx.addToContainer(c);
}
  }
 
开发者ID:lexml,项目名称:lexml-renderer-pdf,代码行数:15,代码来源:PDFBuilder.java

示例5: testCreateLocalLinkInRotatedCell

import com.itextpdf.text.Anchor; //导入依赖的package包/类
/**
 * <a href="http://stackoverflow.com/questions/34408764/create-local-link-in-rotated-pdfpcell-in-itextsharp">
 * Create local link in rotated PdfPCell in iTextSharp
 * </a>
 * <p>
 * This is the equivalent Java code for the C# code in the question. Indeed, this code
 * also gives rise to the broken result. The cause is simple: Normally iText does not
 * touch the current transformation matrix. So the chunk link creation code assumes the
 * current user coordinate system to be the same as used for positioning annotations.
 * But in case of rotated cells iText does change the transformation matrix and
 * consequently the chunk link creation code positions the annotation at the wrong
 * location.
 * </p>
 */
@Test
public void testCreateLocalLinkInRotatedCell() throws IOException, DocumentException
{
    Document doc = new Document();
    PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream(new File(RESULT_FOLDER, "local-link.pdf")));
    doc.open();

    PdfPTable linkTable = new PdfPTable(2);
    PdfPCell linkCell = new PdfPCell();

    linkCell.setHorizontalAlignment(Element.ALIGN_CENTER);
    linkCell.setRotation(90);
    linkCell.setFixedHeight(70);

    Anchor linkAnchor = new Anchor("Click here");
    linkAnchor.setReference("#target");
    Paragraph linkPara = new Paragraph();
    linkPara.add(linkAnchor);
    linkCell.addElement(linkPara);
    linkTable.addCell(linkCell);

    PdfPCell linkCell2 = new PdfPCell();
    Anchor linkAnchor2 = new Anchor("Click here 2");
    linkAnchor2.setReference("#target");
    Paragraph linkPara2 = new Paragraph();
    linkPara2.add(linkAnchor2);
    linkCell2.addElement(linkPara2);
    linkTable.addCell(linkCell2);

    linkTable.addCell(new PdfPCell(new Phrase("cell 3")));
    linkTable.addCell(new PdfPCell(new Phrase("cell 4")));
    doc.add(linkTable);

    doc.newPage();

    Anchor destAnchor = new Anchor("top");
    destAnchor.setName("target");
    PdfPTable destTable = new PdfPTable(1);
    PdfPCell destCell = new PdfPCell();
    Paragraph destPara = new Paragraph();
    destPara.add(destAnchor);
    destCell.addElement(destPara);
    destTable.addCell(destCell);
    destTable.addCell(new PdfPCell(new Phrase("cell 2")));
    destTable.addCell(new PdfPCell(new Phrase("cell 3")));
    destTable.addCell(new PdfPCell(new Phrase("cell 4")));
    doc.add(destTable);

    doc.close();
}
 
开发者ID:mkl-public,项目名称:testarea-itext5,代码行数:65,代码来源:CreateLink.java

示例6: PDFAnchor

import com.itextpdf.text.Anchor; //导入依赖的package包/类
public PDFAnchor(boolean decapitalize, String text, PDFFont font) {
    super(decapitalize, text, font);
    m_anchor = new Anchor(text, font.getFont());
}
 
开发者ID:Antokolos,项目名称:NLB,代码行数:5,代码来源:PDFAnchor.java

示例7: getAnchor

import com.itextpdf.text.Anchor; //导入依赖的package包/类
public Anchor getAnchor() {
    return m_anchor;
}
 
开发者ID:Antokolos,项目名称:NLB,代码行数:4,代码来源:PDFAnchor.java

示例8: createChapter

import com.itextpdf.text.Anchor; //导入依赖的package包/类
public static Chapter createChapter(String chapterName, int chapterNumber) {
	Anchor anchor = new Anchor(chapterName, HEADER_FONT);
	anchor.setName(chapterName);
	Chapter chapter = new Chapter(new Paragraph(chapterName, CAT_FONT), chapterNumber);
	return chapter;
}
 
开发者ID:NimbleGen,项目名称:bioinformatics,代码行数:7,代码来源:PdfReportUtil.java

示例9: getPageContents

import com.itextpdf.text.Anchor; //导入依赖的package包/类
/**
 * generate iText-PDF-Contents for the title page
 * 
 * @return
 * @throws ImageOpException 
 * @throws IOException 
 */
public Element getPageContents() throws IOException, ImageOpException{
	Paragraph content = new Paragraph();
	content.setAlignment(Element.ALIGN_CENTER);

	// add vertical whitespace
	for(int i=0; i<8; i++){
		content.add(Chunk.NEWLINE);
	}
	
	// add logo
	content.add(getLogo());
	content.add(Chunk.NEWLINE);
	content.add(Chunk.NEWLINE);

	// add title
	Anchor title = new Anchor(new Paragraph(getTitle(),FontFactory.getFont(FontFactory.HELVETICA,16)));
	String burl = job_info.getImageJobInformation().getAsString("base.url");
	
	title.setReference(burl+"digilib.html?fn="+job_info.getImageJobInformation().getAsString("fn"));
	content.add(title);		
	content.add(Chunk.NEWLINE);

	// add author
	if(getDate()!=" ")
		content.add(new Paragraph(getAuthor()+" ("+getDate()+")",FontFactory.getFont(FontFactory.HELVETICA,14)));
	else
		content.add(new Paragraph(getAuthor(),FontFactory.getFont(FontFactory.HELVETICA,14)));
	
	content.add(Chunk.NEWLINE);
	
	// add page numbers
	content.add(new Paragraph(getPages(), FontFactory.getFont(FontFactory.HELVETICA, 12)));


	content.add(Chunk.NEWLINE);
	content.add(Chunk.NEWLINE);
	content.add(Chunk.NEWLINE);

	// add digilib version
	content.add(new Paragraph(getDigilibVersion(),FontFactory.getFont(FontFactory.HELVETICA,10)));

	for(int i=0; i<8; i++){
		content.add(Chunk.NEWLINE);
	}
	Anchor address = new Anchor(
			new Paragraph(burl+"digilib.jsp?fn="+job_info.getImageJobInformation().getAsString("fn"), FontFactory.getFont(FontFactory.COURIER, 9))
								);
	address.setReference(burl+"digilib.jsp?fn="+job_info.getImageJobInformation().getAsString("fn"));
	
	content.add(address);

	
	return content;
}
 
开发者ID:robcast,项目名称:digilib,代码行数:62,代码来源:PDFTitlePage.java


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