Help with operatorList parsing #18677
Unanswered
Bboyredstar
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello!
I am trying to implement OCG data parsing. I have several tasks to do.
Pdf example:
Andheri_Residence_Electrical_Drawing.pdf
I have encountered a problem. By default we can't get OCG data by any inbuilt method, so I have to parse operatorList myself. I parse the content into groups, and after that I want to get data about polygons only, for example, by filtering the operators.
Something like:
I have a few questions:
Is there some better way to not store so much data that we got after filtering operatorList?
The second problem is related to dimension conversion. I don't know how I can correctly convert the polygon's dimensions relative to its display on the canvas.
That is, let's say the dimensions of my canvas:
And the polygon data is:
Obviously, its coordinates are outside the view box.
So I need to convert the data in points, to pixels. I tried dividing the coordinates by 72. But the scale turns out to be very small relative to the real size of the canvas.
I want to draw the corresponding elements on top of the linked elements on the pdf. I want them to be interactive.
Here is an example:
https://github.com/user-attachments/assets/e2ceb640-7cb1-427a-802d-c5ea732baf8d
As you can see now my data from the list operator does not match their coordinates on the pdf (I adjusted the coordinates a bit manually).
Is there any way to convert the data and how to do it?
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions