From d1de924b1c301dcbda7d57f50ea84ceb412eef86 Mon Sep 17 00:00:00 2001 From: tannevaled Date: Thu, 27 Aug 2026 15:42:54 +0200 Subject: [PATCH] Carry the reading order across, not just the pages ops v0.6.0 -> v0.7.0, which keeps /StructTreeRoot; reader v0.4.2 -> v0.5.0. A structure tree is the order a screen reader reads a document in. It is not the order the marks sit on the page, and nothing else in the file says it. Plan.Build was writing a document without one, so a tagged form put through a shared edit came out untagged: still legible to somebody looking at it, and no longer navigable by somebody who cannot. Measured over the 1 633 real documents in /Users/Shared/pdfforms, both binaries verified with `go version -m`: 1 021 source documents carry a /StructTreeRoot. ops v0.6.0 carried 0 of them into the rebuilt document. ops v0.7.0 carries 1 014. 3 095 top-level structure elements come across, with the ParentTree, the RoleMap, the ClassMap and the IDTree that make them mean anything. The seven not carried across all have a root with no /K -- a ClassMap and a RoleMap and no tree under them. There is nothing in them to carry, which is the same shape as an AcroForm dictionary with no fields, so 1 014 of 1 014 actual trees are preserved. Over all 2 268 files, 1 096 build a different document and 0 build a worse one; no file changed whether it opens or builds. --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index cb27770..8a6aeb1 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.26.4 require ( github.com/go-crdt/crdt v0.31.0 github.com/go-deltasync/chunk v0.2.0 - github.com/go-pdfkit/ops v0.6.0 - github.com/go-pdfkit/reader v0.4.2 + github.com/go-pdfkit/ops v0.7.0 + github.com/go-pdfkit/reader v0.5.0 ) require ( diff --git a/go.sum b/go.sum index 427e202..7e672d6 100644 --- a/go.sum +++ b/go.sum @@ -8,9 +8,9 @@ github.com/go-opentype/opentype v0.9.0 h1:GFgcJ3nwTDp4NJr5O+Paw7lhZx5Jv/R+noZwvh github.com/go-opentype/opentype v0.9.0/go.mod h1:AOixevJf7XQaH7+WG+OMIOZEbYPXfMqklVk26Y6YTUU= github.com/go-pdfkit/forms v0.2.1 h1:INa2GwAadxEhcXvBe7zJYgapYwaGn9WIaLxUJU/lm6A= github.com/go-pdfkit/forms v0.2.1/go.mod h1:LORxkdP4FVULFk0/PA0CdPZc1dZF9zTSaHrtfM7IYaw= -github.com/go-pdfkit/ops v0.6.0 h1:5C8qLzdUosBPmdGbC0YOuObCv9OSTLkl1ZatyzeBAik= -github.com/go-pdfkit/ops v0.6.0/go.mod h1:Is3FBR2NcCUEzNt4eowdsVa+P0SBtGtcxK8lDlOeyrk= +github.com/go-pdfkit/ops v0.7.0 h1:W8sK//0nfs/OACvjzvw/GK5ywtd90eDoYcdv74GxW8M= +github.com/go-pdfkit/ops v0.7.0/go.mod h1:Is3FBR2NcCUEzNt4eowdsVa+P0SBtGtcxK8lDlOeyrk= github.com/go-pdfkit/pdffont v0.3.0 h1:G5DKcAmsZJ0e17QhSrcUaL7PKEXKjUx4P/iGMl7bAbI= github.com/go-pdfkit/pdffont v0.3.0/go.mod h1:bfmNLna1l1CljNX/Utg55YzFylovfmI7sJnvgA3bzKI= -github.com/go-pdfkit/reader v0.4.2 h1:0/qPShLzdG/roH4i13dwDTHnS7mEBVTaCBGwCZQhOH0= -github.com/go-pdfkit/reader v0.4.2/go.mod h1:fQFOVfCMUui1AdvD4qhimdyvvNr9KvvJ1S7IuKZjyV8= +github.com/go-pdfkit/reader v0.5.0 h1:DaJ5C6eKXPRG9Cdu+olA/0KLmsQgyHEC1coteQQuBxU= +github.com/go-pdfkit/reader v0.5.0/go.mod h1:fQFOVfCMUui1AdvD4qhimdyvvNr9KvvJ1S7IuKZjyV8=