New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ENH: consider images inside PDF made with onlyoffice #2637
base: main
Are you sure you want to change the base?
ENH: consider images inside PDF made with onlyoffice #2637
Conversation
I made a PR to add the sample files : Instead of putting the files directly into this repository, should I host the files on github or somewhere else so they get downloaded ? |
In general, files should go into the sample files if you own all copyrights and are okay with the license terms there. Unfortunately, merging permissions are more restricted over there, thus I am not able to merge anything there myself. The usual approach we take apart from this is to upload to an issue or PR and download the corresponding files from the GitHub URLs. Unfortunately, this will not work for image files any more as far as I know as GitHub started to add JWTs to their URLs which expire accordingly and are user-specific. |
Can you rename the title of your PR : this is not a a STYle but an ENHancement. you should be able to "factorize" your code to use the code for image extraction. the current code looking for "/Resources/Xobjects/'Forms'" should be very similar to "/Resources/Patterns/" adjusting x_object You should also confirm your code works with patterns within forms Also, It might be interesting to extract the thumbnail and confirm that no other images are ignored |
I reused images that were already present in the repo so it should be good in term of rights. The issue is that only office convert images to jpeg when included inside a document, so I had to re-upload them once converted to pass content verification in the test unit. Let's wait to see if my PR on the other repo get merged then, thanks. |
I was not sure which one to use, thanks.
You're right, I didn't thought about it, let's do that.
It will probably not in the current state, I'll check what are forms, thank you.
Yes I agree. I'll need to read a bit more the PDF standard, currently I've only read the part about patterns and image objects so I'm lacking a lot about how images object are used/located. Maybe it would be nicer to have an issue for each case where images are missing and have their matching PR ? |
I have tested onlyoffice forms and images inside it are not taken into account. Images inside PDF from libreoffice without and with forms are taken into account, as well as images from word forms. |
@0xNath |
I'll add the code for extracting the images from the form PDF and the corresponding test. I'm going to follow the same logic as for the patterns, but with "/Annots/.../..." as image identifiers iss2613-onlyoffice-form.pdf |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2637 +/- ##
==========================================
- Coverage 94.97% 94.89% -0.08%
==========================================
Files 50 50
Lines 8331 8371 +40
Branches 1669 1689 +20
==========================================
+ Hits 7912 7944 +32
- Misses 260 262 +2
- Partials 159 165 +6 ☔ View full report in Codecov by Sentry. |
Added code to detect patterns in "_get_ids_image". To avoid any conflicts with images that could be located directly in a page or images using the same ID in differents patterns, images ids under patterns are returned in this form : "/Pattern/patternNameHere/imageNameHere" Added code to deal with Pattern images in "_get_image".
fixed code style
fixed code style
fcb3b1f
to
d524672
Compare
commit d0493ae Author: Nathanaël Renaud <perso@renaudna.fr> Date: Fri May 17 23:25:13 2024 +0200 Modified _get_ids_image and _get_image so they work with onlyoffice images commit 53a3781 Author: Nathanaël Renaud <perso@renaudna.fr> Date: Fri May 17 23:22:27 2024 +0200 Added tests units about images extractions from PDF generated using onlyoffice
closes #2613
Added code to detect patterns in "_get_ids_image".
To avoid any conflicts with images that could be located directly in a page or images using the same ID in different patterns, images ids under patterns are returned in this form : "/Pattern/patternNameHere/imageNameHere"
Added code to deal with Pattern images in "_get_image".
Added a new test to verify ids and image data returned related to the modifications done above.