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


Java Paragraph.setAlignment方法代码示例

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


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

示例1: getObjectDescription

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private Paragraph getObjectDescription() 
{

	Paragraph p = new Paragraph();
	p.setLeading(0, 1.2f);
	p.setAlignment(Element.ALIGN_JUSTIFIED);
       p.setSpacingAfter(10);
       p.setSpacingBefore(50);
       
	if(o.getDescription()!=null){
		p.add(new Chunk(o.getDescription(), bodyFont));
	}
	else{
		p.add(new Chunk("No description recorded", bodyFont));
	}
	
	return p;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:19,代码来源:ProSheet.java

示例2: onEndPage

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
/**
 * Adds a header to every page
 * @see com.itextpdf.text.pdf.PdfPageEventHelper#onEndPage(
 *      com.itextpdf.text.pdf.PdfWriter, com.itextpdf.text.Document)
 */
public void onEndPage(PdfWriter writer, Document document) {
	PdfPTable table = new PdfPTable(3);
	try {
		table.setWidths(new int[]{40,5,10});
		table.setTotalWidth(100);
		table.getDefaultCell().setBorder(Rectangle.NO_BORDER);
		table.getDefaultCell().setHorizontalAlignment(Element.ALIGN_RIGHT);
		Font font=new Font(chineseFont,8);
		font.setColor(new BaseColor(55,55,55));
		Paragraph paragraph=new Paragraph("第   "+writer.getPageNumber()+" 页   共",font);
		paragraph.setAlignment(Element.ALIGN_RIGHT);
		table.addCell(paragraph);
		Image img=Image.getInstance(total);
		img.scaleAbsolute(28, 28);
		PdfPCell cell = new PdfPCell(img);
		cell.setBorder(Rectangle.NO_BORDER);
		cell.setHorizontalAlignment(Element.ALIGN_CENTER);
		table.addCell(cell);
		PdfPCell c = new PdfPCell(new Paragraph("页",font));
		c.setHorizontalAlignment(Element.ALIGN_LEFT);
		c.setBorder(Rectangle.NO_BORDER);
		table.addCell(c);
		float center=(document.getPageSize().getWidth())/2-120/2;
		table.writeSelectedRows(0, -1,center,30, writer.getDirectContent());
	}
	catch(DocumentException de) {
		throw new ExceptionConverter(de);
	}
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:35,代码来源:PdfReportPageNumber.java

示例3: addTitlePage

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void addTitlePage(Document document) throws DocumentException {

	addEmptyLine(document, 5);
   
   Paragraph title = new Paragraph("Data Dictionary by Arrah technology");
   title.setAlignment(Element.ALIGN_CENTER);
   document.add(title);
   addEmptyLine(document, 1);
   
   Paragraph url = new Paragraph("http://sourceforge.net/projects/dataquality/");
   url.setAlignment(Element.ALIGN_CENTER);
   document.add(url);
   addEmptyLine(document, 3);
   
   Paragraph rtime = new Paragraph("Report generated on: " +  new Date());
   rtime.setAlignment(Element.ALIGN_CENTER);
   document.add(rtime);

   document.newPage();
 }
 
开发者ID:arrahtech,项目名称:osdq-core,代码行数:21,代码来源:DataDictionaryPDF.java

示例4: getObjectComments

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private Paragraph getObjectComments() 
{

	Paragraph p = new Paragraph();
	p.setLeading(0, 1.2f);
	p.setAlignment(Element.ALIGN_JUSTIFIED);
       p.setSpacingAfter(10);
	
	if(o.getComments()!=null){
		p.add(new Chunk("Notes: ", commentFont));
		p.add(new Chunk(o.getComments(), commentFont));
	}

	
	return p;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:17,代码来源:ProSheet.java

示例5: main

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
/**
 * Generates a document with a header containing Page x of y and with a Watermark on every page.
 * @param args no arguments needed
 */
public static void main(String args[]) {
    try {
    	// step 1: creating the document
        Document doc = new Document(PageSize.A4, 50, 50, 100, 72);
        // step 2: creating the writer
        PdfWriter writer = PdfWriter.getInstance(doc, new FileOutputStream("pageNumbersWatermark.pdf"));
        // step 3: initialisations + opening the document
        writer.setPageEvent(new PageNumbersWatermark());
        doc.open();
        // step 4: adding content
        String text = "some padding text ";
        for (int k = 0; k < 10; ++k)
            text += text;
        Paragraph p = new Paragraph(text);
        p.setAlignment(Element.ALIGN_JUSTIFIED);
        doc.add(p);
        // step 5: closing the document
        doc.close();
    }
    catch ( Exception e ) {
        e.printStackTrace();
    }
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:28,代码来源:PageNumbersWatermark.java

示例6: addIndividuelleEinschaetzung

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void addIndividuelleEinschaetzung(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException {
	if (!lebData.getIndividuelleEinschaetzung().isEmpty()) {
		sectionCount += 1;
		breakHurenkind(writer);
		breakSchusterjunge(writer);
		Paragraph paragraphIndividuelleEinschaetzung = new Paragraph();
		Section individuelleEinschaetzungsTextSection = chapterLEB.addSection(paragraphIndividuelleEinschaetzung);
		individuelleEinschaetzungsTextSection.setNumberDepth(0);
		Paragraph schuelereinschaetzungParapgraph = new Paragraph(lebData.getIndividuelleEinschaetzung().replace('\t', '\0'), standardTextFont);
		schuelereinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
		schuelereinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
		individuelleEinschaetzungsTextSection.add(schuelereinschaetzungParapgraph);			
		document.add(individuelleEinschaetzungsTextSection);
		document.add(getKlassenlehrerunterschrift(chapterLEB));
		alertHurenkind(writer);
		insertDummyLineIfNecessary(writer);
	}
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:19,代码来源:PdfStreamSource.java

示例7: addKlassenbrief

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void addKlassenbrief(Chapter chapterLEB, PdfWriter writer) throws DocumentException, PdfFormatierungsException {
	if (!lebData.getKlassenbrief().isEmpty()) {
		sectionCount += 1;
		breakSchusterjunge(writer);
		Paragraph paragraphKlassenbrief = new Paragraph();
		Section klassenbriefSection = chapterLEB.addSection(paragraphKlassenbrief);
		klassenbriefSection.setNumberDepth(0);
		Paragraph klasseneinschaetzungParapgraph = new Paragraph(lebData.getKlassenbrief().replace('\t', '\0'), standardTextFont);
		klasseneinschaetzungParapgraph.setAlignment(Element.ALIGN_JUSTIFIED);
		klasseneinschaetzungParapgraph.setLeading(FIXED_LEADING_TEXT, zeilenabstandsfaktor);
		klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
		if (lebData.getIndividuelleEinschaetzung().isEmpty()) {
			klassenbriefSection.add(klasseneinschaetzungParapgraph);
			document.add(klassenbriefSection);
			document.add(getKlassenlehrerunterschrift(chapterLEB));
		} else {
			klasseneinschaetzungParapgraph.add(Chunk.NEWLINE);
			klassenbriefSection.add(klasseneinschaetzungParapgraph);
			document.add(klassenbriefSection);
		}
		alertLonelyHeader(writer);
		insertDummyLineIfNecessary(writer);
	}
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:25,代码来源:PdfStreamSource.java

示例8: addTitle

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
public void addTitle() throws DocumentException {

		Paragraph title = new Paragraph();
		title.setAlignment(1);
		title.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 14, Font.BOLD,
				BaseColor.RED));
		title.add(new Phrase("Java Assignment"));
		document.add(title);

		addEmptyLine(title, 2);

		Paragraph name = new Paragraph();
		name.setAlignment(0);
		name.setFont(new Font(Font.FontFamily.TIMES_ROMAN, 12, Font.BOLD,
				BaseColor.GRAY));
		name.add(new Phrase("  Name     : " + FileUtil.name + "\n"));
		name.add(new Phrase("  Enrollno : " + FileUtil.rollno
				+ "\n\n"));
		document.add(name);

		addEmptyLine(title, 2);
	}
 
开发者ID:codebuff,项目名称:txt2pdf,代码行数:23,代码来源:PdfUtils.java

示例9: createReportTitle

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
protected Paragraph createReportTitle(ReportTitle reportTitle) {
	Paragraph paragraph = new Paragraph();
	paragraph.setAlignment(Element.ALIGN_CENTER);
	if (reportTitle != null && reportTitle.isShowTitle()) {
		TextChunk titleChunk = new TextChunk();
		titleChunk.setText(reportTitle.getTitle());
		titleChunk.setFontSize(reportTitle.getStyle().getFontSize());
		titleChunk.setFontColor(reportTitle.getStyle().getFontColor());
		paragraph.add(createChunk(titleChunk));
		paragraph.add(Chunk.NEWLINE);
		paragraph.add(Chunk.NEWLINE);
	}
	return paragraph;
}
 
开发者ID:bsteker,项目名称:bdf2,代码行数:15,代码来源:AbstractPdfReportBuilder.java

示例10: CreatePDF_3DPrinter

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
public CreatePDF_3DPrinter(File file, ArrayList<String> infos, ArrayList<Image> imagelist) throws DocumentException, MalformedURLException, IOException{
	result = file;
	MyPDF = new Document(PageSize.A4, 50, 50, 80, 80);
	MyWriter = PdfWriter.getInstance(MyPDF,new FileOutputStream(result));
	MyWriter.setInitialLeading(160);
	MyPDF.open();
	Font font = new Font(Font.FontFamily.TIMES_ROMAN, 40, Font.NORMAL);
	Paragraph pg = new Paragraph();
	pg.setAlignment(Element.ALIGN_CENTER);
	pg.setSpacingAfter(150);
	pg.setFont(font);
	pg.add(infos.get(0));	
	pg.setLeading(2,1);
	MyPDF.add(pg);
	Image image = Image.getInstance(loadImage("/logo.png"), null);
	image.setAbsolutePosition((MyPDF.getPageSize().getWidth()/2) - (image.getWidth()/2), 580f);
	if(infos.get(0).length()<25){
		image.setAbsolutePosition((MyPDF.getPageSize().getWidth()/2) - (image.getWidth()/2), 620f);
	}
       MyPDF.add(image);
	MyPDF.add(createFrontPageTable(infos));
	
	if(imagelist!=null){
		tilingImages(imagelist);
	}
	MyPDF.close();
}
 
开发者ID:AlexandrePechereau,项目名称:FabDocMaker,代码行数:28,代码来源:CreatePDF_3DPrinter.java

示例11: CreatePDF_LaserCutting

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
public CreatePDF_LaserCutting(File file, ArrayList<String> infos, ArrayList<Image> imagelist) throws DocumentException, MalformedURLException, IOException{
	result = file;
	MyPDF = new Document(PageSize.A4, 50, 50, 80, 80);
	MyWriter = PdfWriter.getInstance(MyPDF,new FileOutputStream(result));
	MyWriter.setInitialLeading(160);
	MyPDF.open();
	Font font = new Font(Font.FontFamily.TIMES_ROMAN, 40, Font.NORMAL);
	Paragraph pg = new Paragraph();
	pg.setAlignment(Element.ALIGN_CENTER);
	pg.setSpacingAfter(150);
	pg.setFont(font);
	pg.add(infos.get(0));	
	pg.setLeading(2,1);
	MyPDF.add(pg);
	Image image = Image.getInstance(loadImage("/logo.png"), null);
	image.setAbsolutePosition((MyPDF.getPageSize().getWidth()/2) - (image.getWidth()/2), 580f);
	if(infos.get(0).length()<25){
		image.setAbsolutePosition((MyPDF.getPageSize().getWidth()/2) - (image.getWidth()/2), 620f);
	}
       MyPDF.add(image);
	MyPDF.add(createFrontPageTable(infos));
	
	if(imagelist!=null){
		tilingImages(imagelist);
	}
	MyPDF.close();
}
 
开发者ID:AlexandrePechereau,项目名称:FabDocMaker,代码行数:28,代码来源:CreatePDF_LaserCutting.java

示例12: getParagraph

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
/**
 * Create a paragraph with the factory element attributes applied
 * @return A paragraph with the element attributes applied
 */
public Paragraph getParagraph() {
  Paragraph lParagraph = new Paragraph();
  setFontAttributes(lParagraph.getFont(), mElementAttributes.getFontAttributes());
  lParagraph.setMultipliedLeading(mElementAttributes.getFontAttributes().getMultipliedLeading());
  lParagraph.setAlignment(mElementAttributes.getParagraphAttributes().getAlignment());

  return lParagraph;
}
 
开发者ID:Fivium,项目名称:FOXopen,代码行数:13,代码来源:ElementFactory.java

示例13: getKlassenlehrerunterschrift

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private Section getKlassenlehrerunterschrift(Section chapterLEB) {
	Paragraph unterschriftParagraph = new Paragraph();
	Section klassenbriefUnterschriftSection = chapterLEB.addSection(unterschriftParagraph);
	klassenbriefUnterschriftSection.setNumberDepth(0);
	unterschriftParagraph.add(new Phrase(lebData.getKlassenlehrerUnterschrift().replace('\t', '\0'), standardTextFont));
	unterschriftParagraph.setAlignment(Element.ALIGN_RIGHT);
	unterschriftParagraph.add(Chunk.NEWLINE);
	unterschriftParagraph.add(Chunk.NEWLINE);			
	return klassenbriefUnterschriftSection;
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:11,代码来源:PdfStreamSource.java

示例14: appendSubject

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
private void appendSubject(ITextContext context, Paragraph preface) {
    if (StringUtils.isEmpty(subject)) {
        return;
    }

    Styles styles = context.styles();
    Font font = styles.getFont(FIRST_PAGE_SUBJECT_FONT).or(subjectFont(styles));
    for (String titlePart : subject.split("[\n\r]+")) {
        Paragraph paragraph = new Paragraph(titlePart, font);
        paragraph.setAlignment(Element.ALIGN_RIGHT);
        paragraph.setSpacingAfter(15.0f);
        preface.add(paragraph);
    }
}
 
开发者ID:Arnauld,项目名称:gutenberg,代码行数:15,代码来源:FirstPageRenderer.java

示例15: decorateCaption

import com.itextpdf.text.Paragraph; //导入方法依赖的package包/类
/**
 * Writes the table caption according to a set style.
 * @param model The table model containing the caption.
 * @throws DocumentException If an error occurrs while decorating the caption.
 */
private void decorateCaption(TableModel model) throws DocumentException
{
    Paragraph caption = new Paragraph(new Chunk(model.getCaption(), this.getCaptionFont()));
    caption.setAlignment(this.getCaptionHorizontalAlignment());
    this.document.add(caption);
}
 
开发者ID:webbfontaine,项目名称:displaytag,代码行数:12,代码来源:ItextTableWriter.java


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