當前位置: 首頁>>代碼示例>>Java>>正文


Java Paragraph.setSpacingBefore方法代碼示例

本文整理匯總了Java中com.itextpdf.text.Paragraph.setSpacingBefore方法的典型用法代碼示例。如果您正苦於以下問題:Java Paragraph.setSpacingBefore方法的具體用法?Java Paragraph.setSpacingBefore怎麽用?Java Paragraph.setSpacingBefore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.itextpdf.text.Paragraph的用法示例。


在下文中一共展示了Paragraph.setSpacingBefore方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: process

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@Override
public void process(int level, Node node, InvocationContext context) {
    List<Element> subs = context.collectChildren(level, node);
    Paragraph p = new Paragraph();
    for (Element sub : subs) {
        p.add(discardNewline(sub));
    }

    KeyValues kvs = context.iTextContext().keyValues();

    Float spacingBefore = kvs.<Float>getNullable(PARAGRAPH_SPACING_BEFORE).or(5f);
    Float spacingAfter = kvs.<Float>getNullable(PARAGRAPH_SPACING_AFTER).or(5f);
    p.setSpacingBefore(spacingBefore);
    p.setSpacingAfter(spacingAfter);

    applyAttributes(context, p);

    context.append(p);
}
 
開發者ID:Arnauld,項目名稱:gutenberg,代碼行數:20,代碼來源:ParaNodeProcessor.java

示例3: process

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@Override
public void process(int level, Node node, InvocationContext context) {
    List<Element> subs = context.collectChildren(level, node);

    com.itextpdf.text.List orderedList = new com.itextpdf.text.List(com.itextpdf.text.List.ORDERED);
    for (Element sub : subs) {
        if (!orderedList.add(sub)) {
            // wrap it
            ListItem listItem = new ListItem();
            listItem.add(sub);
            orderedList.add(listItem);
        }
    }

    KeyValues kvs = context.iTextContext().keyValues();

    Float spacingBefore = kvs.<Float>getNullable(ORDERED_LIST_SPACING_BEFORE).or(5f);
    Float spacingAfter = kvs.<Float>getNullable(ORDERED_LIST_SPACING_AFTER).or(5f);

    Paragraph p = new Paragraph();
    p.add(orderedList);
    p.setSpacingBefore(spacingBefore);
    p.setSpacingAfter(spacingAfter);

    context.append(p);
}
 
開發者ID:Arnauld,項目名稱:gutenberg,代碼行數:27,代碼來源:OrderedListNodeProcessor.java

示例4: fillColumnText

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
protected void fillColumnText(List<HashMap<String, Object>> bookmarkList, ColumnText ct, float leftIndent, int depth) {
	if (null != bookmarkList) {
		for (int i = 0; i < bookmarkList.size(); i++) {
			HashMap<String, Object> bookmark = bookmarkList.get(i);

			String title = (String) bookmark.get("Title");
			String pageNum = ((String) bookmark.get("Page")).split(" ")[0];
			Paragraph paragraph = new Paragraph(title);
			paragraph.add(new Chunk(new DottedLineSeparator()));
			paragraph.add(Integer.toString((Integer.parseInt(pageNum))));
			paragraph.setIndentationLeft(leftIndent * depth);
			paragraph.setSpacingBefore(0 == depth ? 9 : 0);
			ct.addElement(paragraph);

			fillColumnText(((List<HashMap<String, Object>>) bookmark.get("Kids")), ct, leftIndent, depth + 1);
		}
	}
}
 
開發者ID:kohmiho,項目名稱:iTextTutorial,代碼行數:20,代碼來源:T14_TOC.java

