use of com.itextpdf.layout.element.LineSeparator in project betca-tpv-core by miw-upm.
the class PdfCoreBuilder method line.
public PdfCoreBuilder line() {
DottedLine separator = new DottedLine();
separator.setGap(LINE_GAP);
separator.setLineWidth(LINE_WIDTH);
document.add(new LineSeparator(separator));
return this;
}
use of com.itextpdf.layout.element.LineSeparator in project i7js-highlevel by itext.
the class JekyllHydeV5 method createPdf.
public void createPdf(String dest) throws IOException {
// Initialize PDF document
PdfDocument pdf = new PdfDocument(new PdfWriter(dest));
// Initialize document
Document document = new Document(pdf);
PdfFont font = PdfFontFactory.createFont(StandardFonts.TIMES_ROMAN);
PdfFont bold = PdfFontFactory.createFont(StandardFonts.HELVETICA_BOLD);
document.setTextAlignment(TextAlignment.JUSTIFIED).setHyphenation(new HyphenationConfig("en", "uk", 3, 3));
BufferedReader br = new BufferedReader(new FileReader(SRC));
LineSeparator separator = new LineSeparator(new DottedLine(2f, 5f));
separator.setMarginLeft(10);
separator.setMarginRight(10);
boolean chapter = false;
Div div = new Div();
String line;
while ((line = br.readLine()) != null) {
div = new Div().setFont(font).setFontSize(11).setMarginBottom(18);
div.add(new Paragraph(line).setFont(bold).setFontSize(12).setMarginBottom(0));
while ((line = br.readLine()) != null) {
div.add(new Paragraph(line).setMarginBottom(0).setFirstLineIndent(36));
if (line.isEmpty()) {
if (chapter) {
div.add(separator);
}
document.add(div);
div = new Div();
chapter = true;
break;
}
}
}
document.add(div);
// Close document
document.close();
}
use of com.itextpdf.layout.element.LineSeparator in project betca-tpv-spring by miw-upm.
the class PdfTicketBuilder method line.
public PdfTicketBuilder line() {
DottedLine separator = new DottedLine();
separator.setGap(LINE_GAP);
separator.setLineWidth(LINE_WIDTH);
this.getDocument().add(new LineSeparator(separator));
return this;
}
Aggregations