Merging Three Outlined PDFs Kept 0 of 8 Bookmarks — Our Written Offset Formula Restored 8 of 8
The numbers that frame today's run: 8 in, 0 kept, 8 restored. We built three PDFs that each carried a real outline — source A with 3 pages and 4 nested entries, source B with 2 pages and 2 flat rows, source C with 2 pages and 2 flat rows (7 pages, 8 bookmarks in total) — merged them in A+B+C order, and read the merged file back: an empty outline, all 7 pages present. Before touching the machine we wrote the offset formula down, then executed it: the first source's targets stay as-is; each later source's targets shift by the summed page counts of every source before it. Rebuilt that way, the merged file read back all 8 rows identical. This extends the two-source run to three sources; the extension the two-source page promised is now measured, and the four-source case stays on the not-run list. No accuracy claims, no prices, and nothing beyond what we executed is described as if it were run.
The formula, written before the machine touched it
For sources run in order S1, S2, …, Sn with page counts P1, P2, …, Pn:
offset(Si) = P1 + P2 + … + P(i-1), with offset(S1) = 0. Every bookmark target of source Si moves by that offset; the first source is unchanged.
Applied to today's bench: offset(A)=0 (P=3), offset(B)=3 (only A before it), offset(C)=3+2=5 (A and B). One inference we flag as arithmetic, not a measured mis-merge: had we written the raw source lists without offsets, B's rows would have pointed at pages 1–2 (inside A's content) and C's rows at pages 1–2 (inside A), not at B's and C's own pages at 4–7 in the merged order. We did not run the mis-pointed variant — that sentence is where the targets would land per the arithmetic, and we marked it as inference because we never executed it to watch it fail.
The A+B+C run, read back step by step
| Step in our run | Outline read-back (verbatim) | What it says |
|---|---|---|
| Source A on disk: 3 pages, outline set before save | [[1,'A-H1',1],[2,'A-Child',1],[2,'A-Child2',2],[1,'A-H2',3]] | A's nested outline exists on disk |
| Source B on disk: 2 pages, outline set before save | [[1,'B-Only',1],[1,'B-Second',2]] | B's rows exist on disk |
| Source C on disk: 2 pages, outline set before save | [[1,'C-Intro',1],[1,'C-Join',2]] | C's rows exist on disk |
| Merged A+B+C, read straight from the saved file | [], page count 7 | None of the 8 rows survived the merge; content is all there |
| Rebuild with the written plan (offsets 0 / +3 / +5), saved, read back | The same 8 rows, A's nesting first, then B at 4–5, then C at 6–7 | The formula held: 8 of 8 identical to the written plan |
Quick FAQ
Do bookmarks survive if I merge three or more PDFs?
In our three-source run: none survived. All three sources held their outlines at merge time (read-backs above), the merged file still read back zero. Count does not change the loss the merge step causes; the rebuild step is what brings rows back.
How do I compute page offsets for a multi-source merge?
Write it before you run it: each later source shifts by the summed page counts of everything before it. In our run that meant B at +3 and C at +5. We wrote the formula first and the machine run confirmed all 8 targets — that order is deliberate, and it is how we caught the one trap (a later source whose rows would silently point inside an earlier source's pages) without executing it.
Does the order of merged bookmarks follow the sources?
The order in our fixed file is the order we wrote: A's four rows (nested as in the source), then B's two, then C's two. Reading it back confirmed it. If you want a different grouping — all level-1 rows first, for example — that is a re-ordering you write yourself; we did not run such a variant.
What is still untested?
Four or more sources: not yet run. The formula's arithmetic extends, but we will not say the extension works until we execute it — same discipline as the two-source page's promise, now paid off for three. Also unrun: named-destination bookmarks and any merge option that might carry outlines natively; today's bench was plain page-target rows with no options.
What we could NOT test — keeping the list honest
- Four-source merge and the cumulative offset beyond three sources — not run. Reason: today's bench was exactly three sources; the arithmetic is written but we refuse to present an unexecuted extension as fact.
- A mis-pointed rebuild (raw lists without offsets) to capture the failure mode as data — not run. Reason: we had no reason to build a knowingly wrong file; the target arithmetic above is inference, labeled as such.
- Outline rows pointing at non-page destinations, and merge options that might preserve outlines — not run. Reason: our three sources carry plain page-target rows only; adding destination types would change what the read-back measures.
Decision rule this run supports
- Merging three outlined PDFs where bookmarks matter: write the offset formula first, read every source outline, rebuild with summed offsets (0 / +P1 / +P1+P2), then read back. Our run: 8 in, 0 kept, 8 restored, targets landing exactly where the formula said.
- Four or more sources: wait for the run. The bench is ready; the number will come from execution, not from the formula's promise.
This page pays the extension promised on the two-source page and reuses the nested shape from the nesting page. Bookmark pdf2mdtool.com — the four-source run is queued, and the number will arrive only when executed.