Welcome! Log In Create A New Profile

Advanced

WB11 Export "Field" Binary Type as a File to Client PC

Posted by Swissstephan 
Swissstephan
WB11 Export "Field" Binary Type as a File to Client PC
August 31, 2008 10:12PM
Weird Title, but I try to explain winking smiley

I have a field in my file type binary which holds for example a pdf.

Now I want to download the content of this field as proper pdf to the client machine

The thing I don't know.
How do I create a PDFfile from this field again?

Thanks a lot for any answer.
Stephan


Michael Drechsel
Re: WB11 Export "Field" Binary Type as a File to Client PC
September 01, 2008 08:15AM
Hi Stephan,

HExtractmemo is your friend:

HExtractMemo(Customer,Photo,"C:\temp\sample.pdf")

Put it in a temporary folder an start your acrobat with Shellexecute.

regards Michael
javier garcia.pcs.crosspost
Re: WB11 Export "Field" Binary Type as a File to Client PC
September 01, 2008 09:08AM
//Once you have generated the PDF file (I generate the PDF file in the dir exe)
gsFichero=fExeDir()+"\"+PDFName+".PDF"
IMG_PDF=gsFichero
FileName.FieldName=IMG_PDF
HModify(FileName)
//To extract the PDF file only have to do this:
gsFichero is string=""
gsFichero=ExtractString(HInfoMemo(FileName,FieldName),2,TAcool smiley
HExtractMemo(FileName,FieldName,gsFichero)
IMG_PDF=""
ShellExecute(gsFichero)
//You have your PDF file in the same directory where you created it.




Message forwarded from pcsoft.us.windev
Hi
First of all, Thanks for your help!!!
Everything works fine with Images, since I can say:

Display_BinaryField (Image control) = "c:\source.jpg"
File_BinaryField (File Item) = Display_BinaryField
HADD(BinaryFile)
HextractMemo(BinaryFile,File_BinaryField, "c:\target.jpg")

I receive a file "c:\target.jpg" like expected

but I can't do that with a .pdf

HLinkMemo(BinaryFile, File_BinaryField, "c:\source.pdf", hMemoBin)
HADD(BinaryFile)
HextractMemo(BinaryFile,File_BinaryField, "c:\target.pdf")

I receive nothing: No file, No error sad smiley
Any Ideas? Thanks for all help!
Hi Stephan,

it works with every kind of files. I wrote a small application (outlook for poor people ;-))
and use this function very often. We have amout 5 GB of attachments in our HFC/S Database with all kinds of files (pdf, doc plt etc.)

greetings md
Hi Michael
can you just write a code snippet like you put the pdf file in the binary field. Would make my live much easier :cheers:
Thanks
Stephan
Hello Stephan,

You might want to put checks in your code to see what did or did not happen.

I have a stored procedure that puts a file in a memo.

PROCEDURE sp_Doc_Get(sFilePath is string,sFileName is string,nMachineID is int)
sResult is string = ""

IF nMachineID > 0 THEN
//Build the storage string so we an check it to make sure it exist
sFileStorage is string = sFilePath+"\"+sFileName
IF HReadSeekFirst(MACHINE,ID,nMachineID) THEN
sResult = sResult+ "Machine Record Found"
IF fFileExist(sFileStorage) THEN
IF HLinkMemo(MACHINE,Saved_Documnet,sFileStorage,hMemoBin) THEN
sResult = sResult+ "Memo Saved"
ELSE
sResult = sResult+ "Memo Did Not Work"
END
IF HModify(MACHINE) THEN
sResult = "OK"
ELSE // HModify
sResult = sResult+"hModify Failed"
END
ELSE
sResult = sResult+ "Could Not Locate File"
END
ELSE //HreadseekFirst
sResult = "HreadSeek Failed"
END
ELSE // Machine ID
sResult = "Incorrect Machine ID"
END

RESULT = sResult

Seeing that I could not debug the stored procedure I set flags to tell me what worked and what did not.

Dennis w
Swissstephan
Everything works fine! Thanks a lot for your help!
September 07, 2008 09:17PM
Thanks again:cheers:
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: