1. Martin Mueller
  2. PowerBuilder
  3. Thursday, 26 September 2019 18:17 PM UTC

Hi all,

we made an interface to send customer information via webservice to an accounting company and get back a string base64 encoded.

lnv_HttpClient.GetResponseBody( ls_pdf )

It should be pdf informations, but how do I save these information as pdf????

Any ideas would be appreciated

best regards

Martin

 

Martin Mueller Accepted Answer Pending Moderation
  1. Tuesday, 15 October 2019 03:05 AM UTC
  2. PowerBuilder
  3. # 1

Sorry for my late response.

Thaks to all of you for your help!

Now it works fine like this:

lnv_HttpClient.GetResponseBody(ls_ReturnJson)
... some code for filtering the pdf data

ls_filename = "test.pdf"
    
li_fh = FileOpen(ls_filename, StreamMode!,Write!,LockWrite!,Replace!)

if li_fh < 1 then
    messagebox("error","error creating " + ls_filename)
    return
end if

CoderObject lnv_CoderObject
lnv_CoderObject = Create CoderObject

lbl_blob = lnv_CoderObject.Base64Decode(ls_ReturnJson)

FileWrite(li_fh,lbl_blob)
FileClose( li_fh )

best regards

Martin

 

Comment
  1. Michael Kramer
  2. Tuesday, 15 October 2019 08:37 AM UTC
Martin, Thanks for "paying it forward" by telling tus (he community) how you implemented this technical requirement. One more solution to learn from.
  1. Helpful
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 26 September 2019 20:38 PM UTC
  2. PowerBuilder
  3. # 2

Hi Martin;

  Roland and John are correct but, you will need to decode the BASE64 data first back into its native (binary) format within the Blob variable before writing that PDF data to disk.

Regards ... Chris

Comment
  1. Michael Kramer
  2. Thursday, 26 September 2019 21:01 PM UTC
Class = CoderObject, Function = Base64Decode.

Fine F1-Help with code sample. Enjoy! /Michael
  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Thursday, 26 September 2019 19:31 PM UTC
  2. PowerBuilder
  3. # 3

Try using a Blob variable with the GetResponseBody call and write that to disk.

Comment
There are no comments made yet.
John Raghanti Accepted Answer Pending Moderation
  1. Thursday, 26 September 2019 18:29 PM UTC
  2. PowerBuilder
  3. # 4

Did you try:

 

li_file = FileOpen("C:\test.pdf", StreamMode!, Write!, LockReadWrite!, Replace!)

FileWrite(li_file, ls_pdf)

FileClose(li_file)

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.