(colpos, rowpos)
return grid
Create a page grid from list of column positions <colpos> and a list of row positions <rowpos>.
    Both positions lists must be sorted from low to high!
    The returned page grid is a list of rows. Each row in turn contains a "grid cell",
    i.e. a rect (see pdftabextract.geom).
Create a page grid from list of column positions <colpos> and a list of row positions <rowpos>.
    Both positions lists must be sorted from low to high!
    The returned page grid is a list of rows. Each row in turn contains a "grid cell",
    i.e. a rect (see pdftabextract.geom).
Create a page grid from list of column positions <colpos > and a list of row positions <rowpos > . Both positions lists must be sorted from low to high! The returned page grid is a list of rows . Each row in turn contains a grid cell i . e . a rect ( see pdftabextract . geom ) .
def make_grid_from_positions(colpos, rowpos):
    """
    Create a page grid from list of column positions <colpos> and a list of row positions <rowpos>.
    Both positions lists must be sorted from low to high!
    The returned page grid is a list of rows. Each row in turn contains a "grid cell",
    i.e. a rect (see pdftabextract.geom).
    """
    if len(colpos) == 0:
        raise ValueError("List of column positions is empty.")
    if len(rowpos) == 0:
        raise ValueError("List of row positions is empty.")
    
    row_spans = subsequent_pairs(rowpos)
    col_spans = subsequent_pairs(colpos)    
    
    # create a grid with rectangles of table cells
    grid = []
    
    for top, bottom in row_spans:
        row = []
        for left, right in col_spans:
            cell = rect(pt(left, top), pt(right, bottom))
            row.append(cell)
        grid.append(row)

    return grid
def make_grid_from_positions ( colpos , rowpos ) : if len ( colpos ) == 0 : raise ValueError ( "List of column positions is empty." ) if len ( rowpos ) == 0 : raise ValueError ( "List of row positions is empty." ) row_spans = subsequent_pairs ( rowpos ) col_spans = subsequent_pairs ( colpos ) # create a grid with rectangles of table cells grid = [ ] for top , bottom in row_spans : row = [ ] for left , right in col_spans : cell = rect ( pt ( left , top ) , pt ( right , bottom ) ) row . append ( cell ) grid . append ( row ) return grid