1. Steve Wilson
  2. Valentina Reports ADK
  3. Воскресенье, Февраль 18 2018, 08:07 PM
  4.  Подписаться через email
Is Valentina Reports ADK for C a shared library (*.dll / *.so) that can be used with programming languages other than C?

To be specific I want to be able to use PureBasic to create CGI applications that generate and return Valentina reports (I know about Valentina server but I really just want to use the cgi-bin of a standard hosting package).

Thanks
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Thanks Sergey,

I'm very busy for the next few days but I'll get around to trying it as soon as I can.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Steve,

The version 8.0.2 is available for download
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Yes, we'll let you know when it will be ready.
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Thanks Sergey,

Will you post back when the new Linux build is available for download?
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Thank you, and now it works in my development build of VCSDK on Linux.
There was one more issue - in the next build, you'll be able to call just the Valentina_InitReports, without Valentina_Init.
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Thanks Sergey,

I just made a quick test and I'm pleased to say I can open a project, run a report and save it to a file :D


Enumeration
#Lib
EndEnumeration

Enumeration ValentinaReportPrintType
#kToUnknown
#kToMetafile
#kToPostscript
#kToPDF
#kToHTML
#kToLatex
#kToSVG
#kToPicture_GIF = 100
#kToPicture_JPG = 101
#kToPicture_PNG = 102
#kToPicture_TIFF = 103
#kToPicture_BMP = 104
EndEnumeration

