class_docstr: default setting for report constants
docstr: parse html and write to PDF report
  
  Args:
       html(str): html content
       link (int): link idx created earlier for internal anchor
docstr_tok: ["parse","html","and","write","to","PDF","report","Args",":","html","(","str",")",":","html","content","link","(","int",")",":","link","idx","created","earlier","for","internal","anchor"]
code: def write_html(self, html, link=None):
      """
      parse html and write to PDF report
  
      Args:
           html(str): html content
           link (int): link idx created earlier for internal anchor
      """
      if link is None:
          link = ""
  
      def set_style(tag, enable):
          # Modify style and select corresponding font
          t = getattr(self, tag.lower())
          if enable:
              t += 1
          else:
              t -= 1
          setattr(self, tag.lower(), t)
          style = ""
          for s in ("B", "I", "U"):
              if getattr(self, s.lower()) > 0:
                  style += s
          self.set_font("", style)
  
      def open_tag(tag, attr):
          # Opening tag
          if tag in ("B", "I", "U"):
              set_style(tag, 1)
          if tag == "A":
              self.href = attr["HREF"]
          if tag == "BR":
              self.ln(5)
  
      def close_tag(tag):
          # Closing tag
          if tag in ("B", "I", "U"):
              set_style(tag, 0)
          if tag == "A":
              self.href = ""
  
      def put_link(url, txt):
          # Put a hyperlink
          self.set_text_color(0, 0, 255)
          set_style("U", 1)
          self.write(5, txt, url)
          set_style("U", 0)
          self.set_text_color(0)
  
      # HTML parser
      html = html.replace("\n", " ")
      a = re.split("<(.*?)>", html)
      for i, e in enumerate(a):
          if i % 2 == 0:
              # Text
              if self.href:
                  put_link(self.href, e)
              else:
                  self.write(5, e, link=link)
          else:
              # Tag
              if e[0] == "/":
                  close_tag(e[1:].upper())
              else:
                  # Extract attributes
                  attr = {}
                  a2 = e.split(" ")
                  tag = a2.pop(0).upper()
                  for v in a2:
                      a3 = re.findall(
                          """^([^=]*)=["']?([^"']*)["']?""", v
                      )
                      if a3:
                          attr[a3[0].upper()] = a3[1]
                  open_tag(tag, attr)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import warnings
  import datetime
  import re
  from fpdf import FPDF
label_desc: Use image node_id 11 for calling the CustomPdf obj's underlying member method code with example usage: obj.write_html(html, link) without return types