parameters: (dD, geometriesList, paperSize, wantBindingOffset)
docstring: This is the experimental replacement paper size setting function.
  
      Each paper size and other associated data are stored in a dictionary.
      The dictionaries are stored in a list. We copy appropriate dictionary
      and custom calculations into a work dictionary for use.
      The advantage of this is its easier to add new paper definitions.
      Returns a new dictionary, use .update to merge in new values into dD.
docstring_summary: This is the experimental replacement paper size setting function.
docstring_tokens: This is the experimental replacement paper size setting function .
function: def set_page_geometry(dD, geometriesList, paperSize, wantBindingOffset):
      """This is the experimental replacement paper size setting function.
  
      Each paper size and other associated data are stored in a dictionary.
      The dictionaries are stored in a list. We copy appropriate dictionary
      and custom calculations into a work dictionary for use.
      The advantage of this is its easier to add new paper definitions.
      Returns a new dictionary, use .update to merge in new values into dD.
      """
      try:
          result={}
          for i in geometriesList:
              if i['paperName'] == paperSize:
                  dD.update(i)
  
          result['paperLeftMarginOdd'] = dD['paperLeftMargin'] + \
                                         dD['paperBinding']
          result['paperRightMarginEven'] = dD['paperRightMargin'] + \
                                           dD['paperBinding']
          result['paperTextHeight'] = dD['paperHeight'] - \
                                      dD['paperTopMargin'] - \
                                      dD['paperBottomMargin']
          result['paperMargins'] =  dD['paperLeftMargin'],dD['paperRightMargin'],dD['paperTopMargin'],dD['paperBottomMargin']
  
          # if we are adding a binding offset to the margins then we will have less width for our text...
          if wantBindingOffset:
              result['paperTextWidth'] = dD['paperWidth'] - \
                                         dD['paperLeftMargin'] - \
                                         dD['paperRightMargin'] - \
                                         dD['paperBinding'] - \
                                         2
          else:
              result['paperTextWidth'] = dD['paperWidth'] - \
                                         dD['paperLeftMargin'] - \
                                         dD['paperRightMargin'] - \
                                         2
          return result
      except:
          errorMessage = 'set_page_geometry() failure: %s' % sys.exc_info()[1]
          print errorMessage
function_tokens: def set_page_geometry ( dD , geometriesList , paperSize , wantBindingOffset ) : try : result = { } for i in geometriesList : if i [ 'paperName' ] == paperSize : dD . update ( i ) result [ 'paperLeftMarginOdd' ] = dD [ 'paperLeftMargin' ] + dD [ 'paperBinding' ] result [ 'paperRightMarginEven' ] = dD [ 'paperRightMargin' ] + dD [ 'paperBinding' ] result [ 'paperTextHeight' ] = dD [ 'paperHeight' ] - dD [ 'paperTopMargin' ] - dD [ 'paperBottomMargin' ] result [ 'paperMargins' ] = dD [ 'paperLeftMargin' ] , dD [ 'paperRightMargin' ] , dD [ 'paperTopMargin' ] , dD [ 'paperBottomMargin' ] # if we are adding a binding offset to the margins then we will have less width for our text... if wantBindingOffset : result [ 'paperTextWidth' ] = dD [ 'paperWidth' ] - dD [ 'paperLeftMargin' ] - dD [ 'paperRightMargin' ] - dD [ 'paperBinding' ] - 2 else : result [ 'paperTextWidth' ] = dD [ 'paperWidth' ] - dD [ 'paperLeftMargin' ] - dD [ 'paperRightMargin' ] - 2 return result except : errorMessage = 'set_page_geometry() failure: %s' % sys . exc_info ( ) [ 1 ] print errorMessage