How to download PDF after API conversion

New Here ,
Jun 10, 2022 Jun 10, 2022

Copy link to clipboard

Copied

Hi,

I've been trying to use Adobe PDF Services API to transform a .docx to .pdf. I used the exemple Postman colection following the given steps (https://documentcloud.adobe.com/document-services/index.html?_gl=1*1ckwf6v*_gcl_aw*R0NMLjE2NTQ3ODE0M... and it seems to work fine. The problem is that I can't manage to get the pdf from the response. It seems to have a PDF in octet-stream, but no matter how I try to save it, I don't get a PDF.

For exemple, if I try to save all the response body and change the file name to .pdf, it opens a PDF with the right number of pages, but completly empty. That happens even if I keep only the part between %PDF-1.7 and %%EOF in the file.

 

The response I get from the GET request has the following structure in the body:

 

--Boundary_96548_2076176993_1654878435333
Content-Type: application/json
Content-Disposition: form-data; name="contentAnalyzerResponse"

{"cpf:inputs":{"documentIn":{"cpf:location":"InputFile0","dc:format":"application/vnd.ms-excel"}},"cpf:engine":{"repo:assetId":"urn:aaid:cpf:Service-1538ece812254acaac2a07799503a430"},"cpf:status":{"completed":true,"type":"","status":200},"cpf:outputs":{"documentOut":{"cpf:location":"multipartLabel","dc:format":"application/pdf"}}}
--Boundary_96548_2076176993_1654878435333
Content-Type: application/octet-stream
Content-Disposition: form-data; name="multipartLabel"

%PDF-1.7
%����
26 0 obj
<</Linearized 1/L 49046/O 29/E 44186/N 1/T 48406/H [ 576 164]>>
endobj

------------------------A LOT OF BROKEN LINES (SEEMS LIKE A DOCUMENT)-------------------

%%EOF

--Boundary_96548_2076176993_1654878435333--

 

Ps: I tried the same thing in python and got same error. I also tried with a .xlsx file, same thing.

If someone can give me some light, thank you very much!

TOPICS
PDF Services API

Views

79

Likes

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 ,
Jun 13, 2022 Jun 13, 2022

Copy link to clipboard

Copied

Following up: It seems that the problem is not in the "saving the PDF" part, because if I just download the answer and save as .pdf it will be recognized as a PDF with the right number of pages and the right author. However the document is still blank. I've tried oppening in Edge, Google Chrome and Adobe Acrobat online, all blank. I've also tried with different docx and even an image. They all seem to have the right format (number of page and landscape orientation for the image), but all blank.
I suppose that there is some kind of problem or encription in the PDF, but I was unable to recognize it.
I'll be thankfull if anyone has any idea of what is happening.  

Likes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I am having exactly the same issue when using the POST documentGeneration endpoint.

 

This is the response I am getting (truncated - full response in the file attached):

 

--Boundary_812220_251886961_1659454852919
Content-Type: application/json
Content-Disposition: form-data; name="contentAnalyzerResponse"

{"cpf:inputs":{"documentIn":{"dc:format":"application/vnd.openxmlformats-officedocument.wordprocessingml.document","cpf:location":"InputFile0"},"params":{"cpf:inline":{"outputFormat":"pdf","jsonDataForMerge":{"customerName":"Kane Miller","customerVisits":100,"itemsBought":[{"name":"Sprays","quantity":50,"amount":100},{"name":"Chemicals","quantity":100,"amount":200}],"totalAmount":300,"previousBalance":50,"lastThreeBillings":[100,200,300],"photograph":"data&colon;image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP88h8AAu0B9XNPCQQAAAAASUVORK5CYII="}}}},"cpf:engine":{"repo:assetId":"urn:aaid:cpf:Service-52d5db6097ed436ebb96f13a4c7bf8fb"},"cpf:status":{"completed":true,"type":"","status":200},"cpf:outputs":{"documentOut":{"cpf:location":"multipartLabel","dc:format":"application/pdf"}}}
--Boundary_812220_251886961_1659454852919
Content-Type: application/octet-stream
Content-Disposition: form-data; name="multipartLabel"

%PDF-1.7
%����
184 0 obj
<</Filter/FlateDecode/First 857/Length 1279/N 101/Type/ObjStm>>stream
hޜX[k�I�+zl�2��
J�Kw	�]J��v��#;xh����fzK��2$�lK猤#{��(f*�b�Ć_�Z)	�()UJF�J�jEH"Ɣ2lAZ!f��*lAb ��6'�B�b��Ńl�&

(...truncated...)

 

Likes

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
LEGEND ,
Aug 03, 2022 Aug 03, 2022

Copy link to clipboard

Copied

LATEST

That isn't a PDF. It's a multipart response that INCLUDES a JSON and PDF; the PDF must be extracted from it.

Likes

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

Make content for your business needs with Adobe Express.

Get started easily with free templates: