本文整理匯總了Java中com.itextpdf.text.pdf.PdfPTable.setSpacingBefore方法的典型用法代碼示例。如果您正苦於以下問題:Java PdfPTable.setSpacingBefore方法的具體用法?Java PdfPTable.setSpacingBefore怎麽用?Java PdfPTable.setSpacingBefore使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.itextpdf.text.pdf.PdfPTable
的用法示例。
在下文中一共展示了PdfPTable.setSpacingBefore方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addOfferInstances
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void addOfferInstances(List<OfferInstance> offerInstances, Document document, BaseFont bf)
throws DocumentException {
if(offerInstances.isEmpty()) {
return;
}
document.add(new Paragraph("Wybrane oferty: ", new Font(bf, 12)));
PdfPTable offerInstancesTable = new PdfPTable(3);
offerInstancesTable.setWidthPercentage(100);
offerInstancesTable.setSpacingBefore(18f);
offerInstancesTable.setSpacingAfter(18f);
createofferInstancesTableHeaders(offerInstancesTable);
createofferInstancesTableContent(offerInstances, offerInstancesTable);
document.add(offerInstancesTable);
}
示例2: process
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
@Override
public void process(int level, Node node, InvocationContext context) {
TableNode tableNode = (TableNode) node;
List<TableColumnNode> tableNodeColumns = tableNode.getColumns();
PdfPTable table = new PdfPTable(tableNodeColumns.size());
for (PdfPTableEvent tableEvent : tableEvents) {
table.setTableEvent(tableEvent);
}
context.pushTable(new TableInfos(table, tableNodeColumns));
context.processChildren(level, node);
context.popTable();
KeyValues kvs = context.iTextContext().keyValues();
Float spacingBefore = kvs.<Float>getNullable(TABLE_SPACING_BEFORE).or(5f);
Float spacingAfter = kvs.<Float>getNullable(TABLE_SPACING_AFTER).or(5f);
table.setSpacingBefore(spacingBefore);
table.setSpacingAfter(spacingAfter);
applyAttributes(context, table);
context.append(table);
}
示例3: getTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
* Create a table with the factory element attributes applied
* @return A table with the element attributes applied
*/
public PdfPTable getTable(int pColumns) {
PdfPTable lTable = new PdfPTable(pColumns);
// Set split late to false so that tables will be split immediately if they don't fit on a page instead of moving
// them to the next page then attempting to split if they don't fit there. iText gets in an infinite loop with the
// latter option when content in nested table rows can't split (see EDU-3490 on JIRA).
lTable.setSplitLate(false);
mElementAttributes.getTableAttributes().getWidthPercentage().ifPresent(pWidthPercentage -> {
lTable.setWidthPercentage(pWidthPercentage);
lTable.setLockedWidth(false);
});
mElementAttributes.getTableAttributes().getFixedWidth().ifPresent(pFixedWidth -> {
lTable.setTotalWidth(pFixedWidth);
lTable.setLockedWidth(true);
});
lTable.setHorizontalAlignment(mElementAttributes.getTableAttributes().getHorizontalAlignment());
lTable.setSpacingBefore(mElementAttributes.getTableAttributes().getSpacingBefore());
lTable.setSpacingAfter(mElementAttributes.getTableAttributes().getSpacingAfter());
lTable.setKeepTogether(mElementAttributes.getTableAttributes().isKeepTogether());
return lTable;
}
示例4: createBarcodeTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable createBarcodeTable(PdfContentByte cb, String caption, String detail, String code) {
// Barcode Generation
Barcode39 codeEAN = new Barcode39();
codeEAN.setCode(code);
Image imageEAN = codeEAN.createImageWithBarcode(cb, null, null);
// Table
PdfPTable table = new PdfPTable(1);
table.setSpacingBefore(10);
table.setSpacingAfter(10);
table.setTotalWidth(80);
table.setLockedWidth(true);
PdfPCell cell1 = new PdfPCell(imageEAN);
PdfPCell cell2 = new PdfPCell(new Paragraph(caption));
PdfPCell cell3 = new PdfPCell(new Paragraph(detail));
cell1.setBorder(Rectangle.NO_BORDER);
cell2.setBorder(Rectangle.NO_BORDER);
cell3.setBorder(Rectangle.NO_BORDER);
table.addCell(cell1);
table.addCell(cell2);
table.addCell(cell3);
return table;
}
示例5: processRequest
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
/**
*
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try (PrintWriter out = response.getWriter()) {
//special font sizes
//user for this entire page
Font titleFont = new Font(Font.FontFamily.TIMES_ROMAN, 10, Font.BOLD, new BaseColor(0, 0, 0));
Font bodyFont = new Font(Font.FontFamily.TIMES_ROMAN, 10);
//set document response type
documentResponse(response);
//generate new document.
Document doc = new Document();
//add properties
documentProperties(response, doc);
//open document
doc.open();
//create title of report
Paragraph title = new Paragraph("PDF in Java");
//get the current date and time form the class
CurrentDateTime date = new CurrentDateTime();
//add header
documentHeader(doc, date, title, response);
//set number of columns and their widths, f is float
float[] columnWidths = {2f, 3f, 3f, 3f};
PdfPTable table = new PdfPTable(columnWidths);
//set width and spacing of table, default width is 100f, f is float
table.setWidthPercentage(90f);
table.setSpacingBefore(10f);
table.setSpacingBefore(10f);
//set heading of table
insertCell(table, "User Id", Element.ALIGN_CENTER, 1, titleFont);
insertCell(table, "UserName", Element.ALIGN_CENTER, 1, titleFont);
insertCell(table, "Address", Element.ALIGN_CENTER, 1, titleFont);
insertCell(table, "Email", Element.ALIGN_CENTER, 1, titleFont);
//add header row to the table, we can set more than one row
table.setHeaderRows(1);
//set body part of the table
insertCell(table, "1", Element.ALIGN_CENTER, 1, bodyFont);
insertCell(table, "budthapa", Element.ALIGN_CENTER, 1, bodyFont);
insertCell(table, "Kathmandu", Element.ALIGN_CENTER, 1, bodyFont);
insertCell(table, "[email protected]", Element.ALIGN_CENTER, 1, bodyFont);
//add document footer
//this footer adds above table in the paragraph
documentFooter(doc, table);
//close the document
doc.close();
} catch (Exception e) {
//exception here
}
}
示例6: createBlankTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public PdfPTable createBlankTable() {
PdfPTable table = new PdfPTable(1);
table.getDefaultCell().setBorder(0);
table.addCell(createCell("", keyfont));
table.setSpacingAfter(20.0f);
table.setSpacingBefore(20.0f);
return table;
}
示例7: createTable
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public PdfPTable createTable( float widthInPs ){
PdfPTable table = new PdfPTable(1);
table.setTotalWidth(widthInPs);
table.setLockedWidth( true );
table.setSpacingBefore(0);
table.setSpacingAfter(0);
return table;
}
示例8: addAccomodations
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void addAccomodations(List<Accomodation> accomodations, Document document, BaseFont bf)
throws DocumentException {
document.add(new Paragraph("Zarezerwowane pokoje: ", new Font(bf, 12)));
PdfPTable accomodationsTable = new PdfPTable(7);
accomodationsTable.setWidthPercentage(100);
accomodationsTable.setSpacingBefore(18f);
accomodationsTable.setSpacingAfter(18f);
createAccomodationTableHeaders(accomodationsTable);
createAccomodationTableContent(accomodations, accomodationsTable);
document.add(accomodationsTable);
}
示例9: addCleaningSchedules
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void addCleaningSchedules(Long cleanerId, Document document, BaseFont bf)
throws DocumentException {
List<CleaningSchedule> cleaningSchedules =
cleaningScheduleRepository.findByEmployeeId(cleanerId);
PdfPTable cleaningScheduleTable = new PdfPTable(4);
cleaningScheduleTable.setSpacingBefore(10f);
createTableHeaders(cleaningScheduleTable);
createTableContent(cleaningSchedules, cleaningScheduleTable);
document.add(cleaningScheduleTable);
}
示例10: printPage3
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private void printPage3(Document document, PdfContentByte canvas) throws DocumentException {
int cols = 3;
int rows = 15;
PdfPTable table = new PdfPTable(cols);
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
table.addCell(new Phrase("Cell " + row + ", " + col));
}
}
table.setSpacingBefore(5);
Rectangle docBounds = document.getPageSize();
Rectangle upper = new Rectangle(docBounds.getLeft(20), docBounds.getTop(20) - 200, docBounds.getRight(20), docBounds.getTop(20));
upper.setBackgroundColor(new BaseColor(23, 142, 255, 20));
Rectangle lower = new Rectangle(docBounds.getLeft(20), docBounds.getBottom(20), docBounds.getRight(20), docBounds.getBottom(20) + 600);
lower.setBackgroundColor(new BaseColor(255, 142, 23, 20));
Rectangle[] rectangles = new Rectangle[] { upper, lower };
for (Rectangle bounds : rectangles)
{
bounds.setBorder(Rectangle.BOX);
bounds.setBorderColor(BaseColor.BLACK);
bounds.setBorderWidth(1);
canvas.rectangle(bounds);
}
rectangles = drawKeepTogether(new Paragraph("This table should keep together!"), canvas, rectangles);
rectangles = drawKeepTogether(table, canvas, rectangles);
}
示例11: getAuthorizedRecipients
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable getAuthorizedRecipients() {
PdfPTable table = new PdfPTable(1);
table.setSpacingAfter(1.0F);
table.setSpacingBefore(1.0F);
table.getDefaultCell().setBackgroundColor(BaseColor.CYAN);
table.setWidthPercentage(40.0F);
table.addCell("Authorized Recipient(s)");
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
Iterator iter = PDFBuilderForCDA.this.recipients.iterator();
while (iter.hasNext()) {
String r = (String) iter.next();
table.addCell(r);
}
return table;
}
示例12: getMaskingActions
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable getMaskingActions() {
PdfPTable table = new PdfPTable(1);
table.setSpacingAfter(1.0F);
table.setSpacingBefore(1.0F);
table.getDefaultCell().setBackgroundColor(BaseColor.CYAN);
table.setWidthPercentage(40.0F);
table.addCell("Data Sensitivities Requiring Masking(Encryption)");
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
Iterator iter = PDFBuilderForCDA.this.mask.iterator();
while (iter.hasNext()) {
String r = (String) iter.next();
table.addCell(r);
}
return table;
}
示例13: getRedactActions
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable getRedactActions() {
PdfPTable table = new PdfPTable(1);
table.setSpacingAfter(1.0F);
table.setSpacingBefore(1.0F);
table.getDefaultCell().setBackgroundColor(BaseColor.CYAN);
table.setWidthPercentage(40.0F);
table.addCell("Data Sensitivities Requiring Redaction(Removal From Record)");
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
Iterator iter = PDFBuilderForCDA.this.redact.iterator();
while (iter.hasNext()) {
String r = (String) iter.next();
table.addCell(r);
}
return table;
}
示例14: getAllowedPOUs
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
private PdfPTable getAllowedPOUs() {
PdfPTable table = new PdfPTable(1);
table.setSpacingAfter(1.0F);
table.setSpacingBefore(1.0F);
table.getDefaultCell().setBackgroundColor(BaseColor.CYAN);
table.setWidthPercentage(40.0F);
table.addCell("Intended Purpose(s) of Use");
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE);
Iterator iter = PDFBuilderForCDA.this.pous.iterator();
while (iter.hasNext()) {
String r = (String) iter.next();
table.addCell(r);
}
return table;
}
示例15: process
import com.itextpdf.text.pdf.PdfPTable; //導入方法依賴的package包/類
public List<Element> process(SourceCode sourceCode) {
String lang = sourceCode.lang();
String content = sourceCode.content();
boolean linenos = sourceCode.showLineNumbers();
Tokens tokens = pygments.tokenize(lang, content);
Paragraph p = new Paragraph();
for (TokenWithValue token : tokens) {
Style style = styleSheet.styleOf(token.token);
BaseColor color = toColor(style.fg());
int s = calculateStyle(style);
Font font = styles.getFont(Styles.CODE_FONT, s, color).get();
Chunk o = new Chunk(token.value, font);
RGB bg = style.bg();
if (bg != null)
o.setBackground(toColor(bg));
p.add(o);
}
PdfPCell cell = new PdfPCell(p);
cell.setPaddingBottom(5.0f);
cell.setBorder(Rectangle.NO_BORDER);
PdfPTable table = new PdfPTable(1);
table.addCell(cell);
table.setSpacingBefore(5.0f);
table.setSpacingAfter(5.0f);
table.setTableEvent(new TableBackground(toColor(styleSheet.backgroundColor())));
return Arrays.<Element>asList(table);
}