gxenglish-l |
| Jannie Louw | |
I am trying to read a blob (which is a .pdf blob) from the database and save it in a .pdf file on the disk using the following program: for each where BlobLoadNo = &WIPNo &BlobPath = BlobLoadBlob // Defined as Path e.g. Character(200) &i = dfropen(&BlobPath,8192,"") // Opening the temporary file with length of 8192. &i = dfrnext( ) &i = dfrgTxt(&ContentStr) // Reading the Contents of the file in a LongVarChar(1M) &i = dfrclose() &i = dfwopen("C:\Temp\PDF1.pdf",,0) // Saving the contents as a pdf file. In the real program this a variable which fives the path and file name &i = dfwptxt(&ContentStr) // Saving the string &i = dfwnext( ) &i = dfrclose() when none &Ind = "N" Endfor When I run the program I get an error -1 for the &i = dfropen(&BlobPath,8192,"") statement. I suspect this is because the file is a temporary file which is still open with the &BlobPath = BlobLoadBlob statement. I also tried to read the Blob in a blob variable and save it to the .pdf file using: for each where BlobLoadNo = &WIPNo and BlobLoadDocTypeNo = &DocTypeNo &fileblob = BlobLoadBlob &FileName = 'C:\Temp\PDF1.pdf' &i = dfwopen(&FileName,,,0) &i = dfwptxt(&fileblob) &i = dfwnext() &i = dfrclose() when none &Ind = "N" Endfor I then get a "Object reference not set to an instance of an object" error for the &i = dfwptxt(&fileblob) statement. I also get this error for the first program if I step to the &i = dfwptxt(&fileblob) statement I am able to read and display the blob using: for each where BlobLoadNo = &WIPNo &fileblob = BlobLoadBlob when none &Ind = "N" endfor If &Ind = "Y" &httpresponse.AddFile(&fileblob) &httpresponse.AddHeader('Content-Type','application/pdf') EndIf Any help will be appreciated |
|
|
| | |
Back to gxenglish-l |
|