Exemplo n.º 1
0
 /* (non-Javadoc)
  * @see com.itextpdf.html2pdf.attach.ITagWorker#getElementResult()
  */
 public override IPropertyContainer GetElementResult()
 {
     if (formField == null)
     {
         if (hasChildren)
         {
             ButtonContainer button = new ButtonContainer(name);
             Div             div    = (Div)base.GetElementResult();
             foreach (IElement element in div.GetChildren())
             {
                 if (element is IBlockElement)
                 {
                     button.Add((IBlockElement)element);
                 }
                 else
                 {
                     if (element is Image)
                     {
                         button.Add((Image)element);
                     }
                 }
             }
             div.GetChildren().Clear();
             formField = button;
         }
         else
         {
             Button inputButton = new Button(name);
             inputButton.SetProperty(Html2PdfProperty.FORM_FIELD_VALUE, fallbackContent.ToString().Trim());
             formField = inputButton;
         }
     }
     formField.SetProperty(Html2PdfProperty.FORM_FIELD_FLATTEN, flatten);
     return(formField);
 }
Exemplo n.º 2
0
 /* (non-Javadoc)
  * @see com.itextpdf.html2pdf.attach.ITagWorker#getElementResult()
  */
 public override IPropertyContainer GetElementResult()
 {
     if (formField == null)
     {
         if (hasChildren)
         {
             Button button = new Button(name);
             button.SetProperty(Html2PdfProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
             Div div = (Div)base.GetElementResult();
             foreach (IElement element in div.GetChildren())
             {
                 if (element is IAccessibleElement)
                 {
                     AccessiblePropHelper.TrySetLangAttribute((IAccessibleElement)element, lang);
                 }
                 if (element is IBlockElement)
                 {
                     button.Add((IBlockElement)element);
                 }
                 else
                 {
                     if (element is Image)
                     {
                         button.Add((Image)element);
                     }
                 }
             }
             div.GetChildren().Clear();
             formField = button;
         }
         else
         {
             InputButton inputButton = new InputButton(name);
             inputButton.SetProperty(Html2PdfProperty.FORM_ACCESSIBILITY_LANGUAGE, lang);
             inputButton.SetProperty(Html2PdfProperty.FORM_FIELD_VALUE, fallbackContent.ToString().Trim());
             formField = inputButton;
         }
     }
     formField.SetProperty(Html2PdfProperty.FORM_FIELD_FLATTEN, flatten);
     return(formField);
 }