示例5: newSection

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
public Section newSection(Paragraph sectionTitle, int hLevel, boolean numbered) {
    if (hLevel < 1)
        throw new IllegalArgumentException("Section hLevel starts at 1 (H1, H2, H3...)");

    Arrays.fill(sections, hLevel, sections.length, null);

    Section section;
    if (hLevel == 1) {
        if (numbered) // only increase chapter number if the number is used
            chapterCount++;

        Chapter chapter = new Chapter(sectionTitle, chapterCount);
        sections[hLevel] = chapter;
        chapters.add(chapter);
        section = chapter;
    } else {
        Section parent = sections[hLevel - 1];
        if (parent == null) {
            throw new IllegalStateException("No parent section (depth H" + (hLevel - 1) + ") found");
        }

        sectionTitle.setSpacingBefore(20f);

        section = parent.addSection(10.0f, sectionTitle);
        sections[hLevel] = section;
    }

    if (!numbered)
        section.setNumberDepth(0);
    return section;
}
 
開發者ID:Arnauld,項目名稱:gutenberg,代碼行數:32,代碼來源:Sections.java

示例6: process

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@Override
public void process(int level, Node node, InvocationContext context) {
    List<Element> subs = context.collectChildren(level, node);

    com.itextpdf.text.List orderedList = new com.itextpdf.text.List(com.itextpdf.text.List.UNORDERED);
    orderedList.setListSymbol(context.bulletSymbol());
    for (Element sub : subs) {
        if (!orderedList.add(sub)) {
            // wrap it
            ListItem listItem = new ListItem();
            listItem.add(sub);
            orderedList.add(listItem);
        }
    }

    KeyValues kvs = context.iTextContext().keyValues();

    Float spacingBefore = kvs.<Float>getNullable(BULLET_LIST_SPACING_BEFORE).or(5f);
    Float spacingAfter = kvs.<Float>getNullable(BULLET_LIST_SPACING_AFTER).or(5f);

    Paragraph p = new Paragraph();
    p.add(orderedList);
    p.setSpacingBefore(spacingBefore);
    p.setSpacingAfter(spacingAfter);

    context.append(p);
}
 
開發者ID:Arnauld,項目名稱:gutenberg,代碼行數:28,代碼來源:BulletListNodeProcessor.java

示例7: getPhotoInParagraph

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
public static Paragraph getPhotoInParagraph(BufferedImage bufferedImage, float scalePercent, float spacingAbove) throws BadElementException, IOException {
	Paragraph paragraph = new Paragraph(" ", SUB_FONT);
	PdfPTable table = new PdfPTable(1);
	table.addCell(getPhotoCell(bufferedImage, scalePercent, true));
	paragraph.add(table);
	paragraph.setLeading(0);
	paragraph.setSpacingAfter(0);
	paragraph.setSpacingBefore(spacingAbove);
	return paragraph;
}
 
開發者ID:NimbleGen,項目名稱:bioinformatics,代碼行數:11,代碼來源:PdfReportUtil.java

示例8: getPhotosInParagraph

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
public static Paragraph getPhotosInParagraph(List<BufferedImage> bufferedImages, float scalePercent, boolean isHorizontallyCentered) throws BadElementException, IOException {
	Paragraph paragraph = new Paragraph(" ", SUB_FONT);
	PdfPTable table = new PdfPTable(1);
	for (BufferedImage bufferedImage : bufferedImages) {
		table.addCell(getPhotoCell(bufferedImage, scalePercent, isHorizontallyCentered));
	}
	table.setHorizontalAlignment(Element.ALIGN_CENTER);

	paragraph.add(table);
	paragraph.setLeading(0);
	paragraph.setSpacingAfter(0);
	paragraph.setSpacingBefore(0);
	return paragraph;
}
 
開發者ID:NimbleGen,項目名稱:bioinformatics,代碼行數:15,代碼來源:PdfReportUtil.java

示例9: formatParagraph

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@Override
protected void formatParagraph(final Element el, final Paragraph p) throws Exception {
    p.setIndentationLeft(ITextUtil.cm2point(8.5f));
    p.setFont(ctx.getFont(Font.NORMAL, ctx.getInt(PDFConfigs.FONT_SIZE_EMENTA)));
    p.setSpacingBefore(ITextUtil.cm2point(1));
    p.setSpacingAfter(ITextUtil.cm2point(2));
}
 
