Embed Notice
HTML Code
Corresponding Notice
- Embed this notice
kaia (kaia@brotka.st)'s status on Sunday, 26-Nov-2023 07:14:35 JSTkaia @mia
hi mia, thanks again for https://git.0x0.st/mia/scanproc that I use often.
in one particular document the font size is recognized as `14.04` breaking the script at line 195 in pdfutil when inserting text with "TypeError: can't multiply sequence by non-int of type 'float'"
I resolved this error by changing line 191 of pdfutil to `fs = int(r.height)` and it seems to work for all pages.
here's the full error for your reference:
```
Traceback (most recent call last):
File "/home/kaia/scanproc/scanproc.py", line 164, in <module>
@entrypoint
^^^^^^^^^^
File "/home/kaia/scanproc/venv/lib/python3.11/site-packages/entrypoint2/__init__.py", line 380, in entrypoint
return func(*_correct_args(func, kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kaia/scanproc/scanproc.py", line 214, in main
outf.write(mkpdf(symtab, pageblobs, colorimgs, texts, dpi))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/kaia/scanproc/pdfutil.py", line 196, in mkpdf
pdf[p].insert_text(fitz.Point(r.x0, r.y0+r.height*0.8),
File "/home/kaia/scanproc/venv/lib/python3.11/site-packages/fitz/utils.py", line 1815, in insert_text
rc = img.insert_text(
^^^^^^^^^^^^^^^^
File "/home/kaia/scanproc/venv/lib/python3.11/site-packages/fitz/utils.py", line 3579, in insert_text
nres += "%g w " % border_width * fontsize
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
TypeError: can't multiply sequence by non-int of type 'float'
```