Print Page | Close Window

DPLLoadFromString for PowerBuilder

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2560
Printed Date: 07 Jun 25 at 5:16AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: DPLLoadFromString for PowerBuilder
Posted By: KANASTASI
Subject: DPLLoadFromString for PowerBuilder
Date Posted: 11 Mar 13 at 7:03PM
I'm currently using PowerBuilder 11.5 and trying to load a PDF from a string.  The PDFs in this application are stored in a SQL Server database as BLOBs.
 
For some reason I can't get DPLLoadFromString to work correctly.
 
Here is some of the code :
 
long il_instance_id
long li_ret
string ls_doc, ls_buf
long ll_len
blob lbob_doc
 
il_instance_id = DPLCreateLibrary()
li_ret = DPLunlockkey(il_instance_id, ls_debenu_key)
if li_ret = 0 then
 messagebox('Error','Could not unlock the Debenu tool.')
 return false
end if
ls_doc = string(lblob_doc)  //lblob_doc is a PDF blob from the database
ll_len = len(ls_doc)
ls_buf = DPLCreateBuffer(il_instance_id, ll_len)
if ls_buf = '0' then
 messagebox('Error','Could not create buffer.')
 return false
end if
DPLAddToBuffer(il_instance_id, ls_buf, ls_doc, len(ls_doc))
li_ret = DPLLoadFromString(il_instance_id, ls_buf,'')
if li_ret = 0 then
 messagebox('Error','Could not load the document (' + string(dpllasterrorcode(il_instance_id)) + ')')
 return false
end if
DPLReleaseBuffer(il_instance_id, ls_buf)
 
Any ideas?
Thanks!
 



Replies:
Posted By: Wheeley
Date Posted: 11 Mar 13 at 9:11PM
I don't think this will work. The string statement converts the binary data of the blob into unicode characters. You are going to have to write the blob to disc first with FileWriteEX and than open it with LoadFromFile.

Wheeley



Posted By: KANASTASI
Date Posted: 12 Mar 13 at 12:54PM
Thanks Wheeley for the reply.
 
I was hoping I could do all of the PDF work without going to disk.  If I use the ActiveX method do I still have to go to disk?


Posted By: Wheeley
Date Posted: 13 Mar 13 at 1:56AM
I think your problem is the string function in Powerbuilder. So the ActiveX will fail also. You could test this of course by writing the blob and the string to 2 different files and then try opening both of them as a pdf. My gut is telling me that the one which as a string will fail.

Wheeley



Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk