- g.drawString(text, x, (float)(y+rect.getHeight()));\r
- g.setTransform(at);\r
-// } else {\r
- /*\r
- try {\r
- // Write to PDF\r
- FontMapper mapper = (FontMapper) g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_FONTMAPPER);\r
- //text.setBorderStyle(PdfBorderDictionary.STYLE_BEVELED);\r
- AffineTransform at = g.getTransform();\r
- FontMetrics fm = g.getFontMetrics(font);\r
- Rectangle2D rect = fm.getStringBounds(text, g);\r
- float x = (float) ((bounds.getWidth() - rect.getWidth())/2 + bounds.getMinX());\r
- float y = (float) ((bounds.getHeight() - rect.getHeight())/2 + bounds.getMinY());\r
- \r
- Point2D pt1 = at.transform(new Point2D.Float(x, y+(float)rect.getHeight()), null);\r
- Point2D pt2 = at.transform(new Point2D.Float(x+(float)rect.getWidth(), y), null);\r
- Rectangle rectangle = new Rectangle(\r
- (float) pt1.getX(), \r
- (float) pt1.getY(), \r
- (float) pt2.getX(), \r
- (float) pt2.getY()); \r
- TextField text = new TextField(writer, rectangle, "approvedBy");\r
- text.setText(this.text);\r
- text.setFont(mapper.awtToPdf(font));\r
- text.setFontSize(0);\r
- text.setAlignment(Element.ALIGN_LEFT);\r
- text.setRotation(90);\r
- text.setOptions(TextField.READ_ONLY);\r
- PdfFormField field = text.getTextField();\r
- writer.addAnnotation(field);\r
- } catch (IOException e) {\r
- e.printStackTrace();\r
- } catch (DocumentException e) {\r
- e.printStackTrace();\r
- }\r
- */\r
+ g.drawString(text, x, (float)(y+rect.getHeight()));
+ g.setTransform(at);
+// } else {
+ /*
+ try {
+ // Write to PDF
+ FontMapper mapper = (FontMapper) g.getRenderingHint(G2DPDFRenderingHints.KEY_PDF_FONTMAPPER);
+ //text.setBorderStyle(PdfBorderDictionary.STYLE_BEVELED);
+ AffineTransform at = g.getTransform();
+ FontMetrics fm = g.getFontMetrics(font);
+ Rectangle2D rect = fm.getStringBounds(text, g);
+ float x = (float) ((bounds.getWidth() - rect.getWidth())/2 + bounds.getMinX());
+ float y = (float) ((bounds.getHeight() - rect.getHeight())/2 + bounds.getMinY());
+
+ Point2D pt1 = at.transform(new Point2D.Float(x, y+(float)rect.getHeight()), null);
+ Point2D pt2 = at.transform(new Point2D.Float(x+(float)rect.getWidth(), y), null);
+ Rectangle rectangle = new Rectangle(
+ (float) pt1.getX(),
+ (float) pt1.getY(),
+ (float) pt2.getX(),
+ (float) pt2.getY());
+ TextField text = new TextField(writer, rectangle, "approvedBy");
+ text.setText(this.text);
+ text.setFont(mapper.awtToPdf(font));
+ text.setFontSize(0);
+ text.setAlignment(Element.ALIGN_LEFT);
+ text.setRotation(90);
+ text.setOptions(TextField.READ_ONLY);
+ PdfFormField field = text.getTextField();
+ writer.addAnnotation(field);
+ } catch (IOException e) {
+ e.printStackTrace();
+ } catch (DocumentException e) {
+ e.printStackTrace();
+ }
+ */