ralfstuckert/pdfbox-layout

Switching between columns and vertical layout

Opened this issue · 4 comments

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

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.

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.

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. :-)

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());