Merging the same file twice does not disambiguate destination names in the name tree
In general, we must check for clashes of all names on merge operations, and rename, just as we do with graphics names etc.
Pdfmerge module.
We need to solve the problem because two files might both have names in the name tree called, for example (Chapter1.begin).
The problem here is that this interferes with the no-copy semantics of a merge involving the same file twice. If we copy and renumber the PDFs, it's ok. We can then merge the name trees, changing names and altering annotations to point to the new names.
e.g cpdf -merge a.pdf 1-6 b.pdf a.pdf 7-9
at the moment this does not duplicate the contents of a.pdf, because they are known to be the same file.
We could implement a system which operates only if all the filenames are distinct. Otherwise it would just merge the name trees as it currently does. We could document this, and have the user copy the input file and use -squeeze afterwards if need be. This is gross, though. Is there a better solution?
Fixed in v2.6