開發者ID:lexml,項目名稱:lexml-renderer-pdf,代碼行數:8,代碼來源:Renderer_Ementa.java

示例10: generateProSheet

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
private void generateProSheet(OutputStream output) {

       Paragraph spacingPara = new Paragraph();
       spacingPara.setSpacingBefore(10);
    spacingPara.add(new Chunk(" ", bodyFont)); 
	
	try {
	
		PdfWriter writer = PdfWriter.getInstance(document, output);
		document.setPageSize(PageSize.LETTER);

		// Set basic metadata
	    document.addAuthor("Peter Brewer"); 
	    document.addSubject("Corina Provenience Sheet for " + o.getTitle()); 
	    
	    /*HeaderFooter footer = new HeaderFooter(new Phrase(""), new Phrase(""));
	    footer.setAlignment(Element.ALIGN_RIGHT);
	    footer.setBorder(0);  
	    document.setFooter(footer);*/
	    
	    /*HeaderFooter header = new HeaderFooter(new Phrase(o.getLabCode()+ " - "+o.getTitle(), bodyFont), false);
	    header.setAlignment(Element.ALIGN_RIGHT);
	    header.setBorder(0);
	    document.setHeader(header);*/
	    			
	    document.open();
		cb = writer.getDirectContent();	
		
		// Title Left		
		ColumnText ct = new ColumnText(cb);
		ct.setSimpleColumn(document.left(), document.top()-193, document.right(), document.top()-20, 20, Element.ALIGN_LEFT);
		ct.addText(getTitlePDF());
		ct.go();
					
			
		// Timestamp
		ColumnText ct3 = new ColumnText(cb);
		ct3.setSimpleColumn(document.left(), document.top()-223, 283, document.top()-60, 20, Element.ALIGN_LEFT);
		ct3.setLeading(0, 1.2f);
		ct3.addText(getTimestampPDF());
		ct3.go();
		
	
		
		
		// Pad text
		document.add(spacingPara);   
        document.add(getObjectDescription());   
        document.add(getObjectComments());
	     
        document.add(spacingPara);
        
        getElementTable();

		
	} catch (DocumentException de) {
		System.err.println(de.getMessage());
	}

	// Close the document
	document.close();
}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:63,代碼來源:ProSheet.java

示例11: generateBoxLabel

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
public void generateBoxLabel(OutputStream output) {

	try {
	
		PdfWriter writer = PdfWriter.getInstance(document, output);
		
		document.setPageSize(PageSize.LETTER);
		document.open();
	
		cb = writer.getDirectContent();			
		
		// Set basic metadata
	    document.addAuthor("Peter Brewer"); 
	    document.addSubject("Box Label"); 
			
	    for(WSIBox b : this.boxlist)
	    {
		    
			// Title Left		
			ColumnText ct = new ColumnText(cb);
			ct.setSimpleColumn(document.left(), document.top(15)-210, 368, document.top(15), 20, Element.ALIGN_LEFT);
			ct.addText(getTitlePDF(b));
			ct.go();
			
			// Barcode
			ColumnText ct2 = new ColumnText(cb);
			ct2.setSimpleColumn(370, document.top(15)-100, document.right(0), document.top(0), 20, Element.ALIGN_RIGHT);
			ct2.addElement(getBarCode(b));
			ct2.go();			
				
			// Timestamp
			ColumnText ct3 = new ColumnText(cb);
			ct3.setSimpleColumn(document.left(), document.top(15)-223, 350, document.top(15)-60, 20, Element.ALIGN_LEFT);
			ct3.setLeading(0, 1.2f);
			ct3.addText(getTimestampPDF(b));
			ct3.go();		
			
			// Pad text
	        document.add(new Paragraph(" "));      
	        Paragraph p2 = new Paragraph();
	        p2.setSpacingBefore(70);
		    p2.setSpacingAfter(10);
		    p2.add(new Chunk(" ", bodyFontLarge));  
	        document.add(new Paragraph(p2));
	        
	        // Ring samples table
	        addTable(b);
	        document.add(getParagraphSpace());	
		    
	        document.add(getComments(b));
	        
	        document.newPage();

	    }
	    
		
	} catch (DocumentException de) {
		System.err.println(de.getMessage());
	}

	// Close the document
	document.close();
}
 
