Good excuse my English, I use the PowerBuilder 10.5 made a query to a database that contains PDF files with SelectBlob and want to transform it to a PDF file returns me corrupt file and double the size.
In PowerBuilder 9.0 if it works, please if you could help me and I'm 2 days with that problem.
The following is the function.
li_numarch = FileOpen (ls_pathname, streamMode !, write !, lockwrite !, Replace!)
li_numarch if <0 then return -1
ll_BlobLen = Len (a_blob)
If ll_BlobLen> 32765 Then
If Mod (ll_BlobLen, 32765) = 0 Then
li_Writes = ll_BlobLen / 32765
else
li_Writes = (ll_BlobLen / 32765) + 1
End if
else
li_Writes = 1
End if
ll_CurrentPos = 1
For li_Cnt = 1 To li_Writes
ls_blob = BlobMid (a_blob, ll_CurrentPos, 32765)
ll_CurrentPos + = 32765
If FileWrite (li_numarch, ls_blob) = -1 Then
FileClose (li_numarch)
FileDelete (ls_pathname)
return -1
end if
Next
FileClose (li_numarch)