Question
pdf compress via BLOB
Dear community.
I try to compress PDF files over the api service and build a code, based on the documentation.
I always get the result:
[code] => INVALID_INPUT_URL
[message] => The input URL is either invalid or unsupported.
Its a bit confusing. I send the blob via the input uri.
Is there something wrong?
Is there something wrong?
Thanks!
$file_content = file_get_contents($filepath);
$data = array(
"input" => array(
"uri" => base64_encode($file_content),
"storage" =>"BLOB"
),
"output" => array(
"storage" =>"BLOB"
)
);
$json_data = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://pdf-services.adobe.io/operation/compresspdf');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
// Headers setzen
$headers = array();
$headers[] = 'x-api-key: ' . $config["adobe"]["client_id"];
$headers[] = 'Content-Type: application/json';
$headers[] = 'Authorization: Bearer ' . $config["adobe"]["token"];
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$result = curl_exec($ch);
if (curl_errno($ch)) {
echo 'Fehler:' . curl_error($ch);
}
curl_close($ch);