開發者ID:ltrr-arizona-edu,項目名稱:tellervo,代碼行數:64,代碼來源:CompleteBoxLabel.java

示例12: PdfConsentBuilder

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
public PdfConsentBuilder() {
	String header = "Request for an Authorization to Release Protected Health Information (PHI)";
	if (PDFBuilderForCDA.this.privacyLaw.equals("Title38Section7338")) {
		PDFBuilderForCDA.this.privacyAct = "Privacy Act: The execution of this form does not authorize the release of information other than that specifically described below. The information requested on this form is solicited under Title 38, U.S.C. 7332. Your disclosure of the information requested on this form is voluntary. However, if the information including Social Security Number (SSN) (the SSN will be used to locate records for release) is not furnished completely and accurately, Department of Veterans Affairs will be unable to comply with your request to participate in the NHIN program. The Veterans Health Administration may not condition treatment on signing of this form. Failure to furnish the information will not have any effect on any other benefits to which you may be entitled.";
	} else if (PDFBuilderForCDA.this.privacyLaw.equals("42CFRPart2")) {
		PDFBuilderForCDA.this.privacyAct = "Privacy Act: 42 CFR Part 2 protects clients who have applied for, participated in, or received an interview, counseling, or any other service from a federally assisted alcohol or drug abuse program, identified as an alcohol or drug client during an evaluation of eligibility for treatment. Programs may not disclose any identifying information unless the patient has given consent or otherwise specifically permitted under 42 CFR Part 2.";
	} else {
		PDFBuilderForCDA.this.privacyAct = PDFBuilderForCDA.this.privacyStatement;
	}
	String infoRequested = "Information Requested:";
	String infoRequested2 = "Pertinent health information that may include but is not limited to the following: ";
	String infoRequested3 = "Medications, Vitals, Problem List, Health Summary, Progress Notes";

	String forPeriodOfLBL = "This authorization will remain in effect until I revoke my authorization or for the period of five years whichever is sooner.";

	String certificationLBL = "AUTHORIZATION: I certify that this request has been made freely, voluntarily and without ";
	String certificationLBL2 = "coercion and that the information given above is accurate and complete to the best of my knowledge.";

	String documentDate = "Date: " + getCurrentDate();

	String disclosureAction = "Disclosure Action Requested: "
			+ PDFBuilderForCDA.this.patientAuthorization;
	try {
		PDFBuilderForCDA.this.document = new Document(PageSize.A4,
				25.0F, 25.0F, 25.0F, 25.0F);
		PdfWriter.getInstance(PDFBuilderForCDA.this.document, this.os);

		PDFBuilderForCDA.this.document.open();

		addHeaderImage();
		PDFBuilderForCDA.this.document.add(getNamesTable());
		PDFBuilderForCDA.this.document.add(new Paragraph(documentDate,
				PDFBuilderForCDA.this.tmbase));
		Paragraph headerP = new Paragraph(header,
				PDFBuilderForCDA.this.tmbase);
		headerP.setSpacingBefore(1.0F);
		headerP.setSpacingAfter(1.0F);
		PDFBuilderForCDA.this.document.add(headerP);

		PDFBuilderForCDA.this.document.add(getPrivacyStatement());

		PDFBuilderForCDA.this.document.add(new Paragraph(infoRequested,
				PDFBuilderForCDA.this.tmbase));
		PDFBuilderForCDA.this.document.add(new Paragraph(
				infoRequested2, PDFBuilderForCDA.this.tmbase));
		Paragraph infoP = new Paragraph(infoRequested3,
				PDFBuilderForCDA.this.tmbase);
		infoP.setSpacingAfter(1.0F);
		PDFBuilderForCDA.this.document.add(infoP);

		Paragraph disclosure = new Paragraph(disclosureAction,
				PDFBuilderForCDA.this.tmbase);
		disclosure.setSpacingAfter(1.0F);
		PDFBuilderForCDA.this.document.add(disclosure);

		PDFBuilderForCDA.this.document.add(getAuthorizedRecipients());

		PDFBuilderForCDA.this.document.add(getAllowedPOUs());

		if ((PDFBuilderForCDA.this.patientAuthorization
				.equals("Permit"))
				|| (PDFBuilderForCDA.this.patientAuthorization
						.equals("Disclose"))) {
			PDFBuilderForCDA.this.document.add(getRedactActions());
			PDFBuilderForCDA.this.document.add(getMaskingActions());
		}
		Paragraph period = new Paragraph(forPeriodOfLBL,
				PDFBuilderForCDA.this.tmbase);
		period.setSpacingAfter(1.0F);
		PDFBuilderForCDA.this.document.add(period);
		PDFBuilderForCDA.this.document.add(new Paragraph(
				certificationLBL, PDFBuilderForCDA.this.tmsmall));
		PDFBuilderForCDA.this.document.add(new Paragraph(
				certificationLBL2, PDFBuilderForCDA.this.tmsmall));
	} catch (Exception e) {
		e.printStackTrace();
	} finally {
		if (PDFBuilderForCDA.this.document != null)
			PDFBuilderForCDA.this.document.close();
	}
}
 
