• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to get the pdf file after status api?

New Here ,
Sep 21, 2021 Sep 21, 2021

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?

TOPICS
PDF Services API

Views

3.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Sep 22, 2021 Sep 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

...

Votes

Translate

Translate
Explorer ,
Sep 22, 2021 Sep 22, 2021

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 - 

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

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

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2022 Mar 04, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 04, 2022 Mar 04, 2022

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2022 Mar 04, 2022

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"
		}
	}
}'}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 04, 2022 Mar 04, 2022

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\"}"}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 04, 2022 Mar 04, 2022

Copy link to clipboard

Copied

LATEST

Hi @Hello23434000g9ly

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources