本文整理了Java中com.itextpdf.text.Paragraph.<init>()
方法的一些代码示例,展示了Paragraph.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Paragraph.<init>()
方法的具体详情如下:
包路径:com.itextpdf.text.Paragraph
类名称:Paragraph
方法名:<init>
[英]Constructs a Paragraph
.
[中]构造一个Paragraph
。
代码示例来源:origin: youseries/ureport
private PdfPCell buildPdfPCell(HeaderFooter phf,String text,int type){
PdfPCell cell=new PdfPCell();
cell.setPadding(0);
cell.setBorder(Rectangle.NO_BORDER);
Font font=FontBuilder.getFont(phf.getFontFamily(), phf.getFontSize(), phf.isBold(), phf.isItalic(),phf.isUnderline());
String fontColor=phf.getForecolor();
if(StringUtils.isNotEmpty(fontColor)){
String[] color=fontColor.split(",");
font.setColor(Integer.valueOf(color[0]), Integer.valueOf(color[1]), Integer.valueOf(color[2]));
}
Paragraph graph=new Paragraph(text,font);
cell.setPhrase(graph);
switch(type){
case 1:
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
break;
case 2:
cell.setHorizontalAlignment(Element.ALIGN_CENTER);
break;
case 3:
cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
break;
}
cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
return cell;
}
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Constructs a new <CODE>Chapter</CODE>.
*
* @param title the Chapter title (as a <CODE>String</CODE>)
* @param number the Chapter number
*/
public Chapter(String title, int number) {
this(new Paragraph(title), number);
}
代码示例来源:origin: com.itextpdf/itextg
/**
* Constructs a new <CODE>Chapter</CODE>.
*
* @param title the Chapter title (as a <CODE>String</CODE>)
* @param number the Chapter number
*/
public Chapter(String title, int number) {
this(new Paragraph(title), number);
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
*
* @param title the title of the new section
* @param numberDepth the numberDepth of the section
* @return a new Section object
*/
public Section addSection(final String title, final int numberDepth) {
return addSection(new Paragraph(title), numberDepth);
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
*
* @param indentation the indentation of the new section
* @param title the title of the new section
* @return a new Section object
*/
public Section addSection(final float indentation, final String title) {
return addSection(indentation, new Paragraph(title));
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Gets the bookmark title.
* @return the bookmark title
*/
public Paragraph getBookmarkTitle() {
if (bookmarkTitle == null)
return getTitle();
else
return new Paragraph(bookmarkTitle);
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
*
* @param indentation the indentation of the new section
* @param title the title of the new section
* @param numberDepth the numberDepth of the section
* @return a new Section object
*/
public Section addSection(final float indentation, final String title, final int numberDepth) {
return addSection(indentation, new Paragraph(title), numberDepth);
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Creates a shallow clone of the Paragraph.
* @return
*/
public Paragraph cloneShallow(boolean spacingBefore) {
Paragraph copy = new Paragraph();
populateProperties(copy, spacingBefore);
return copy;
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Stacks the current paragraph, indicating that we're starting
* a new span.
* @since 5.0.6
*/
public void flushContent() {
pushToStack(currentParagraph);
currentParagraph = new Paragraph();
}
代码示例来源:origin: com.itextpdf/itextg
/**
* Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
*
* @param indentation the indentation of the new section
* @param title the title of the new section
* @return a new Section object
*/
public Section addSection(final float indentation, final String title) {
return addSection(indentation, new Paragraph(title));
}
代码示例来源:origin: org.arrahtec/osdq-core
private void addEmptyLine(Document doc, int number) throws DocumentException {
for (int i = 0; i < number; i++) {
doc.add(new Paragraph(" "));
}
}
代码示例来源:origin: com.itextpdf/itextg
/**
* Adds a <CODE>Section</CODE> to this <CODE>Section</CODE> and returns it.
*
* @param indentation the indentation of the new section
* @param title the title of the new section
* @param numberDepth the numberDepth of the section
* @return a new Section object
*/
public Section addSection(final float indentation, final String title, final int numberDepth) {
return addSection(indentation, new Paragraph(title), numberDepth);
}
代码示例来源:origin: com.itextpdf/itextpdf
/**
* Constructs a new <CODE>Section</CODE>.
*/
protected Section() {
title = new Paragraph();
numberDepth = 1;
title.setRole(new PdfName("H" + numberDepth));
}
代码示例来源:origin: com.github.dandelion/datatables-export-itext
private void addTitle(Document document) throws DocumentException {
Paragraph title = new Paragraph(exportConf.getFileName());
title.add(new Paragraph(" ")); // empty line
title.setAlignment(Element.ALIGN_CENTER);
document.add(title);
}
代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf
private void emitUri(FeatureExec feature, ITextContext emitterContext) {
Styles styles = emitterContext.keyValues().<Styles>getNullable(Styles.class).get();
Paragraph uri = new Paragraph("Uri: " + feature.uri(), styles.getFontOrDefault(Settings.META_FONT));
emitterContext.append(uri);
}
代码示例来源:origin: timurstrekalov/saga
private Element createFooter() {
final Paragraph footer = new Paragraph();
footer.add(new Phrase("Generated using ", FONT_FOOTER));
final Anchor a = new Anchor(config.getProperty("app.name"), FONT_FOOTER);
a.setReference("http://timurstrekalov.github.com/saga/");
footer.add(a);
footer.add(new Phrase(" version " + config.getProperty("app.version"), FONT_FOOTER));
footer.setAlignment(Element.ALIGN_RIGHT);
return footer;
}
代码示例来源:origin: timurstrekalov/saga
private void addContent(final TestRunCoverageStatistics runStats) throws DocumentException {
final Paragraph title = new Paragraph(runStats.title, FONT_H1);
title.setIndentationLeft(PADDING_LEFT);
document.add(title);
document.add(createTable(runStats));
document.add(createFooter());
}
代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf
private PdfPCell titleCell(ScenarioExec scenarioExec, Styles styles) {
Font font = styles.defaultFont();
Paragraph p = new Paragraph(scenarioExec.name(), font);
PdfPCell cell = new PdfPCell(p);
cell.setVerticalAlignment(Element.ALIGN_TOP);
cell.setHorizontalAlignment(Element.ALIGN_LEFT);
if (!debugTable)
cell.setBorder(Rectangle.NO_BORDER);
return cell;
}
代码示例来源:origin: org.technbolts.tzatziki/tzatziki-pdf
private PdfPCell keywordCell(StepExec step, Styles styles) {
Font stepKeywordFont = styles.getFontOrDefault(STEP_KEYWORD_FONT);
Paragraph pKeyword = new Paragraph(step.keyword(), stepKeywordFont);
PdfPCell keywordCell = new PdfPCell(pKeyword);
keywordCell.setVerticalAlignment(Element.ALIGN_TOP);
keywordCell.setHorizontalAlignment(Element.ALIGN_RIGHT);
keywordCell = noBorder(keywordCell);
return keywordCell;
}
代码示例来源:origin: Texera/texera
private static void createPDF(String path) throws Exception {
Document pdfDoc = new Document(PageSize.A4);
PdfWriter.getInstance(pdfDoc, new FileOutputStream(path)).setPdfVersion(PdfWriter.VERSION_1_7);
pdfDoc.open();
Font myfont = new Font();
myfont.setStyle(Font.NORMAL);
myfont.setSize(11);
Paragraph para = new Paragraph("test", myfont);
para.setAlignment(Element.ALIGN_JUSTIFIED);
pdfDoc.add(para);
pdfDoc.close();
}
内容来源于网络,如有侵权,请联系作者删除!