Procedure Valentina_Init(mkey$,wkey$,lkey$,nReport=#False)
*bMkey = UTF8(mkey$)
*bWkey = UTF8(wkey$)
*bLkey = UTF8(lkey$)
If nReport
CallFunction(#Lib,"Valentina_InitReports",*bMkey,*bWkey,*bLkey)
Else
nCache = 10*1024*1024
CallFunction(#lib,"Valentina_Init",nCache,*bMkey,*bWkey,*bLkey)
EndIf
FreeMemory(*bMkey)
FreeMemory(*bWkey)
FreeMemory(*bLkey)
EndProcedure

Procedure Valentina_Shutdown(nReports=#True)
If nReports : CallFunction(#Lib,"Valentina_ShutdownReports") : EndIf
CallFunction(#Lib,"Valentina_Shutdown")
EndProcedure

Procedure.i Valentina_ProjectNew(filename$)
*bfr = UTF8(filename$)
nProject.i = CallFunction(#Lib,"Project_New",*bfr)
FreeMemory(*bfr)
ProcedureReturn nProject
EndProcedure

Procedure.i Valentina_ProjectOpen(nProject)
CallFunction(#Lib,"Project_Open",nProject)
EndProcedure

Procedure Valentina_ProjectClose(nProject)
CallFunction(#Lib,"Project_Close",nProject)
EndProcedure

Procedure.i Valentina_ReportCount(nProject)
ProcedureReturn CallFunction(#Lib,"Project_GetReportCount",nProject)
EndProcedure

Procedure.i Valentina_ReportOpen(nProject,name$,datasource$,sql$)
*bName = UTF8(name$)
*bDatasource = UTF8(datasource$)
*bSql = UTF8(sql$)
nRes = CallFunction(#Lib,"Project_MakeNewReportByNameWithDatasource",nProject,*bName,*bDatasource,*bSql)
FreeMemory(*bName)
FreeMemory(*bDatasource)
FreeMemory(*bSql)
ProcedureReturn nRes
EndProcedure

Procedure Valentina_ReportToDisk(nReport,out$,nFormat,nFromPage,nToPage)
*bOut = UTF8(out$)
CallFunction(#Lib,"Report_PrintToDisk",nReport,*bOut,nFormat,nFromPage,nToPage)
FreeMemory(*bOut)
EndProcedure

Procedure BailOut(msg.s,nProject)
Debug msg
If nProject > 0 : Valentina_ProjectClose(nProject) : EndIf
Valentina_Shutdown()
CloseLibrary(#Lib)
End
EndProcedure

If Not OpenLibrary(#Lib,"vcsdk_release_x64.dll")
Debug "Could not open library"
End
EndIf

Valentina_Init("","","")
Valentina_Init("","","",#True)

nProject.i = Valentina_ProjectNew("reports.vsp")
If nProject = 0 : BailOut("Could not open project",nProject) : EndIf
Valentina_ProjectOpen(nProject)

nReport = Valentina_ReportOpen(nProject,"Report_1","sqlite://reports_db.sqlite","select * from T1")
If nReport = 0 : BailOut("Could not open report",nProject) : EndIf
Valentina_ReportToDisk(nReport,"test.pdf",#kToPDF,0,0)

BailOut("All done :-)",nProject)
End
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Attached the example from V4RB with the SQLite database.
The query for reports is SELECT * FROM T1
Вложения
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Thanks Sergey,

Would it also be possible to get a 'Hello, World!' *.vsp file as I outlined in post #7 of this thread?
I did download the C++ ADK as Ruslan suggested but there was no *.vsp included with that either.

I did a partial test of the VCSDK on Windows. As the demo version of Valentina Studio wont allow me to save a report all I was able to do was open my test.vsp and confirm Project_GetReportCount() equalled zero.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hi Steve,

Thank you.
After fixing the issue I was able to load the library in PureBasic on Linux.

I'll make an example of how to work with reports with the description in our wiki.
And there will be a new build.

Haven't you tried to work with VCSDK and reports on Windows? Meanwhile, you can play with them.
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Hi Sergey,

Thanks for your help.

Here is the PureBasic code:

nRes = OpenLibrary(#PB_Any,"libVCSDK.so")
If nRes = 0
Debug "Could not open library"
Else
If ExamineLibraryFunctions(nRes)
While NextLibraryFunction()
Debug LibraryFunctionName()
Wend
Else
Debug "Could not extract function names"
EndIf
EndIf


You can download the demo version of PureBasic here.
Комментарий
There are no comments made yet.
Sergey Pashkov Ответ принят
Hello Steve,

Yes, it is libVCSDK.so

I've rechecked the VCSDK project on Linux and found a possible reason why it can't be loaded.

Could you please add your PureBasic example, so I'll be able to rebuild the VCSDK library and check it?
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
I have now installed the C ADK on Ubuntu but I can not find the Linux equivalent to vcsdk_release_x64.dll

I've found all the other vcomponents in /usr/local/lib but that key library is missing. I've used the locate command but no luck again.

It really shouldn't be this frustrating to try out your ADKs :(


Edit:
OK, I think I've found it, is it named libVCSDK.so rather than libvcsdk_release_x64.so?

Unfortunately if that is it I don't seem to be able to read the functions within it using PureBasic.

I initially had the same problem with the Windows version but I put all the vcomponents in the same folder and then PureBasic could read the library functions from vcsdk_release_x64.dll. Unfortunately the same trick doesn't work on Linux so I'm guessing there's still something missing.

Sadly I think I'm going to have to give up on this... :(
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Hi Ruslan,

I have downloaded and installed the C++ SDK, that has installed the Examples folder in My Documents but there is still no *.vsp file.

I have used Windows Explorer to perform a search of all folders and subfolders to be sure and it found nothing.
Комментарий
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Hi Steve,

really VCSDK do not contains Examples folder.

Please download also C++ VSDK archive for your OS, it has that examples.
and you can find there EXamples / vReports example with .vsp
This .vsp present in each ADK.

You can open it by free Vstudio and play with preview.
You can check .cpp file to see C++ code to work with this example.


2) TIP described in our WIKI page about How test VStudio PRO features:

- it is possible to use free Valentina Server, and then free Valentina Studio can create a new .vsp on that VServer, so any ADK can play with that .vsp. This project will alive until VServer restart.
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Thanks Ruslan,

The free version of Valentina Studio doesn't allow me to save reports, could I get a *.vsp file with a helloworld report in it (just a report with a 'Hello, World!" label on it) so I can test opening it and outputting it to disk from the C ADK?
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
OK, I've used PureBasic to list all the functions in vcsdk_release_x64.dll and I can see the equivalent functions that I'm familiar with from when I've used Valentina with Xojo: Project_Open, Report_PrintToDisk, etc... so that's a promising start.

Do the C commands that receive string parameters expect to get a pointer to a null terminated UTF8 string?
Комментарий
Right. const char* in C, utf8
  1. Ruslan Zasukhin
  2. около 6 лет назад
There are no comments made yet.
Steve Wilson Ответ принят
My Documents/Paradigma Software only contains a folder named VCDK_x64_8

and within that folder are just the following two files:

EULA_ADK.txt
ReadMe_ADK.txt
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Hi Ruslan,

On your website I went to Developer->Reports for Applications->Download

I downloaded and installed 'Components for C 8.0' but I can not find any examples.
They have not been copied to the 'My Documents' folder as the readme file suggests they should.
Комментарий
what about this: My Documents / Paradigma Software / VCSDK
Windows?
  1. Ruslan Zasukhin
  2. около 6 лет назад
There are no comments made yet.
Ruslan Zasukhin Ответ принят
Hi Steve,

we have in WIKI description of general API ADK => https://goo.gl/EnygqA

For C usage, it is easy to see in the headers of C ADK that we use names as VProject_open() for functions to simulate OO instead VProject.open()

Also please check in C ADK folder Examples / Reports

Also we have
- tutorials about reports - how to design them in Valentina Studio - Report Editor,
- video lessons,
- online report examples
Комментарий
There are no comments made yet.
Steve Wilson Ответ принят
Do you have a function reference for the *.dll files?

I can't seem to find any help documentation on your website that pertains to the C ADK.
Комментарий
There are no comments made yet.
  • Страница :
  • 1
  • 2


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Categories

Announcements & News
  1. 0 subcategories
Valentina Studio
  1. 2 subcategories
Valentina Server
  1. 4 subcategories
Valentina Database ADK
  1. 0 subcategories
Valentina Reports ADK
  1. 0 subcategories
Other Discussions
  1. 2 subcategories
BETA Testing
  1. 0 subcategories
Education & Research
  1. 0 subcategories