OCRmyPDF
OCRmyPDF copied to clipboard
[Bug]: pikepdf cropbox/mediabox/trimbox as list can return strings in the list
What were you trying to do?
https://github.com/ocrmypdf/OCRmyPDF/blob/6ca4940a32bb1146f70c2bb2497e0d5c0fa9ca6b/src/ocrmypdf/pdfinfo/info.py#L890-L892
This can crash with
TypeError: float() argument must be a string or a real number, not 'pikepdf._core.Object
When /TrimBox
of a page is like
/Contents 267 0 R
/TrimBox [3.05175781e-005 0 612 792]
/BleedBox [3.05175781e-005 0 612 792]
/ArtBox [3.05176e-005 0.479996 612 792]
Because pikepdf for [float(d) for d in page.trimbox.as_list()]
returns
pikepdf._core._ObjectList([pikepdf.String("3.05175781e-005"), 0, 612, 792])
Where are you installing/running from?
source build
OCRmyPDF version
No response
What operating system are you working on?
No response
Operating system details and version
No response
Simple sanity checks
- [ ] Operating system is currently supported by its vendor (not end of life)
- [ ] Python version is compatible with OCRmyPDF
- [ ] This issue is not about a specific input file
Relevant log output
No response