Hi Experts,
We have a web portal where we have an api which is called from the PowerBuilder application it will gives as a pdf file as out put. So We are using HTTPClient to achieve this but we are getting a response from web api but we stuck on where we dont know how we will convert that response into pdf file or how directly we can download that pdf file.
Code in PB:
Integer li_rc,li_FileNum
String ls_ReturnJson
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient
String ls_json = '{"BranchId":1, "RTFFileName":" test", "SpName": "test"}'
lnv_HttpClient.SetRequestHeader("Content-Type", "application/json;charset=UTF-8")
// Content-Length header set by SendRequest
li_rc = lnv_HttpClient.SendRequest("POST", "our-url", ls_json, EncodingUTF8!)
if li_rc = 1 and lnv_HttpClient.GetResponseStatusCode() = 200 then
lnv_HttpClient.GetResponseBody(ls_ReturnJson)
end if
Messagebox('',ls_ReturnJson)
Response we are getting as below:
%PDF-1.7
%����
1 0 obj
<</Type/Catalog/Pages 2 0 R/Lang(en-IN) /StructTreeRoot 20 0 R/MarkInfo<</Marked true>>/Metadata 75 0 R/ViewerPreferences 76 0 R>>
endobj
2 0 obj
<</Type/Pages/Count 1/Kids[ 3 0 R] >>
endobj
3 0 obj
<</Type/Page/Parent 2 0 R/Resources<</Font<</F1 5 0 R/F2 9 0 R/F3 11 0 R/F4 13 0 R>>/ExtGState<</GS7 7 0 R/GS8 8 0 R>>/XObject<</Image18 18 0 R>>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/MediaBox[ 0 0 612 792] /Contents 4 0 R/Group<</Type/Group/S/Transparency/CS/DeviceRGB>>/Tabs/S/StructParents 0>>
endobj
4 0 obj
<</Filter/FlateDecode/Length 2635>>
stream
x��\[O�H~G�?ڗd4)\�\���v����C�B�8���`�ſ�sNٹ�ir)�H@\��|�~)�O��QrS�7o��"��C68���^�<�����]�wyvx�|]���i2L'GG������x��Y!Y�"�m�d�t�_X��wr��w�N0!x���hO�}�HH͌y������a�O�'�����z��7��Wv���������^'
7����p�'yQ��9}��ONU��%�ve�^<&��vʂ�Iv�:i��r���l@��KŢ(��U�M��.��h$�1�&�<�Kh�(
so we are stuck after this. I need to show the pdf file from this response.