Open KaboChow opened 7 months ago
Hi @KaboChow, and thanks for providing this interesting example. It appears to relate to pdfplumber
's main dependency, pdfminer.six
.
It seems that there's some discussion of this general issue here: https://github.com/pdfminer/pdfminer.six/issues/861#issuecomment-1493442408
As it happens, however, the piece of pdfminer.six
code it likely relates to is code I've contributed. Just brainstorming here, I think the issue is that folks generally want to decompose paths with multiple subpaths, for the purpose of rectangle detection. (See this test for an example.) As the issue comments above correctly point out, this makes it difficult/impossible to correctly handle more complex paths, such as shapes with holes in them.
One solution would be to propose reverting the behavior so that it does not decompose complex paths, with the downside being that some clearly rectangle-like things do not get recognized as such.
Another would be to tweak the behavior so that it mostly does not decompose complex paths except in the case of those composed entirely of rectangles. The downside would be that this may be a confusing rule, and also that some all-rectangle complex paths are still intending to be understood as shapes with holes in them.
Thanks again. Will keep thinking on this, and welcome suggestions from others, too.
@jsvine Thank you for your answer. Regarding the solution to this problem, I have done some processing on the obtained data, when the 'evenodd' value of two objects is false, to determine whether the boundaries of the two objects coincide, if they do, then the smaller side is the subpath, this method works for me, I hope it will be helpful for people who have the same confusion
During the process of extracting shape data from a PDF, I converted the created text letter 'o' into a shape object.
This is the PDF I conducted the test on: LTCurve.pdf
Is there any way to resolve this? Thank you very much.