Skip to content

Error signing file: Builder does not support application/pdf #157

@ttbuffey

Description

@ttbuffey

when I try to add sign a pdf document, it shows the Builder does not support application/pdf. is the PDF format supported?

code

with open(cert_path, 'rb') as cert_file, open(key_path, 'rb') as key_file:
            private_key = key_file.read()
            cert_chain = cert_file.read()
            try:
                signer_info = C2paSignerInfo(
                    alg=b"ps256",
                    sign_cert=cert_chain,
                    private_key=private_key,
                    ta_url=b"http://timestamp.digicert.com"
                )
                signer = Signer.from_info(signer_info)
            except Exception as e:
                raise RuntimeError(f"Error creating signer: {e}") from e

            builder = Builder(manifest)

        output_path = os.path.join(output_folder, unique_id + '_c2pa_embedded_' + filename + file_extension)
        c2pa_data = builder.sign_file(signer=signer, source_path=image_path, dest_path=output_path)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions