Source language: Translate to:

pdf question

Questions about using NeoBook's scripting language

Moderator: Neosoft Support

pdf question

Postby zina » Mon Aug 25, 2014 8:30 am

hello, everybody,

I want to be able to choose a pdf file in my documents that appears in a rectangleobject an then send to a database, does somebody knows the right acctioncommands

thank you
zina
 
Posts: 19
Joined: Thu Aug 07, 2014 9:48 am

Re: pdf question

Postby dpayer » Mon Aug 25, 2014 9:39 am

zina wrote:hello, everybody,

I want to be able to choose a pdf file in my documents that appears in a rectangleobject an then send to a database, does somebody knows the right acctioncommands

thank you



Do you want to select the file, then display it and then record the *reference* to the file (the file name and location) or do you want to store the actual file in the database?

I had a PDF Printer project once. Basic steps:

1) get a list of PDFS in a folder using something like:
Code: Select all
FileList "[PDFfolder]\*.pdf" "Files" "[PDFList]"


2) display the list in a listbox so the variable of the file clicked is: [selectedfilename]

3) action for listbox when clicked ----> display PDF in rectangle using something like:
Code: Select all
pdfOpen "[SelectedFileName]" "AutoDisplay"


4) save reference by using the concatenated file name:
[pdffolder]\[selectedfilename]

and put it in the database.
David Payer
Des Moines, Iowa
USA
User avatar
dpayer
 
Posts: 1384
Joined: Mon Apr 11, 2005 5:55 am
Location: Iowa - USA

Re: pdf question

Postby zina » Tue Aug 26, 2014 11:01 am

Thank you Dave,

I will check out your ideas as soon as possiblie. Due to the heavy rain i did not have time to look into it ( a lot of watertrouble at work). For the moment 3 screenshots
Image Image
Image

I hope this makes it more clear for you
Any suggestions are welcome
Thanks Dave
zina
 
Posts: 19
Joined: Thu Aug 07, 2014 9:48 am

Re: pdf question

Postby zina » Sun Aug 31, 2014 10:28 am

hello,

I used this code
Code: Select all
FileOpenBox "Kies een bestand" "Pdf Files|*.pdf;" "" "[PDFlist]" ""
If "[PDFlist]" "<>" ""
SetVar "[Haakje.Hakenkledingkinderen.Uitleg]" "[PDFlist]"
EndIf
pdfOpen "[PDFlist]" "Rec1"

I can choose a pdf file, and it appears in the rectangel object, it also goes into the database but when i add the next record and i go back to the previous record the pdf changed I want record one with pdf one and record two with record two and so one
Any one suggestions?

thanks
zina
 
Posts: 19
Joined: Thu Aug 07, 2014 9:48 am

Re: pdf question

Postby Gaev » Sun Aug 31, 2014 4:39 pm

zina:

I am having trouble understanding your problem.

1)
I can choose a pdf file, and it appears in the rectangel object, it also goes into the database

... this is in line with your posted code.

2)
but when i add the next record and i go back to the previous record

... if this is done via script, post your code for this ... otherwise, explain in detail what "user action" you are taking

3)
the pdf changed

... what do you mean by this ... again, explain in detail (with example file names).

I want record one with pdf one and record two with record two and so one

... I do not understand ... please explain in detail (with example file names)
User avatar
Gaev
 
Posts: 3738
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Re: pdf question

Postby ebear » Mon Sep 01, 2014 2:42 pm

Hello Zina,

Nice to see some Dutch text in your script, I'm also from the Netherlands, but living in the Czech republic.

I understand you problem, I use this in a lot of my applications but....

To save space in the Database (MS-SQL mainly). I don't save the PDF in a database but only the path (filename) to the PDF.

1. Open the PDF, the variable eg. [PDF] will contain the complete path and filename of the PDF.

2. Extract the filename only from [PDF]
Code: Select all
ExtractFileName "[PDF]" "[PDFFileNameOnly]"


3. Copy the PDF file to a special location for example [PubDir]PDF
Code: Select all
FileCopy "[PDF]" "[PubDir]PDF\[PDFFileNameOnly]"


4. Save the filename of the PDF in the database
Code: Select all
SETVAR "[DB.TABLE.PDFfilename]" "[PDFFileNameOnly]"
Don't forget to save the record.

