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
I am trying to parse various PDF documents and came across one I get an exception when trying to extract its images.
File ".../python3.9/site-packages/pikepdf/models/image.py", line 665, in extract_to
return self._extract_to_stream(stream=stream)
File ".../python3.9/site-packages/pikepdf/models/image.py", line 611, in _extract_to_stream
im = self._extract_transcoded()
File ".../python3.9/site-packages/pikepdf/models/image.py", line 564, in _extract_transcoded
if self.mode in {'DeviceN', 'Separation'}:
File ".../python3.9/site-packages/pikepdf/models/image.py", line 270, in mode
raise NotImplementedError(
NotImplementedError: Not sure how to handle PDF image of this type
I am not sure which image / path it is exactly; not sure how I would find that out.
The first object-id/generation that is affected is (3,0). It seems like all /Image objects have that same issue for this particular PDF.
I guess setting a color space manually will not work ?
The image in question is actually a transparency mask that is involved in rendering some other image or some other feature. If you explore the structure of the PDF you may be able to learn how the image is being used.
As @sim0nx suggests, assigning a colorspace of DeviceGray and setting ImageMask to False would allow you to treat the mask as a binary image and export it, as a workaround.
In the next release I will improve support for exporting masks.
I am trying to parse various PDF documents and came across one I get an exception when trying to extract its images.
The document in question (https://impotsdirects.public.lu/dam-assets/fr/formulaires/pers_physiques/2022/100d-2022.pdf) contains an XFA form and 1+ images.
Following are the properties of the /PdfImage in question:
Would it be possible to implement support for this ?
The text was updated successfully, but these errors were encountered: