Skip to main content
Participant
September 22, 2021
Answered

How to get the pdf file after status api?

  • September 22, 2021
  • 1 reply
  • 3789 views

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?

This topic has been closed for replies.
Correct answer Naman98A1

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 - 

1. Java - https://github.com/adobe/pdfservices-java-sdk-samples/blob/master/src/main/java/com/adobe/pdfservices/operation/samples/createpdf/CreatePDFFromDOCX.java

2. Node - https://github.com/adobe/pdfservices-node-sdk-samples/blob/master/src/createpdf/create-pdf-from-docx.js

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.

1 reply

Naman98A1Correct answer
Participating Frequently
September 22, 2021

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 - 

1. Java - https://github.com/adobe/pdfservices-java-sdk-samples/blob/master/src/main/java/com/adobe/pdfservices/operation/samples/createpdf/CreatePDFFromDOCX.java

2. Node - https://github.com/adobe/pdfservices-node-sdk-samples/blob/master/src/createpdf/create-pdf-from-docx.js

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.

Participant
March 4, 2022

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"
        }
    }
}
Is it showing success of fail?
If success, how can I get converted pdf file content?
Thanks for any help for this.
Participating Frequently
March 4, 2022

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.