1 package org.simantics.document.linking.report.pdf;
5 import org.simantics.document.linking.report.DocumentLine;
6 import org.simantics.document.linking.report.DocumentTitlePage;
7 import org.simantics.document.linking.report.Table;
8 import org.simantics.document.linking.report.Document.TextSize;
9 import org.simantics.document.linking.report.TableColumn.Alignment;
12 public class PDFTitlePage extends DocumentTitlePage implements PDFElement {
16 public PDFTitlePage(PDFDocument writer) {
17 this.document = writer;
21 public PDFPage getPage() {
26 public void writeTitle(List<DocumentLine> titleLines) throws Exception {
27 Alignment alignment = (Alignment)titleLines.get(0).getHints().get(Alignment.class);
28 if (alignment == null)
29 alignment = Alignment.CENTER;
30 TextSize textSize = (TextSize)titleLines.get(0).getHints().get(TextSize.class);
32 textSize = TextSize.HUGE;
35 this.page = document.contentStream.getCurrentPage();
36 Table table = document.newElement(Table.class);
37 table.addColumn("Names", 1.0).setAlignment(alignment);
38 table.setLinesVisible(false);
39 table.setHeaderVisible(false);
40 table.setTextSize(textSize);
41 int lines = (document.contentStream.getAvailableLines()-3)/2;
42 for (int i = 0; i < lines; i++)
44 for (DocumentLine line : titleLines) {
45 TextSize s = (TextSize)line.getHints().get(TextSize.class);
48 table.setTextSize(textSize);
49 table.writeRow(line.getLine());
51 table.setTextSize(TextSize.SMALL);
52 table.setLinesVisible(true);
53 table.setHeaderVisible(true);