Skip to main content
Participating Frequently
May 11, 2022 5:58 AM UTC
Question

"The input file appears to be corrupted and cannot be processed" for pdf to word convert

Hi Team,

I'm trying to use the Adobe PDF Services API to convert pdf to word using the Export end point.On calling the poll method I'm getting the below response.

{
    "cpf:inputs": {
        "params": {
            "cpf:inline": {
                "targetFormat": "docx"
            }
        },
        "documentIn": {
            "cpf:location": "InputFile",
            "dc:format": "application/pdf"
        }
    },
    "cpf:engine": {
        "repo:assetId": "urn:aaid:cpf:Service-26c7fda2890b44ad9a82714682e35888"
    },
    "cpf:status": {
        "completed": true,
        "type": "",
        "title": "For application/pdf mime-type The input file appears to be corrupted and cannot be processed.; transactionId=So6I44ey8ylmc0edFm8INJLgfFjOGpZJ",
        "status": 400,
        "report": "{\"error_code\":\"CORRUPT_DOCUMENT\"}"
    }
}
 
Following is the code where call to Export end point happens
var client = new RestClient(url); //https://cpf-ue1.adobe.io/ops/:create

var request = new RestRequest();
request.Method = Method.Post;
request.AddQueryParameter("respondWith=", queryparam); 
request.AddHeader("Authorization", token);
request.AddHeader("Accept", "application/json,text/plain,*/*");
request.AddHeader("x-api-key", clientId);
request.AddHeader("Prefer", "respond-async,wait=0");
request.AddHeader("content-type", "multipart/form-data; boundary=----boundary");
request.AddParameter("multipart/form-data; boundary=----boundary",
"------boundary\r\nContent-Disposition: form-data; name=\"contentAnalyzerRequests\"\r\n\r\n" + jsonString +
"\r\n------boundary\r\nContent-Disposition: form-data; name=\"InputFile\"\r\n\r\n" + path + // loacl Path were we keep the pdf file. 
"\r\n------boundary--", ParameterType.RequestBody);

RestResponse adobeResponse = client.ExecuteAsync(request).Result;

 

contentAnalyzerRequests body:
{"cpf:inputs":{"params":{"cpf:inline":{"targetFormat":"docx"}},"documentIn":{"cpf:location":"InputFile","dc:format":"application/pdf"}},"cpf:engine":{"repo:assetId":"urn:aaid:cpf:Service-26c7fda2890b44ad9a82714682e35888"},"cpf:outputs":{"documentOut":{"cpf:location":"multipartLabelOut","dc:format":"application/vnd.openxmlformats-officedocument.wordprocessingml.document"}}}

 

 

Response:

{"cpf:status":{"completed":false,"type":"","title":"In Progress","status":202},"cpf:engine":{"repo:assetId":"urn:aaid:cpf:Service-26c7fda2890b44ad9a82714682e35888"},"cpf:inputs":{"params":{"cpf:inline":{"targetFormat":"docx"}},"documentIn":{"cpf:location":"InputFile","dc:format":"application/pdf"}}}

This topic is closed to new replies. Start a new post to keep the conversation going.

9 replies

Raymond Camden
Community Manager
Community Manager
May 25, 2022 3:48 PM UTC

Hi, can you share your PDF? If it is private, you can email it to me directly at jedimaster@adobe.com.

Translate
Participating Frequently
May 31, 2022 10:10 AM UTC

Hi, I tried with any pdf file(not specific to our requirement) getting same error you can also reach out to Darakhshan Khan <darkhan@adobe.com> i have shared a sample pdf to her.

Translate
Raymond Camden
Community Manager
Community Manager
May 31, 2022 2:26 PM UTC

Ok - then it may be in how you are using the REST API. I'm not familiar with the language you are using. Are you sure you are properly creating the multipart request and sending the binary data to the endpoint?

Translate