Sample code for 30+ languages & platforms
PowerBuilder

Yousign: Download File to Memory

See more Yousign Examples

Downloads a previously uploaded Yousign file (PDF) to memory.

Chilkat PowerBuilder Downloads

PowerBuilder
integer li_rc
integer li_Success
oleobject loo_Http
string ls_DownloadUrl
oleobject loo_PdfData

li_Success = 0

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

loo_Http = create oleobject
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
    destroy loo_Http
    MessageBox("Error","Connecting to COM object failed")
    return
end if

// Adds the "Authorization: Bearer YOUR_API_KEY" header.
loo_Http.AuthToken = "YOUR_API_KEY"

ls_DownloadUrl = "https://staging-api.yousign.com/files/XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX/download?alt=media"

loo_PdfData = create oleobject
li_rc = loo_PdfData.ConnectToNewObject("Chilkat.BinData")

li_Success = loo_Http.DownloadBd(ls_DownloadUrl,loo_PdfData)
if li_Success = 0 then
    Write-Debug loo_Http.LastErrorText
    destroy loo_Http
    destroy loo_PdfData
    return
end if

// Your application may now access the data contained in "pdfData".

Write-Debug "Success"


destroy loo_Http
destroy loo_PdfData