We present an algorithm that can determine the layout of an arbitrary document with great flexibility. The bottom-up approach of pattern extraction and classification provides good segmentation and is insensitive to skew. Soft ordering is a feature that improves segmentation by allowing distinct regions to physically overlap. It is also used to determine the correct order of the document regions. The algorithm can extract and place all the distinct document regions into a logical layout and column structure.