2020-12-09 Jean Louis wrote:
* Maxim Nikulin [2020-12-02 19:49]:
Personally I am considering something like (not ready to use, just quick and
dirty proof of concept)
That is great and now I came to it. Please send me your .xpdfrc
settings.
bind ctrl-o any endSelection "run(pdfcapture '%f' '%p' '%x' '%y' '%X'
'%Y' '%u')"
Certainly named options should be added to the script besides obtaining
of actual page height. I have not checked if the script is resistant in
respect to specially crafted file names and other such things. Do not
know if terminal control sequences could appear in selection. Xpdf has
known problems with handling of text encodings.
#!/bin/bash
set -e
set -o pipefail
getmeta() {
...
# FIXME obtain page height using pdfinfo
page_height=792
...
pdftotext -layout -f "$page" -l "$page" \
-x "$sel_x" -y "$((page_height - sel_Y))" -W
"$((sel_X-sel_x))" -H
^^^^^sel_y