When merging with PDFMerger from the command line (e.g. the files from
PDFBOX-4007) the structure tree is lost. The cause is that mergeDocuments() merges into an empty PDDocument object, and appendDocument() does not copy the structure tree if it doesn't exist in the destination. It does something only if source and destination have one.