I am using the synchronous document translation API as instructed here: https://learn.microsoft.com/en-us/azure/ai-services/translator/document-translation/reference/synchronous-rest-api-guide
I can translate other types of documents using CURL, but when I submit a PDF document I always get a 400 error with the response {"code":"InvalidFormat","message":"The format parameter is not valid."}
. This applies to all PDF documents. This is the command that I am used (API key omitted):
curl -i -X POST "https://eelec-translation-uswest.cognitiveservices.azure.com/translator/document:translate?sourceLanguage=en&targetLanguage=hi&api-version=2023-11-01-preview" -H "Ocp-Apim-Subscription-Key:<omitted>" -H "X-ClientTraceId:pdf-translation-issue-b4e3ae21" -F "document=@blank.pdf;type=application/pdf" -o "out.pdf"
And the response:
HTTP/2 400
content-type: application/json; charset=utf-8
access-control-expose-headers: X-RequestId,x-ms-request-id,X-RequestId-Forwarded,X-Metered-Usage
x-requestid: 944d44da-dfca-4ed3-9a93-11a68fd787f5
x-ms-request-id: 944d44da-dfca-4ed3-9a93-11a68fd787f5
x-ms-error-code: InvalidRequest
strict-transport-security: max-age=31536000; includeSubDomains; preload
apim-request-id: 944d44da-dfca-4ed3-9a93-11a68fd787f5
x-content-type-options: nosniff
x-ms-region: West US
date: Mon, 29 Apr 2024 04:38:09 GMT
{"error":{"code":"InvalidRequest","message":"The format parameter is not valid.","target":"ContentType","innerError":{"code":"InvalidFormat","message":"The format parameter is not valid."}}}
The problem was also reported by another user a month ago: https://learn.microsoft.com/en-us/answers/questions/1600851/pdf-document-translation-error?comment=question#comment-1531717
I have tried with various PDF documents and various source and target languages. PDF translation appears to be completely broken using this API.
I cannot submit a support ticket because I do not have the premium CS plan, and I refuse to pay money for the privilege to report that the API is broken.