code: def close(self):
          "Terminate document"
          if(self.state==3):
              return
          if(self.page==0):
              self.add_page()
          #Page footer
          self.in_footer=1
          self.footer()
          self.in_footer=0
          #close page
          self._endpage()
          #close document
          self._enddoc(f close(self):
          "Terminate document"
          if(self.state==3):
              return
          if(self.page==0):
              self.add_page()
          #Page footer
          self.in_footer=1
          self.footer()
          self.in_footer=0
          #close page
          self._endpage()
          #close document
          self._enddoc()
docs: Terminate document