예제 #1
0
  public void setHeader(Document document, String clientName)
      throws DocumentException, IOException {

    LineSeparator line = new LineSeparator(1, 80, null, Element.ALIGN_CENTER, -5);

    Image img = Image.getInstance(getClass().getResource("img/LISLogo.png"));
    // Image img = Image.getInstance("img/LISLogo.png");
    img.scaleAbsoluteHeight(80);
    img.scaleAbsoluteWidth(200);
    img.setAlignment(Element.ALIGN_CENTER);

    Paragraph clientNameParagraph = new Paragraph();
    clientNameParagraph.setAlignment(Element.ALIGN_CENTER);
    clientNameParagraph.add(clientName);
    clientNameParagraph.setSpacingAfter(12);

    Paragraph investmentRecommendations = new Paragraph("Your Legacy Investment Income Portfolio");
    investmentRecommendations.setAlignment(Element.ALIGN_CENTER);
    investmentRecommendations.add(line);
    investmentRecommendations.setSpacingAfter(4);

    document.add(clientNameParagraph);
    document.add(investmentRecommendations);
    document.add(img);
  }