Nice one...
I don't know if I have understood this correctly, but surprisingly it works... To make it easier to understand. It is the PDFBoxWrapper (wonderful by the way, thanks to
knutf for this great software!).
In the B4XMainPage a variable is defined to control the class that identifies the PDF:
Public PDF As PDFBoxWrapper
with
I unload the wrapper. The problem is that you cannot easily reach this variable via MainForm_CloseRequest or MainForm_Close. I have now also defined the corresponding variable as a mirror in the main.
Public PDFMain as PDFBoxWrapper
After initialising the variable in the B4XMainPage, I assign the same value from the B4XMainPage to the mirrored variable defined in the main.
If I then control this mirrored variable via MainForm_CloseRequest, it works perfectly. I'm not sure, this might not be quite the correct way, but it definitely works.