Source language: Translate to:

Store PDF in database

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Store PDF in database

Postby dotchiejack » Sun Dec 14, 2014 8:12 am

Hello,

I have a database with 4 fields,
1: Name
2: Description
3: Photp
4: Pdf
Field 1 and 2 are text files
Field 3 and 4 are ole objects

Field 1,2and 3 are oke for wat i want

Fiekd 4 gives me problems
Field 4 should store PDF files, what is not a problem but they should be visible in or a retangle or a picture field and i can not see how
so record 1 should show
name 1
descrpition 1
foto1
pdf 1
record 2 should show
name2
description 2
foto2
pdf2
etc...
Please some help
THanks
dotchiejack
 
Posts: 7
Joined: Sat Oct 19, 2013 9:55 am

Re: Store PDF in database

Postby carlos torres » Sun Dec 14, 2014 8:46 am

Dear dotchiejack

You have some options:
1 - Use both path+ filename for the pdf and picture fields.
2 - Encrypt the pfd files and keep them in an specific folder (see Neobinary plugin by David from Argentina)
3 - Store the picture files in a database field as OLE Object

Hope it helps you

regards
carlost
User avatar
carlos torres
 
Posts: 289
Joined: Mon May 02, 2005 8:14 am
Location: Pamplona, Colombia

Re: Store PDF in database

Postby stu » Sun Dec 14, 2014 6:28 pm

What about storing the file path of the PDF in the database, then bring it to neobook in a Webbrowser object and display the pdf with something like: https://github.com/mozilla/pdf.js
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Store PDF in database

Postby dotchiejack » Mon Dec 15, 2014 3:32 am

Hello,
Thank you for your answers , I looked into it but still dont get any further. So i post a screenshot, hopefully it makes everything clearer.

Thanks
Image
dotchiejack
 
Posts: 7
Joined: Sat Oct 19, 2013 9:55 am

Re: Store PDF in database

Postby stu » Mon Dec 15, 2014 10:21 am

Image

This is the most simple approach of a solution, works fine.

Download:
http://s000.tinyupload.com/index.php?fi ... 6067889522

As you would see the files live in the C drive, folder /pdf/
The database only store the paths and the viewer is actually a simple 'embed' tag that gets 'updated' every time you select a record from the database.

You could make it a lot more complex by using one of the many javascript libraries available online, such as the one I mentioned before.

:D
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am

Re: Store PDF in database

Postby dotchiejack » Mon Dec 15, 2014 11:00 am

Stu,

For me it is evening now but i will test it out tomorrow morning but if it workks you are great
Thanks
dotchiejack
 
Posts: 7
Joined: Sat Oct 19, 2013 9:55 am

Re: Store PDF in database

Postby dotchiejack » Tue Dec 16, 2014 1:15 am

Hello Stu,

I did what you said and the viewer works great, thank you for that.
I have another question
Is it possible that the PDF file stored in the database and in the textentry automaticly opens in the viewer?
That would be ideal

Thanks
dotchiejack
 
Posts: 7
Joined: Sat Oct 19, 2013 9:55 am

Re: Store PDF in database

Postby stu » Tue Dec 16, 2014 7:19 am

Ok, to do that create a OLE field on your Database (maybe the example one) and then create a form so you can Add records to that field.

One you have your PDFs on the database change the example code of 'Select' button for something like:

Code: Select all
dbpPopupValueList "PDFS" "files" "Path" "Title" "Left=8;Top=31;Width=184;RowCount=7" "[FILE]"
BrowserGoTo "WebBrowser2" "[PDFS.files.ActualFile]"


That will reload the browser with your selected PDF, thats because when your on one of your records the variable containing the binary data (PDF) will reconstruct the file on a temp directory. Something like: C:\Users\Username\AppData\Local\Temp\45905968.pdf

That's the way to go homie!

And last but not least I feel in the obligation of pointing the fact that storing files such as pdfs on a database its not a good idea. You could refer to this post for more info: viewtopic.php?f=21&t=20783 or even more info https://www.google.com/?gws_rd=ssl#q=st ... n+database
User avatar
stu
 
Posts: 320
Joined: Wed Aug 07, 2013 11:37 am


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 3 guests