本文整理汇总了Java中rst.pdfbox.layout.elements.render.VerticalLayoutHint类的典型用法代码示例。如果您正苦于以下问题:Java VerticalLayoutHint类的具体用法?Java VerticalLayoutHint怎么用?Java VerticalLayoutHint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
VerticalLayoutHint类属于rst.pdfbox.layout.elements.render包,在下文中一共展示了VerticalLayoutHint类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: render
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
@Override
public boolean render(RenderContext renderContext, Element element,
LayoutHint layoutHint) throws IOException {
if (element instanceof Section) {
if (renderContext.getPageIndex() > 0) {
// no new page on first page ;-)
renderContext.newPage();
}
sectionNumber = ((Section)element).getNumber();
renderContext.render(renderContext, element, layoutHint);
Element ruler = new HorizontalRuler(Stroke.builder().lineWidth(2)
.capStyle(CapStyle.RoundCap).build(), Color.black);
renderContext.render(renderContext, ruler, VerticalLayoutHint.builder().marginBottom(10).build());
return true;
}
return false;
}
示例2: writeAttributes
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
private void writeAttributes() throws IOException {
List<InstanceAttribute> instanceAttributes = data.getInstanceAttributes();
if (!instanceAttributes.isEmpty()) {
resetLayout();
drawHorizontalSeparator();
Paragraph mapTitle = new Paragraph();
mapTitle.addText(data.getBundleString("attributes"), TITLE_MAP_SIZE, TEXT_BOLD_FONT);
breakLine(mapTitle);
document.add(mapTitle, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, MAP_TITLE_MARGIN_BOTTOM));
InstanceAttribute headerAttribute = new InstanceTextAttribute(
data.getBundleString("attributes.name"),
data.getBundleString("attributes.value"),
false
);
writeAttribute(headerAttribute, true);
for (InstanceAttribute attr : instanceAttributes) {
writeAttribute(attr, false);
}
}
}
示例3: drawWorkflow
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
private void drawWorkflow(Workflow workflow) throws IOException {
if (workflow != null) {
resetLayout();
drawHorizontalSeparator();
Paragraph paragraph = new Paragraph();
paragraph.addText(data.getBundleString("lifecycle"), TITLE_MAP_SIZE, TEXT_BOLD_FONT);
document.add(paragraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 10));
for (Activity activity : workflow.getActivities()) {
drawActivity(activity);
}
}
}
示例4: render
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
@Override
public void render(Document target, int indent, CertificateStyle style) throws IOException {
Paragraph paragraph = new Paragraph() {
@Override public float getHeight() throws IOException {
return super.getHeight() * 2f;
}
};
paragraph.setAlignment(style.getTitleAlignment());
paragraph.addText(text, style.getTitleSize(), style.getTitleFont().getBoldFont());
target.add(paragraph, VerticalLayoutHint.LEFT);
}
示例5: writeEntityInfo
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
private void writeEntityInfo() throws IOException {
Paragraph titleParagraph = new Paragraph();
titleParagraph.addText(data.getTitle(), DOCUMENT_TITLE_SIZE, TEXT_BOLD_FONT);
document.add(titleParagraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, TITLE_MARGIN_BOTTOM));
Paragraph paragraph = new Paragraph();
paragraph.addText(data.getBundleString("original.author"), TEXT_SIZE, TEXT_BOLD_FONT);
space(paragraph);
paragraph.addText(data.getAuthorName(), TEXT_SIZE, TEXT_REGULAR_FONT);
breakLine(paragraph);
paragraph.addText(data.getBundleString("iteration.date"), TEXT_SIZE, TEXT_BOLD_FONT);
space(paragraph);
paragraph.addText(data.getCreationDate(), TEXT_SIZE, TEXT_REGULAR_FONT);
breakLine(paragraph);
paragraph.addText(data.getBundleString("iteration"), TEXT_SIZE, TEXT_BOLD_FONT);
space(paragraph);
paragraph.addText(data.getCurrentIteration(), TEXT_SIZE, TEXT_REGULAR_FONT);
breakLine(paragraph);
paragraph.addText(data.getBundleString("iteration.date"), TEXT_SIZE, TEXT_BOLD_FONT);
space(paragraph);
paragraph.addText(data.getIterationDate(), TEXT_SIZE, TEXT_REGULAR_FONT);
breakLine(paragraph);
String revisionNote = data.getRevisionNote();
if (revisionNote != null) {
paragraph.addText(data.getBundleString("iteration.note"), TEXT_SIZE, TEXT_BOLD_FONT);
space(paragraph);
paragraph.addText(revisionNote, TEXT_SIZE, TEXT_REGULAR_FONT);
}
document.add(paragraph, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 5));
String description = data.getDescription();
if (description != null && !description.isEmpty()) {
drawLightHorizontalSeparator();
Paragraph descriptionParagraph = new Paragraph();
descriptionParagraph.addText(description, TEXT_SIZE, TEXT_ITALIC_FONT);
document.add(descriptionParagraph);
}
}
示例6: drawTask
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
private void drawTask(Task task) throws IOException {
String iconMessage;
String taskMessage;
switch (task.getStatus()) {
case APPROVED:
iconMessage = "\uf00c";
taskMessage = data.getBundleString("lifecycle.approved");
break;
case REJECTED:
iconMessage = "\uf00d";
taskMessage = data.getBundleString("lifecycle.rejected");
break;
default:
// Dont draw other tasks status
return;
}
Paragraph left = new Paragraph();
document.add(new ColumnLayout(2, CELLS_SPACING));
left.addText(iconMessage, TEXT_SIZE, iconFont);
space(left);
left.addText(task.getTitle(), TEXT_SIZE, TEXT_BOLD_FONT);
document.add(left, new VerticalLayoutHint(Alignment.Left, 0, 0, 0, 0));
document.add(ColumnLayout.NEWCOLUMN);
Date closureDate = task.getClosureDate();
Paragraph right = new Paragraph();
if (closureDate != null) {
right.addText(data.format(closureDate), TEXT_SIZE, TEXT_ITALIC_FONT);
}
document.add(right, new VerticalLayoutHint(Alignment.Right, 0, 0, 0, 0));
resetLayout();
document.add(new ColumnLayout(4, CELLS_SPACING));
Paragraph taskDetailsLeft = new Paragraph();
taskDetailsLeft.addText(taskMessage, TEXT_SIZE, TEXT_ITALIC_FONT);
space(taskDetailsLeft);
taskDetailsLeft.addText(task.getWorker().getName(), TEXT_SIZE, TEXT_BOLD_FONT);
document.add(taskDetailsLeft, new VerticalLayoutHint(Alignment.Left, 0, 0, 10, 10));
document.add(ColumnLayout.NEWCOLUMN);
Paragraph taskDetailsRight = new Paragraph();
taskDetailsRight.addText(task.getClosureComment(), SMALL_TEXT_SIZE, TEXT_ITALIC_FONT);
document.add(taskDetailsRight, new VerticalLayoutHint(Alignment.Left, 0, 0, 10, 10));
taskDetailsRight.setMaxWidth(360.0f);
resetLayout();
}
示例7: main
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
String text1 = "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, "
+ "sed diam nonumy eirmod tempor invidunt ut labore et dolore magna "
+ "aliquyam erat, _sed diam_ voluptua. At vero eos et *accusam et justo* "
+ "duo dolores et ea rebum.\n\nStet clita kasd gubergren, no sea takimata "
+ "sanctus est *Lorem ipsum _dolor* sit_ amet. Lorem ipsum dolor sit amet, "
+ "consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt "
+ "ut labore et dolore magna aliquyam erat, *sed diam voluptua.\n\n"
+ "At vero eos et accusam* et justo duo dolores et ea rebum. Stet clita kasd "
+ "gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\n\n";
String text2 = "At *vero eos et accusam* et justo duo dolores et ea rebum. "
+ "Stet clita kasd gubergren, no sea takimata\n\n"
+ "sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, "
+ "_consetetur sadipscing elitr_, sed diam nonumy eirmod tempor invidunt "
+ "ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero "
+ "eos et _accusam et *justo* duo dolores_ et ea rebum. Stet clita kasd "
+ "gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.\n";
Document document = new Document(40, 50, 40, 60);
Paragraph title = new Paragraph();
title.addMarkup("*This Text is organized in Colums*", 20, BaseFont.Times);
document.add(title, VerticalLayoutHint.CENTER);
document.add(new VerticalSpacer(5));
// use column layout from now on
document.add(new ColumnLayout(2, 10));
Paragraph paragraph1 = new Paragraph();
paragraph1.addMarkup(text1, 11, BaseFont.Times);
document.add(paragraph1);
Paragraph paragraph2 = new Paragraph();
paragraph2.addMarkup(text2, 12, BaseFont.Helvetica);
document.add(paragraph2);
Paragraph paragraph3 = new Paragraph();
paragraph3.addMarkup(text1, 8, BaseFont.Courier);
document.add(paragraph3);
document.add(paragraph1);
document.add(paragraph3);
document.add(paragraph1);
document.add(paragraph2);
document.add(paragraph1);
document.add(paragraph3);
document.add(paragraph2);
document.add(paragraph1);
document.add(paragraph1);
document.add(paragraph3);
document.add(paragraph2);
document.add(paragraph2);
document.add(paragraph3);
document.add(paragraph1);
document.add(paragraph1);
document.add(paragraph2);
document.add(paragraph1);
document.add(paragraph3);
document.add(paragraph2);
document.add(paragraph3);
document.add(paragraph1);
document.add(paragraph1);
document.add(paragraph3);
document.add(paragraph2);
document.add(paragraph2);
final OutputStream outputStream = new FileOutputStream(
"columns.pdf");
document.save(outputStream);
}
示例8: add
import rst.pdfbox.layout.elements.render.VerticalLayoutHint; //导入依赖的package包/类
/**
* Adds an element to the document using a {@link VerticalLayoutHint}.
*
* @param element
* the element to add
*/
public void add(final Element element) {
add(element, new VerticalLayoutHint());
}