Something goes wrong with all the cloning. The result file has a StructTreeRoot at objects 8, 697 and 730. And there is also the "COSStream has been closed and cannot be read" exception (
PDFBOX-3999) if one closes the source before saving.
If the close is removed the current tests pass, so the tests are not yet complete.
Merging 001031.pdf (file from FDA) with itself also brings an orphan check error.
Merging 054080.pdf (file also at https://pubs.usgs.gov/wdr/wdr-sc-04/wy04/pdfs/02148000.2004.sw.pdf ) with itself also shows two StructTreeRoot dictionaries (and no other failing test, despite the commits related to 001031.pdf ).