ralfstuckert / pdfbox-layout

MIT License
156 stars 74 forks source link

Switching between columns and vertical layout #51

Open CBarratt63 opened 6 years ago

CBarratt63 commented 6 years ago

Is it possible to switch between column layout then back to vertical layout then back to column layout etc ad nauseam ? I'm not expecting that it is, but just wanted to check I'm not missing something ? Thanks, chris

ralfstuckert commented 6 years ago

Yes, you can change the layout any time. See columns.pdf resp. Columns.java for example. Here the layout is changed just once after the headline, but you can change it whenever needed.

CBarratt63 commented 6 years ago

Thanks Ralf, good to hear it can be changed back and forward. I cannot see how to change it back to vertical layout however - neither from the above example, nor from Wiki. IN my test example, I start my document in column layout and then want to switch back to vertical layout, however, what ever I try the text just ends up coming after the end of the previous second column. I am obviously missing something - can you give Java code on how to swap back to vertical layout please ? Ta.

CBarratt63 commented 6 years ago

ah...2 minutes after writing the previous message, I realised I should just set it with a column layout of 1 column. Is that the intended method ? If not, it is a good workaround. :-)

arnthom commented 6 years ago

Just in case, someone wants to know ... First switch from default to column layout document.add(new ColumnLayout(2, 10)); document.add(some_stuff) and later switch nack to vertical layout document.add(new VerticalLayout());