Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 10 of 11 total |
Adding PDF to EDB table |
Sun, Dec 8 2019 9:29 PM | Permanent Link |
Mic Thurber Software for Ministry | Hi,
In trying to add a PDF file to a BLOB field in a table, I've tried: (tbDocs.FieldByName('Document') as TBlobField).LoadFromFile('TestDoc.PDF'); The field Document is a Blob field within the tbDocs table. The load seems to work fine, and I can save it to the table just fine, but when I try to view it later, it isn't viewable as a PDF document but rather the code that makes it up. I've attached a screen grab to show what I mean. Not sure what I'm doing incorrectly, but I'd be grateful for any help anyone can offer. Thanks. Mic Thurber Attachments: BlobLook.JPG |
Sun, Dec 8 2019 11:30 PM | Permanent Link |
Ian Branch | Hi Mic,
I have found it very frustrating to try to view 'documents' in general inside Delphi. This includes everything from M$oft Office files to multimedia files. The strategy I now employ is to use whatever Windows application is the default for the file type and let Windows worry about it. I do this by telling Windows to 'Run' the file in question. e.g. {code} ShellExecute(Handle, 'open', 'c:\MyDocuments\somefile.pdf',nil,nil,SW_SHOWNORMAL) ; {code} I have yet to find a common file that hasn't worked using this 'technique'. You need ShellAPI in the uses clause, and of course the file type has to be associated with an App in Windows. A side benefit of this is that once called/open the 'display' and handling of the file in question is independent of your Delphi application and it can continue.. HTH. Regards, Ian |
Sun, Dec 8 2019 11:33 PM | Permanent Link |
Ian Branch | Your obvious question to the above is how to get the file from your database to a file..
Two options, depending on your situation.. 1. Don't store the actual file, instead store where it is located. or 2. Stream it to a temp file with the appropriate extension and the call/run it per the above. Just my thoughts I'm sure others have other techniques. Ian |
Mon, Dec 9 2019 2:10 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Mic
It would help to say how you're trying to view the blob. I'd pretty much agree with Ian, I always wrote a file out with the appropriate extension and used ShellExecute. Roy Lambert |
Mon, Dec 9 2019 12:30 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Mic,
<< In trying to add a PDF file to a BLOB field in a table, I've tried: (tbDocs.FieldByName('Document') as TBlobField).LoadFromFile('TestDoc.PDF'); The field Document is a Blob field within the tbDocs table. The load seems to work fine, and I can save it to the table just fine, but when I try to view it later, it isn't viewable as a PDF document but rather the code that makes it up. I've attached a screen grab to show what I mean. >> That's normal - all BLOB fields in EDB are simply displayed as binary in the EDB Manager because it doesn't really have any way (currently, it is possible, of course) to display such formats. The workaround is to simply save the BLOB as a file on disk and then open the file using whatever application is appropriate. Tim Young Elevate Software www.elevatesoft.com |
Mon, Dec 9 2019 3:24 PM | Permanent Link |
Mic Thurber Software for Ministry | Thanks, all. I appreciate the answers.
Since this app is FMX with an eye toward having it also be a Mac app, I couldn't use ShellExecute (well, I could for the Windows side...). I was hoping I could display the PDF as a page within Fast Reports. But the data did not load into an Image component in FR, now would it display as text, obviously. I've not yet discovered if there's a Mac function analogous to ShellExecute. I guess I'll keep digging. But I do appreciate everyone's giving me some good direction and options. I will probably just end up storing a file name and location rather than the actual file itself. Mic |
Mon, Dec 9 2019 3:25 PM | Permanent Link |
Mic Thurber Software for Ministry | Thanks, all. I appreciate the answers.
Since this app is FMX with an eye toward having it also be a Mac app, I couldn't use ShellExecute (well, I could for the Windows side...). I was hoping I could display the PDF as a page within Fast Reports. But the data did not load into an Image component in FR, now would it display as text, obviously. I've not yet discovered if there's a Mac function analogous to ShellExecute. I guess I'll keep digging. But I do appreciate everyone's giving me some good direction and options. I will probably just end up storing a file name and location rather than the actual file itself. Mic |
Mon, Dec 9 2019 10:05 PM | Permanent Link |
Raul Team Elevate | On 12/9/2019 3:25 PM, Mic Thurber wrote:
> Since this app is FMX with an eye toward having it also be a Mac app, I couldn't use ShellExecute (well, I could for the Windows side...). > > I was hoping I could display the PDF as a page within Fast Reports. But the data did not load into an Image component in FR, now would it display as text, obviously. > > I've not yet discovered if there's a Mac function analogous to ShellExecute. I guess I'll keep digging. > Don't have any Firemonkey experience but embedded web browser control might do the trick for key file types. In theory should reasonably cross platform as well Raul |
Tue, Dec 10 2019 5:58 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
Congratulations - my brain just didn't think of viewing it in EDBManager's clob/blod display Roy Lambert |
Tue, Dec 10 2019 5:58 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Mic
Now I understand a bit more depending on your budget you could have a look at WPTools - they have a PDF option (can't remember if its a writer or viewer or both) and will compile into your application. There's also synPDF from Synopse - freeware. I'm useing it to produce PDFs but I think it can read them as well. Roy Lambert |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |