Package pt.opensoft.xml

Examples of pt.opensoft.xml.JdomElement


    replaceAll(cb, reader, currentPage, values, fieldsWithSpecialFont, fieldsWithColors, null);
  }

  public void replaceAll(PdfContentByte cb, PdfReader reader, int currentPage, Map values, Map fieldsWithSpecialFont, Map fieldsWithColors, PDFRenderer pdfRender) throws DocumentException, IOException {

    JdomElement doc = new JdomElement(_metadata.getRootElement());
    GlobalConfig globalData = getGlobalConfig(doc);

    List fields = doc.getChildren("Field");
    for (Iterator iterator = fields.iterator(); iterator.hasNext();) {
      JdomElement element = (JdomElement) iterator.next();
      if (element.getAttributeValue("isPhrase", "false").equals("true")) {
        Phrase phrase = (Phrase) values.get(element.getChild("Name").getString());
        JdomElement _sampleAttr = element.getChild("Sample");
        if ((phrase == null) && (_sampleAttr == null)) continue;
        if (phrase == null) {
          phrase = new Phrase(_sampleAttr.getString());
        }

        ColumnText column = new ColumnText(cb);
        column.addText(phrase);
        int status = 0;
View Full Code Here


          throws DocumentException, IOException {

    // No caso de se tratar de uma string vazia n�o � necess�rio efectuar o add do template
    if ((value != null) && (value.trim().equals(""))) return;

    JdomElement _sampleAttr = element.getChild("Sample");
    // No caso de n�o existir valor no ListMap e no sample n�o se efectua o add do template
    if ((value == null) && (_sampleAttr == null)) return;

    int width = element.getChild("Width").getIntValue();
    int height = element.getChild("Height").getIntValue();
    int fontSize = element.getChild("FontSize", globalData.fontSize).getIntValue();

    BaseFont bf;
    if (font != null) {
      bf = font;
    } else {
      String fontName = element.getChild("Font", globalData.font).getString();
      bf = BaseFont.createFont(fontName, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
    }
    PdfTemplate template = cb.createTemplate(width, height);

    template.beginText();
    template.setFontAndSize(bf, fontSize);
    if (color != null) {
      template.setColorFill(color);
    }

    String text = transform(
            value == null ? _sampleAttr.getString() : value,
            element.getChild("Type").getString(),
            element.getChild("Format") != null ? element.getChild("Format").getString() : null);

    int alignCode = getAlignCode(element.getChild("HAlign"));
    switch (alignCode) {
View Full Code Here

          throws DocumentException, IOException {

    // No caso de se tratar de uma string vazia n�o � necess�rio efectuar o add do template
    if ((value != null) && (value.trim().equals(""))) return;

    JdomElement _sampleAttr = element.getChild("Sample");
    // No caso de n�o existir valor no ListMap e no sample n�o se efectua o add do template
    if ((value == null) && (_sampleAttr == null)) return;

    int width = element.getChild("Width").getIntValue();
    int height = element.getChild("Height").getIntValue();
    int fontSize = element.getChild("FontSize", globalData.fontSize).getIntValue();
    String fontName = element.getChild("Font", globalData.font).getString();

    BaseFont bf;
    if (valueFont != null) {
      bf = valueFont;
    } else {
      bf = BaseFont.createFont(fontName, BaseFont.CP1252, BaseFont.NOT_EMBEDDED);
    }
    Font font = new Font(bf, fontSize, Font.NORMAL);

    String text = transform(value == null ? _sampleAttr.getString() : value,
            element.getChild("Type").getString(),
            element.getChild("Format") != null ? element.getChild("Format").getString() : null);

    Rectangle pageSize = reader.getPageSizeWithRotation(currentPage);
View Full Code Here

TOP

Related Classes of pt.opensoft.xml.JdomElement

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.