You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To make reading PDFs a bit less painful on an e-reader, I run them through k2pdfopt.
One small issue is that footnotes can end up in the middle of the text instead of at the bottom (screenshot attached).
Since they are displayed in a smaller font size, I was thinking of searching for blocks in that size, and moving them all at the end of the document, as a simple way to access them if I really need to.
Can PyMuPDF perform that task easily or is it a lot more involved than I naïvely think?
Yes, it is a lot more complex than one might think. Here is an incomplete list of problems from the top of my head.
That starts with identifying footnotes reliably. Criteria that work for one document may not work for others. In essence you need some semantic logic like typically present in AI-based tools. PyMuPDF-Layout is capable of identifying footnotes for instance. But even for AI tools, this is always a plausible, never a failsafe result.
Second, footnotes are typically pointed to by one or more hyperlinks further up in the document - on the same page usually, but not always. When moving a footnote to somewhere else, then those links must all be found by your own logic (a search function à la "what is pointing to this location?" must be built)! ... And then all be updated with the whereabouts of the new position of the footnote. IAW you have to remove existing hyperlinks and insert new ones - on maybe more than one page per footnote. More details have to be considered like is there enough empty space on the last page? Must I append new pages? If new page are required: what needs be done to make them look like other pages of the document?
Third: What you really would be doing is converting footnotes to endnotes. This leads to numbering issues: in your example, the superscripts 10 and 11 might no longer be unique amongst all the other endnotes. Even if this might be a cosmetic-only problem, it could cause confusion.
Four: The space on the page where a footnote lives currently cannot be regained. It will become a white area. May not be a big deal ... but your desire was an esthetic one in the beginning, so I think it is at least worth mentioning. After moving the footnotes away, the page would look like this:
I hear your next objection: "What about that ugly black line?!" Well: this is another problem. While PyMuPDF can remove vectors like this: it is you who must determine that that line in fact is there and provide its boundary box for the removal function.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Hello,
To make reading PDFs a bit less painful on an e-reader, I run them through k2pdfopt.
One small issue is that footnotes can end up in the middle of the text instead of at the bottom (screenshot attached).
Since they are displayed in a smaller font size, I was thinking of searching for blocks in that size, and moving them all at the end of the document, as a simple way to access them if I really need to.
Can PyMuPDF perform that task easily or is it a lot more involved than I naïvely think?
Thank you.
All reactions