(p, split_pos, direction=DIRECTION_VERTICAL)
return (texts_a, width_a, height_a), (texts_b, width_b, height_b)
Split text boxes on a double page <p> at position <split_pos>, the separator line going in direction <direction>.
    Return a 2D tuple with the split pages A and B:
    ((A text boxes, A width, A height), (B text boxes, B width, B height))
Split text boxes on a double page <p> at position <split_pos>, the separator line going in direction <direction>.
    Return a 2D tuple with the split pages A and B:
    ((A text boxes, A width, A height), (B text boxes, B width, B height))
Split text boxes on a double page <p > at position <split_pos > the separator line going in direction <direction > . Return a 2D tuple with the split pages A and B : (( A text boxes A width A height ) ( B text boxes B width B height ))
def split_page_texts(p, split_pos, direction=DIRECTION_VERTICAL):
    """
    Split text boxes on a double page <p> at position <split_pos>, the separator line going in direction <direction>.
    Return a 2D tuple with the split pages A and B:
    ((A text boxes, A width, A height), (B text boxes, B width, B height))
    """
    if direction not in (DIRECTION_HORIZONTAL, DIRECTION_VERTICAL):
        raise ValueError("invalid value for 'direction': '%s'" % direction)
    
    if direction == DIRECTION_VERTICAL:
        pos_attr = 'left'
        dim_attr = 'width'
        width_a = split_pos
        width_b = p['width'] - split_pos
        height_a = height_b = p['height']
    else:
        pos_attr = 'top'
        dim_attr = 'height'
        height_a = split_pos
        height_b = p['height'] - split_pos
        width_a = width_b = p['width']
        
    texts_a = []
    texts_b = []
    
    for t in p['texts']:
        t = deepcopy(t)
        t_pos = t[pos_attr] + t[dim_attr]/2
        if t_pos < split_pos:
            texts_a.append(t)
        else:
            if direction == DIRECTION_VERTICAL:
                new_pos = (t['left'] - split_pos, t['top'])
            else:
                new_pos = (t['left'], t['top'] - split_pos)
            update_text_dict_pos(t, new_pos, update_node=True)
            texts_b.append(t)
    
    return (texts_a, width_a, height_a), (texts_b, width_b, height_b)
def split_page_texts ( p , split_pos , direction = DIRECTION_VERTICAL ) : if direction not in ( DIRECTION_HORIZONTAL , DIRECTION_VERTICAL ) : raise ValueError ( "invalid value for 'direction': '%s'" % direction ) if direction == DIRECTION_VERTICAL : pos_attr = 'left' dim_attr = 'width' width_a = split_pos width_b = p [ 'width' ] - split_pos height_a = height_b = p [ 'height' ] else : pos_attr = 'top' dim_attr = 'height' height_a = split_pos height_b = p [ 'height' ] - split_pos width_a = width_b = p [ 'width' ] texts_a = [ ] texts_b = [ ] for t in p [ 'texts' ] : t = deepcopy ( t ) t_pos = t [ pos_attr ] + t [ dim_attr ] / 2 if t_pos < split_pos : texts_a . append ( t ) else : if direction == DIRECTION_VERTICAL : new_pos = ( t [ 'left' ] - split_pos , t [ 'top' ] ) else : new_pos = ( t [ 'left' ] , t [ 'top' ] - split_pos ) update_text_dict_pos ( t , new_pos , update_node = True ) texts_b . append ( t ) return ( texts_a , width_a , height_a ) , ( texts_b , width_b , height_b )