My master document won't switch back to portrait after a landscape page when printing to pdf

The end of my document set up is as follows
Portrait, Portrait, Landscape, Portrait, Landscape, Portrait. Each page in this instance is also made from a separate sub document. The Landscape pages have tables on them.

When I open the master document it displays the way I want it to (P, L, P, L, P). However when I go to print to pdf, all of the pages are then displayed as landscape. In order to change this I go to properties - layout- orientation- it is set as landscape. So I change it to portrait. Everything changes to portrait except for the first portrait page after a landscape page, so it becomes (P, P, L, L, L, L).

I have tried resetting my user profile. I have updated to the newest version of libreoffice.
I double checked the page setup settings in both the master and the sub documents.
When I open the master document using open office, it prints to pdf in the proper page orientation.
Also I need to print it to a customized pdf setting (PDFa with a few modifications), and if I export to PDF, I cannot get the needed setting.

This issue seems similar to the problem posted here Printing a Landscape Portrait writer document that doesn't switch back to portrait
However, there didn’t seem to be a solution to the problem and I am working with a master document.

Can anyone please help me?

Can you use Portable Apps and use v4.2.8 to print your document? Might be worth a try. This was the last version I found where it worked correctly.

I found Bug 92190
A fix that worked for me was to change the page size to 8.49 x 11.48 (a wee bit smaller) and I do not have the problem in my test documents.

I replied to the other, it seems to be fixed in 5.2.3 for all pages in a single file, still have to test for a master document.

Done that. It works, but before I even got it working in odt, I had to set the first paragraph of each sub doc so it would start a new page with the associated page style.

I still have the issue. Once my file goes from portrait to landscape, the remaining pages stay in landscape. In the Print dialog, as I scroll through the pages, again, once it switches to a landscape page, all pages are displayed in landscape – even the initial pages that were in portrait. If I Export to PDF, it works great, but when printed to paper or PDF Creator, the bug persists.