use of com.itextpdf.layout.element.Paragraph in project digilib by robcast.
the class PDFTitlePage method createPage.
/**
* Add the the title page to the PDF Document.
*
* @return
*/
public Document createPage(Document content) {
/*
* header with logo
*/
Table headerBlock = new Table(UnitValue.createPercentArray(new float[] { 20, 80 }));
Image logo = getLogo();
if (logo != null) {
logo.setWidth(UnitValue.createPercentValue(100));
headerBlock.addCell(new Cell().add(logo).setBorderRight(null));
}
String headerText = getHeaderTitle();
if (!headerText.isEmpty()) {
Cell textCell = new Cell().setBorderLeft(null).setPaddingLeft(12).add(new Paragraph(headerText).setBold());
String headerSubtext = getHeaderSubtitle();
if (headerSubtext != null) {
textCell.add(new Paragraph(headerSubtext));
}
headerBlock.addCell(textCell);
}
content.add(headerBlock.setMarginBottom(24));
String reference = getReference();
if (!reference.isEmpty()) {
/*
* full reference
*/
content.add(new Paragraph(reference));
} else {
/*
* author
*/
String author = getAuthor();
if (!author.isEmpty()) {
content.add(new Paragraph(author).setTextAlignment(TextAlignment.CENTER));
}
/*
* title
*/
String title = getTitle();
if (!title.isEmpty()) {
content.add(new Paragraph(title).setTextAlignment(TextAlignment.CENTER));
}
/*
* date
*/
String date = getDate();
if (!date.isEmpty()) {
content.add(new Paragraph(date).setTextAlignment(TextAlignment.CENTER));
}
}
/*
* page numbers
*/
content.add(new Paragraph(getPages()).setTextAlignment(TextAlignment.CENTER));
/*
* URL
*/
try {
content.add(new Paragraph().setTextAlignment(TextAlignment.CENTER).setFont(PdfFontFactory.createFont(StandardFonts.COURIER)).setFontSize(10).add(new Link(getUrl(), PdfAction.createURI(getUrl()))).setFixedPosition(24, 24, UnitValue.createPercentValue(98)));
} catch (IOException e) {
logger.error("{}", e);
}
return content;
}
use of com.itextpdf.layout.element.Paragraph in project betca-tpv-spring by miw-upm.
the class PdfTicketBuilder method qrCode.
public PdfTicketBuilder qrCode(String code) {
BarcodeQRCode qrcode = new BarcodeQRCode(code.trim());
Image qrcodeImage = new Image(qrcode.createFormXObject(this.getDocument().getPdfDocument()));
qrcodeImage.setHorizontalAlignment(HorizontalAlignment.CENTER);
qrcodeImage.setWidthPercent(50);
this.getDocument().add(qrcodeImage);
Paragraph paragraph = new Paragraph("Ref. " + code);
paragraph.setTextAlignment(TextAlignment.CENTER);
this.getDocument().add(paragraph);
return this;
}
use of com.itextpdf.layout.element.Paragraph in project ComponentManagement by Bac3Phi.
the class InventoriesReportController method addInfo.
private void addInfo(String strinfo, Document document) throws IOException {
Paragraph info = new Paragraph(strinfo);
// Setting font of the text
PdfFont font = PdfFontFactory.createFont(FontConstants.TIMES_ROMAN);
info.setFont(font);
info.setFontSize(12);
info.setTextAlignment(TextAlignment.LEFT);
info.setPaddingLeft(25);
document.add(info);
}
use of com.itextpdf.layout.element.Paragraph in project ComponentManagement by Bac3Phi.
the class ReportInventoriesController method addInfo.
private void addInfo(String strinfo, Document document) throws IOException {
Paragraph info = new Paragraph(strinfo);
// Setting font of the text
info.setFont(font);
info.setFontSize(12);
info.setTextAlignment(TextAlignment.LEFT);
info.setPaddingLeft(25);
document.add(info);
}
use of com.itextpdf.layout.element.Paragraph in project ComponentManagement by Bac3Phi.
the class ReportInventoriesController method addDate.
private void addDate(Document document) throws IOException {
Paragraph date;
date = new Paragraph("Tháng: " + cbbMonth.getSelectionModel().getSelectedItem() + "/2018");
date.setFont(font);
date.setFontSize(12);
date.setTextAlignment(TextAlignment.CENTER);
document.add(date);
}
Aggregations