-
Notifications
You must be signed in to change notification settings - Fork 22
Closed
Labels
Description
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)