Пример #1
0
  /**
   * This method creat Mark whit proporshin
   *
   * @param content - where we write
   * @param x - lower left x
   * @param y - lower left y
   * @param size - size of mark
   */
  public static void markCircle(PdfContentByte content, int x, int y, int size) {
    // Proportion 1:1:3:1:1
    int sizeStep = size / 7;
    int center = size / 2;
    if (sizeStep < 1) {
      try {
        throw new IllegalArgumentException("Marker must be aliquot 7");
      } catch (Exception e) {
        e.printStackTrace();
      }
    } else {

      content.circle(x, y, center);
      content.fill();
      // content.setRGBColorFill(0x00, 0x00, 0x00);
      content.setRGBColorStroke(0xFF, 0xFF, 0xFF);
      content.setLineWidth(sizeStep);
      content.circle(x, y, (float) (center - (sizeStep * 1.5)));

      //            content.setRGBColorFill(0xFF, 0xFF, 0xFF);
      //            content.setLineWidth(10f);
      //            content.circle(350.0f, 300.0f, 50.0f);

      content.fillStroke();
    }
  }
Пример #2
0
 public void encodeHeaderBox(PdfContentByte directContent, Bounds bounds, String title) {
   setFillColorBlack(directContent);
   Bounds headerBounds = calculateHeaderBounds(bounds);
   directContent.rectangle(
       headerBounds.x + ARCSPACE,
       headerBounds.y,
       headerBounds.width - 2 * ARCSPACE,
       headerBounds.height);
   directContent.arc(
       headerBounds.x,
       headerBounds.y,
       headerBounds.x + 2 * ARCSPACE,
       headerBounds.y + headerBounds.height,
       0,
       360);
   directContent.arc(
       headerBounds.getMaxX(),
       headerBounds.y,
       headerBounds.getMaxX() - 2 * ARCSPACE,
       headerBounds.getMaxY(),
       0,
       360);
   directContent.fillStroke();
   setFillColorWhite(directContent);
   directContent.setFontAndSize(baseFont, HEADER_FONT_SIZE);
   directContent.beginText();
   directContent.showTextAligned(
       PdfContentByte.ALIGN_CENTER,
       title,
       (int) headerBounds.getCenterX(),
       headerBounds.y + HEADER_FONT_PADDING,
       0);
   directContent.endText();
 }