開發者ID:tlin-fei,項目名稱:ds4p,代碼行數:82,代碼來源:PDFBuilderForCDA.java

示例13: render

import com.itextpdf.text.Paragraph; //導入方法依賴的package包/類
@Override
public boolean render(final Element el) throws Exception {

    String parentName = el.getParent().getName();
    if (parentName.equals("Capitulo") || parentName.equals("Titulo") || parentName.equals("Livro")
        || parentName.equals("Parte") || parentName.equals("Secao") || parentName.equals("Subsecao")) {

        Paragraph p = ctx.createParagraph();
        p.setAlignment(com.itextpdf.text.Element.ALIGN_CENTER);

        float paragraphSpacing = ITextUtil.cm2point(ctx.getFloat(PDFConfigs.PARAGRAPH_SPACING));
        p.setSpacingBefore(paragraphSpacing / 2);
        p.setSpacingAfter(paragraphSpacing / 2);

        ctx.pushContainer(p); // Necessário para abertura de aspas

        // Negrito
        if (parentName.equals("Secao") || parentName.equals("Subsecao")) {
            p.setFont(ctx.getFont(Font.BOLD));
        }

        addToContainer(el.getTextTrim());

        ctx.popContainer();
        addToPDF(p);
    }
    else {
        String texto = el.getTextTrim();
        if (parentName.equals("Artigo") || parentName.equals("Paragrafo")) {
            texto += "  "; // Dois espaços
        }
        else {
            texto += " ";
        }

        Chunk c = new Chunk(texto);

        if (texto.toLowerCase().contains("parágrafo único")) {
            c.setFont(ctx.getFont(Font.ITALIC));
        }
        else {
            c.setFont(ctx.getFont(Font.BOLD));
        }

        addToNextContainer(c);

        if (renderizarOmissis(el)) {
            Renderer_Omissis.renderOmissis(ctx);
        }
    }

    return Renderer.ACABOU;
}
 
開發者ID:lexml,項目名稱:lexml-renderer-pdf,代碼行數:54,代碼來源:Renderer_Rotulo.java


注:本文中的com.itextpdf.text.Paragraph.setSpacingBefore方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。