5. Then open the PDF in the rectangle
Code: Select all
[PubDir]PDF\[DB.TABLE.PDFName]
(I use most of the time a WebBrowser object for opening PDF files.

I hope this will help...

Best regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: pdf question

Postby zina » Sat Sep 06, 2014 1:19 am

Hi Eric, stored in
Thank you for your help
First of all I am new to neobook and I am not a programmer, I just want to make a database for my wife to store all here knitting stuff.
From your explenation I made the following code of it
Code: Select all
ExtractFileName "[PubDir]Teksten" "[PDFFileNameOnly]"
FileCopy "[PubDir]Teksten" "[PubDir]Teksten\[PDFFileNameOnly]"
SETVAR "[Haakje.Hakenkledingkinderen.Uitleg]" "[PDFFileNameOnly]"
[PubDir]Teksten\[Haakje.Hakenkledingkinderen.Uitleg]
but i get an error message access denied.
Maybe you can help me out a bit further
Some explanation
THE pdf's are stored in C:\Users\Zina\Documents\Patronen\Teksten
Databassename is Haakje
Tablename is Hakenkledingkinderen
Fieldname is Uitleg
I hope you can help me a little further
Thanks
zina
 
Posts: 19
Joined: Thu Aug 07, 2014 9:48 am

Re: pdf question

Postby ebear » Sat Sep 06, 2014 11:21 am

Hello Zina,

Sorry I made a failure, in my case I need to find the file extension, but for you this is not needed.

See below an example, these is no database function in the code. I think the database function you already understand
Please copy the below code, copy this code in a text file "haakje.pub". Save "haakje.pub" in a folder, in the folder should also be a subfolder "Teksten". After this open "haakje.pub" in Neobook and run it.

I hope this will help you.

Regards,

Eric

Code: Select all
NBW Publication Source File
(C)2014 NeoSoft Corp.
Title=Untitled NeoBook Publication
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=1500
ScreenHeight=850
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=21
Name=PDFViewer_Container
X=0
Y=100
W=1500
H=750
Anchor=5
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
TabOrder=3
HMargin=0
VMargin=0
ContainerBegin
ObjectType=14
Name=PDFViewer_WebBrowser
X=0
Y=0
W=1500
H=750
Anchor=5
FileName=[PDFBestand]
VarName=[PDFViewer_WebBrowserStatus]
TitleVarName=[PDFViewer_WebBrowserTitle]
URLVarName=[PDFViewer_WebBrowserAddr]
LineColor=8421504
LineWidth=2
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=10445864
TabOrder=0
ContainerEnd
ObjectType=21
Name=Menu_Container
X=0
Y=0
W=1500
H=100
Anchor=1
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
TabOrder=1
HMargin=0
VMargin=0
ContainerBegin
ObjectType=3
Name=OpenANDsavePDfbestand_PushButton
X=0
Y=0
W=300
H=100
Anchor=3
Text=Open PDF bestand en sla op in  PubDir/Teksten
Align=2
ImageStyle=0
BevelWidth=0
XPTheme=Yes
ObjAction=FileOpenBox "Open PDF file" "PDF|*.pdf" "" "[PDF_File]" ""¶ExtractFileName "[PDF_File]" "[FileNameOnly]"¶FileCopy "[PDF_File]" "[PubDir]Teksten\[FileNameOnly]"¶SETVAR "[Haakje.Hakenkledingkinderen.Uitleg]" "[FileNameOnly]"
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=10445864
TabOrder=0
ObjectType=21
Name=BekijkPDF_Container
X=1070
Y=0
W=430
H=100
Anchor=4
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
TabOrder=1
HMargin=0
VMargin=0
ContainerBegin
ObjectType=3
Name=OpenPDF2_Button
X=0
Y=50
W=430
H=50
Anchor=1
Text=2. Bekijk PDF bestand in PDF programma
Align=2
ImageStyle=0
BevelWidth=0
XPTheme=Yes
ObjAction=Run "[PubDir]Teksten/[Haakje.Hakenkledingkinderen.Uitleg]" "" "Normal" "" ""
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=10445864
TabOrder=0
ObjectType=3
Name=OpenPDF1_Button
X=0
Y=0
W=430
H=50
Anchor=1
Text=1. Bekijk PDF bestand via WebBrowserObject
Align=2
ImageStyle=0
BevelWidth=0
XPTheme=Yes
ObjAction=SETVAR "[PDFBestand]" "[PubDir]Teksten/[Haakje.Hakenkledingkinderen.Uitleg]"
LineColor=8421504
LineWidth=0
LineStyle=0
FillColor=44065832
FillPattern=1
FillMode=Yes
Font=Arial
FontSize=9
FontStyle=0
FontCharset=1
TextColor=10445864
TabOrder=1
ContainerEnd
ContainerEnd
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: pdf question

Postby zina » Sun Sep 07, 2014 2:08 am

Hi Eric,
You have been a great help
My problem is solved
Thank you

grtz
:P
zina
 
Posts: 19
Joined: Thu Aug 07, 2014 9:48 am

Re: pdf question

Postby ebear » Mon Sep 08, 2014 10:49 am

Hello Zina,

No problem glad to help.

Main reason I don't save the PDF's in the db is the quick growing of the database and this slows the databases down.
Next to this, and with a filebased database the risk is even higher, if something happens with the database also all the PDF' will be lost.

Regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic

Re: pdf question

Postby ebear » Mon Sep 08, 2014 10:50 am

Hello Zina,

No problem glad to help.

Main reason I don't save the PDF's in the db is the quick growing of the database and this slows the databases down.
Next to this, and with a filebased database the risk is even higher, if something happens with the database also all the PDF' will be lost.

Regards,

Eric
http://www.lunarsoftware.eu - Lunar Software ERP database Development. Manufacturing processes, Document management, QMS, Stock management. Standalone solutions or connected to Helios Orange and other ERP systems.
User avatar
ebear
 
Posts: 270
Joined: Wed Jan 18, 2012 3:12 am
Location: Vrchlabi - Czech republic


Return to NeoBook Action Commands

Who is online

Users browsing this forum: No registered users and 0 guests