I have a python script that automatically creates a LaTex document for a given input. In this document, I have a lot of proof trees (created using the bussproofs package), though it doesn't really matter what are these proof trees. The point is that in some cases the resulted proof trees are either too long horizontally or too long vertically and that result in the proof trees not fitting in the page and making erros. So, I would like to adjust the page width or height if needed in order for all the content to fit inside the page. The problem is that I can't just put some maximal value for the page width and height.
So, I would like to put a few commends so that the page width and height would extend sufficiently in order to fit any content whatsoever.
I should note that here an answer for how to extend the page width in order to fit one line of text of arbitrary length was given, if that helps someone to come with a solution.