RyotaUshio / obsidian-pdf-plus

The most Obsidian-native PDF annotation, viewing & editing tool ever. Comes with optional Vim keybindings.
https://ryotaushio.github.io/obsidian-pdf-plus/
MIT License
470 stars 11 forks source link

[FR] Extract highlights in the document order in double-column PDFs #176

Closed RyotaUshio closed 1 month ago

RyotaUshio commented 2 months ago

An enhancement for the command "Extract & copy annotations in this PDF".

Originally posted by @Kyeonghyeon-Park in https://github.com/RyotaUshio/obsidian-pdf-plus/discussions/172#discussioncomment-9219371

One quick question. Is there a way to extract highlights in the same order (reading perspective) in a double-column PDF? It seems that it orders the highlights with the location. For example, if highlights are located as below, it shows the highlights with the following order: C -> A -> D -> B. But I want to extract highlights with the order: A -> B -> C -> D. .. C A D B

RyotaUshio commented 2 months ago

The current implementation sorts annotations according to a simple top-left-to-bottom-right rule: https://github.com/RyotaUshio/obsidian-pdf-plus/blob/ab34e588b7cafffbf95481398921683744605e90/src/lib/highlights/extract.ts#L66

This FR can be achieved by taking the order of the textContentItems into account in this sorting process.

RyotaUshio commented 1 month ago

Will be addressed in the next version (0.39.25).