You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Originally posted by serhii-brovarnyk June 11, 2024
Hello!
I have a PDF file with only one page I got via another tool for PDF documents, and my PDF document has some OCGs.
Unfortunately, I cannot provide the actual file.
If I try to get the pixmap of the page, it is completely OK, but when I try to get an SVG image via page.get_svg_image(text_as_path=False) method then the appearance of the page is completely different.
Investigating the issue I`ve concluded that some of the clip-paths affect the appearance of the drawing that I see.
The defs section does not have any relation to the layers or OCGS but some of the groups look like this:
If I delete a certain clip-path in the defs section then I`ll get more visible content on the SVG image so I suppose the only reason that I get such a result is the SVG has some invisible data from some of the OCGs and since it does not being managed by the PDF I see it whether I suppose to see it or not.
So my question is How to detect and delete invisible and unnecessary OCGs from my PDF document so I won`t see the difference between the SVG image and the pixmap that I got from the pymupdf Page object?
It is important to notice, that the pymupdf Document object does not have any info about layers or OCGs.
I have tried doc.get_layers(), doc.get_ocgs(), doc.layer_ui_configs() methods but they return empty lists.
But page.get_oc_items() returns such a list of OCGs:
In conclusion, this document has some OCGs that are accessible only on the Page level. I want to preserve only visible OCGs to get the right appearance of the resulting SVG image and delete the rest. Can you give me some advice on how to do it?
I have read 2 similar discussions (about OCGs) but eventually did not get the answer :(
The text was updated successfully, but these errors were encountered:
Discussed in #3567
Originally posted by serhii-brovarnyk June 11, 2024
Hello!
I have a PDF file with only one page I got via another tool for PDF documents, and my PDF document has some OCGs.
Unfortunately, I cannot provide the actual file.
If I try to get the pixmap of the page, it is completely OK, but when I try to get an SVG image via
page.get_svg_image(text_as_path=False)
method then the appearance of the page is completely different.Investigating the issue I`ve concluded that some of the clip-paths affect the appearance of the drawing that I see.
The defs section does not have any relation to the layers or OCGS but some of the groups look like this:
If I delete a certain clip-path in the defs section then I`ll get more visible content on the SVG image so I suppose the only reason that I get such a result is the SVG has some invisible data from some of the OCGs and since it does not being managed by the PDF I see it whether I suppose to see it or not.
So my question is How to detect and delete invisible and unnecessary OCGs from my PDF document so I won`t see the difference between the SVG image and the pixmap that I got from the pymupdf Page object?
It is important to notice, that the pymupdf Document object does not have any info about layers or OCGs.
I have tried
doc.get_layers()
,doc.get_ocgs()
,doc.layer_ui_configs()
methods but they return empty lists.But
page.get_oc_items()
returns such a list of OCGs:Also, I used such a code
To get such info:
In conclusion, this document has some OCGs that are accessible only on the Page level. I want to preserve only visible OCGs to get the right appearance of the resulting SVG image and delete the rest. Can you give me some advice on how to do it?
I have read 2 similar discussions (about OCGs) but eventually did not get the answer :(
The text was updated successfully, but these errors were encountered: