How to upload duplicate image in different ocg layer #1857
-
Please provide all mandatory information! Describe the bug (mandatory)I have 3 pdf, among with 2 of them has same logo. I am processing each pdf individually where I am extracting the logo from them and adding them in different ocg layer created using add_ocg() and image is added using insert_image(). To Reproduce (mandatory)Add same image in two different ocg layer. Expected behavior (optional)We expected that the image added in seperate ocg layers should be handled within that layer only, instead of taking reference from already added one. The last logo of 'Thames Water' in uploaded pdf should be in sync with the 'WW1.pdf' ocg layer. Screenshots (optional)Please find attached the final processed pdf created using pymupdf. Your configuration (mandatory)
For example, the output of Additional context (optional)Add any other context about the problem here. |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments
-
This is probably not a bug, but an unimplemented feature. |
Beta Was this translation helpful? Give feedback.
-
Your problem should go away if you are able to make the second insertion with an image version that has a different binary content. |
Beta Was this translation helpful? Give feedback.
-
I am processing multiple(three) pdf in a for loop, I tried creating pixmap instead of using direct filename and since 1st and 3rd logo are same I guess there pixmap are also same as it is still taking the reference from the first one instead adding new image. pixmap created using thsi line- pix = fitz.Pixmap(logo_crop_filename) |
Beta Was this translation helpful? Give feedback.
-
I have converted the issue to a discussion. Let's continue dealing with the situation here. I was just thinking about tricking out my logic which is responsible for preventing duplicate images. |
Beta Was this translation helpful? Give feedback.
-
If you want to be lazy, you could of course also do |
Beta Was this translation helpful? Give feedback.
If you want to be lazy, you could of course also do
doc.InsertedImages = {}
after eachinsert_image
.