Method and apparatus for generating a document layouts