Copy link to clipboard
Copied
Hello,
I am able to successfully convert the word doc to pdf using generation api - https://documentcloud.adobe.com/document-services/index.html#get-documentGeneration-status.
I get can see the success output in the postman.
--Boundary_333122_1595253404_1632276260542
Content-Type: application/json
Content-Disposition: form-data; name="contentAnalyzerResponse"
{"cpf:inputs":{"documentIn":{"cpf:l
********
--Boundary_333122_1595253404_1632276260542
Content-Type: application/octet-stream
Content-Disposition: form-data; name="Agreement_Template1"
%PDF-1.6 %âãÏÓ
133 0 obj <</Linearize
How can I extract the pdf content from it? or Save the result as pdf file?
Or would you recomend using the PDF SDK for it?
Hi @dpakc - Thanks a lot for trying out our product.
The response of GET /status API call is a multipart response. You may need to read the part containing PDF stream and save it as a PDF file. There are a few ways to achieve it:
Using Postman
Postman client provides the way through which you can save the response to a file using Save Response construct.
You can use the following steps -
1. Click on Save Response -> Save to a file.
2. Rename the file to {{outputFileName}}.pdf and save the file.
Using
...Copy link to clipboard
Copied
Hi @dpakc - Thanks a lot for trying out our product.
The response of GET /status API call is a multipart response. You may need to read the part containing PDF stream and save it as a PDF file. There are a few ways to achieve it:
Using Postman
Postman client provides the way through which you can save the response to a file using Save Response construct.
You can use the following steps -
1. Click on Save Response -> Save to a file.
2. Rename the file to {{outputFileName}}.pdf and save the file.
Using PDFServices SDK
The PDF Services SDKs have the capability to parse the multipart response and save the PDF content in response, to a PDF file. We have easy to use samples available in different languages, which you can leverage for the use case -
3. DotNet - https://github.com/adobe/PDFServices.NET.SDK.Samples/blob/master/CreatePDFFromDocx/Program.cs
Using Standard MultiPart libraries
There are standard libraries available in different languages which can be used to parse multipart response and return specific parts in it. The content-type of the part containg PDF content is - application/octet-stream. You can retrieve the part and save it as PDF file.
Hope this helps.
Copy link to clipboard
Copied
Hello, I'm trying convert image to pdf using PDF services API.
I got the response like below.
{
"cpf:status": {
"completed": false,
"type": "",
"title": "In Progress",
"status": 202
},
"cpf:engine": {
"repo:assetId": "urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430"
},
"cpf:inputs": {
"documentIn": {
"cpf:location": "InputFile0",
"dc:format": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
}
}
Copy link to clipboard
Copied
Hello @Hello23434000g9ly - Thank you for trying our PDF Services functionality.
The response 202 of the API states that the conversion is still In Progress on our servers and is not yet complete.
The following field -
"title": "In Progress",
resembles the status of the conversion.
You need to poll on GET /status API until the conversion status comes to be 200. Please refer to the following documentation - https://documentcloud.adobe.com/document-services/index.html#get-createPDF-status for more details.
Depending on the file size and content, the conversion can take a few seconds on the server. Polling on GET /status API will return the converted file once the conversion is successful on the server.
Hope this is helpful.
Copy link to clipboard
Copied
Thanks for your quick reply.
I could get pdf converted in postman by removing "'Prefer': 'respond-async,wait=0'".
Now I'm writing python script with Requests.
But this has error in request body.
Could you give me how to parse it?
Thanks.
payload={'contentAnalyzerRequests': '{
"cpf:inputs": {
"documentIn": {
"cpf:location": "InputFile0",
"dc:format": "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
}
},
"cpf:engine": {
"repo:assetId": "urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430"
},
"cpf:outputs": {
"documentOut": {
"cpf:location": "multipartLabelOut",
"dc:format": "application/pdf"
}
}
}'}
Copy link to clipboard
Copied
I used payload as JSON format and this is error message I got.
{"requestId":"A1FYwge6XuJIaYS65X93FthYa5Z1c4dG","type":"Bad Request.","title":"Missing multipart field contentAnalyzerRequests","status":400,"report":"{\"error_code\":\"INVALID_REQUEST\"}"}
Copy link to clipboard
Copied
The requests to invoke PDF Services APIs are multipart requests.
1. The contentAnalyserRequests should be the first part of multipart request.
2. The second part of it should be File Content.
In general, the way you provide is -
PART 1
Name - contentAnalyserRequests
Value - Your Payload as you provided above
PART 2
Name - InputFile0
Value - The input file content.
Refer the documentation for more details - https://documentcloud.adobe.com/document-services/index.html#post-createPDF -> Form Parameters.
Please let us know if you see issues using the APIs.
Hope this helps.