cpdf-source icon indicating copy to clipboard operation
cpdf-source copied to clipboard

Merging the same file twice does not disambiguate destination names in the name tree

Open johnwhitington opened this issue 9 years ago • 1 comments

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.

johnwhitington avatar Nov 28 '16 13:11 johnwhitington

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?

johnwhitington avatar Jul 18 '19 12:07 johnwhitington

Fixed in v2.6

johnwhitington avatar Feb 05 '23 15:02 johnwhitington