Skip to content

PDF: type is unsupported #131

@zarifatai

Description

@zarifatai

I read in closed issue #67 that there should be PDF support now. However, I get the following error when trying to read any PDF stream using Reader(). I'm running the latest version: 0.12.0.

Traceback (most recent call last):
  File "C:\<REDACTED>\test_c2pa.py", line 54, in <module>
    with Reader(mime_type, buf) as reader:
         ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\<REDACTED>\.venv\Lib\site-packages\c2pa\c2pa.py", line 1177, in __init__
    raise C2paError(error)
c2pa.c2pa.C2paError: NotSupported: type is unsupported

Code snippet:

filename = "dummy_c2pa.pdf"
with open(filename, "rb") as file:
    file_bytes = file.read()

kind = filetype.guess(file_bytes)
mime_type = kind.mime

buf = io.BytesIO(file_bytes)
manifest = {}
if mime_type:
    with Reader(mime_type, buf) as reader:
        manifest = json.loads(reader.json())

I'm using io.BytesIO() to mimic the process in production.

I'm running Windows Server 2022 Datacenter Azure Edition, Python 3.12.8 and the underlying library that is used is: .venv\Lib\site-packages\c2pa\libs\c2pa_c.dll.

I've also tested with JPG and PNG files and they work fine. Is this a bug or am I doing something wrong?

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions