About get_drawing function #969
-
Hello! When I was using the get_drawing method, sometimes it took several seconds for a page, as to the whole file with 100 pages, it could cost a lot of time. Any suggestions? Thank you |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 7 replies
-
Not really. I bet you are talking of pages with an awful lot of drawing commands. |
Beta Was this translation helpful? Give feedback.
-
The only choice you have is a ridiculous one: omit the large pages - the amount of time needed should scale with the amount of data processed, which in first approximation is proportional to |
Beta Was this translation helpful? Give feedback.
-
First of all, the method is now a lot faster: Second: If so, you probably have that old problem, that the page geometry has been carelessly set: Execute |
Beta Was this translation helpful? Give feedback.
-
@Yichen-fqyd - question: |
Beta Was this translation helpful? Give feedback.
Not really. I bet you are talking of pages with an awful lot of drawing commands.
I based the method on a subset of MuPDF's tracing device, which does all the analysis of the painting commands. Its output I then convert to Python objects.
To confirm, try the following command yourself (Windows version), which puts the trace device's output on a text file:
mutool trace file.pdf n > file.xml
wheren
is the desired page number (1-based). The output format is XML.