Recent

Author Topic: Lazarus, report and CGI  (Read 42199 times)

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Lazarus, report and CGI
« on: January 22, 2016, 08:42:34 pm »
How do you know what package allows me to generate reports from a pdf cgi? I do not know where to turn. I tried with LazReport (Nogui) but not working.It has many problems. I read Fast Report, but the website page of the Fast Report 4 Lazarus is empty. With Fortes report I do not know where to start.

Thank you
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #1 on: January 22, 2016, 09:54:32 pm »
You are correct, neither LazReport, FastReport, ReportBuilder or Fortes is capable of producing reports when no GUI environment is available. In fact, we couldn't find any reporting tool written in Object Pascal, or working with Object Pascal that doesn't require some graphics toolkit (be that VCL, LCL, fpGUI, MSEgui etc)

There is a silver lining though... I have been commissioned to write just such a reporting tool for Free Pascal. My client said the work will be donated to the Free Pascal project once completed.

The status thus far: A whole new TTF font parser has been written. A PDF rendering engine has been written (based on the rendering engine included in fpGUI, but much improved). The PDF engine supports TTF embedding and Unicode text. A report engine has been written from scratch and can report from multiple sources (dataset, custom data etc) and has a PDF export option for rendering PDF files. Other export options can be written (but that is not part of my job). All this is accomplished without requiring any GUI environment or GUI toolkits - that was the ultimate goal of this job. Thus ideal for server-side reporting (eg: CGI apps etc). I've also created multiple reporting demos showing more and more reporting functionality as I go along. Reports can be designed purely in code, or can be streamed to/from a JSON file format.  Everything is thoroughly unit tested too, so it should be very stable out of the box.

So this reporting tool (we call it fpReport) is pretty functional already, but still needs some polish. I unfortunately don't have a time frame for when my client will allow this code to be donated to the Free Pascal project. I'm assuming as soon as I'm done.

So hang in there, a solution is on its way.  ;)
« Last Edit: January 23, 2016, 01:15:22 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazarus, report and CGI
« Reply #2 on: January 22, 2016, 10:04:22 pm »
Thanks for the information. Interesting project. Too bad it does draw the reports and everything that happens to code.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #3 on: January 23, 2016, 01:13:40 am »
Sorry I don't understand your last statement.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazarus, report and CGI
« Reply #4 on: January 25, 2016, 08:36:47 am »
I wondered if the report will be created using a graphical environment.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Lazarus, report and CGI
« Reply #5 on: January 25, 2016, 10:27:34 am »
There is a silver lining though... I have been commissioned to write just such a reporting tool for Free Pascal. My client said the work will be donated to the Free Pascal project once completed.

Wow! That's very generous of you & your client. I wish we had more clients like them that are committed to the cause.

JD
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #6 on: January 25, 2016, 11:20:08 am »
I wondered if the report will be created using a graphical environment.
Yes, of course that will be done too - as a stand-alone desktop application.

Initially [purely to get my client designing reports a bit earlier] we are going to create a conversion tool for reports designed with a JavaScript report designer, which incidentally also uses JSON as the storage medium for designed reports. Stimulsoft Reports.JS http://js.stimulsoft.com/.  I was absolutely blown away by the power of this JavaScript application - by far the best "web app" I have ever seen. 
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

herux

  • Full Member
  • ***
  • Posts: 102
Re: Lazarus, report and CGI
« Reply #7 on: January 27, 2016, 10:36:01 am »
I am doing the same think, but using lazreport as a backend engine  :D

jarto

  • Full Member
  • ***
  • Posts: 106
Re: Lazarus, report and CGI
« Reply #8 on: January 27, 2016, 11:20:22 am »
Using CairoCanvas, fonts and text in general is not much of a problem. They work nicely with nogui. The biggest problem is image support. There I'm using ImageLibrary from http://www.colosseumbuilders.com/sourcecode/ to read or handle images. The only missing link is how to convert a ImageLibrary's TBitmapImage to a cairo image, which is something like this:

Code: Pascal  [Select][+][-]
  1. procedure TPdfCairoImage.BitmapImageToARGB32(Source: TBitmapImage; var FBuf: PByte);
  2. var
  3.   p: PDWord;
  4.   x, y, i: Integer;
  5.   c: Pixel;
  6. begin
  7.   FBuf:=GetMem(Source.Width*Source.Height*4);
  8.   p := Pointer(Fbuf); i:=0;
  9.   for y := 0 to Source.Height-1 do begin
  10.     for x := 0 to Source.Width-1 do begin
  11.       c:=Source.Pixels[i];
  12.       p^ := c.alpha shl 24 + c.red shl 16 + c.green shl 8 + c.blue;
  13.       inc(p); inc(i);
  14.     end;
  15.   end;
  16. end;

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazarus, report and CGI
« Reply #9 on: September 30, 2016, 08:47:30 am »
You are correct, neither LazReport, FastReport, ReportBuilder or Fortes is capable of producing reports when no GUI environment is available. In fact, we couldn't find any reporting tool written in Object Pascal, or working with Object Pascal that doesn't require some graphics toolkit (be that VCL, LCL, fpGUI, MSEgui etc)

There is a silver lining though... I have been commissioned to write just such a reporting tool for Free Pascal. My client said the work will be donated to the Free Pascal project once completed.

The status thus far: A whole new TTF font parser has been written. A PDF rendering engine has been written (based on the rendering engine included in fpGUI, but much improved). The PDF engine supports TTF embedding and Unicode text. A report engine has been written from scratch and can report from multiple sources (dataset, custom data etc) and has a PDF export option for rendering PDF files. Other export options can be written (but that is not part of my job). All this is accomplished without requiring any GUI environment or GUI toolkits - that was the ultimate goal of this job. Thus ideal for server-side reporting (eg: CGI apps etc). I've also created multiple reporting demos showing more and more reporting functionality as I go along. Reports can be designed purely in code, or can be streamed to/from a JSON file format.  Everything is thoroughly unit tested too, so it should be very stable out of the box.

So this reporting tool (we call it fpReport) is pretty functional already, but still needs some polish. I unfortunately don't have a time frame for when my client will allow this code to be donated to the Free Pascal project. I'm assuming as soon as I'm done.

So hang in there, a solution is on its way.  ;)

News on fpReport project?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #10 on: September 30, 2016, 06:11:05 pm »
News on fpReport project?
From my side, fpReport is ready for the v1.0 release. So now it is up to Michael to decide when he wants to publish the code to the FPC repository. Michael has in the mean time started work on a Visual Report Designer component, and I'm currently working on adding Font Subset Embedding to fpPDF (fpPDF was already released). Both are not critical feature to use fpReport.

[edit]
I've also implemented a few report export renderers for PDF, PNG (via AggPas - thus giving high quality graphics), PNG (via fpImage/fpCanvas), a LCL Canvas render (ideal for print preview dialogs - two are included) and a fpGUI Canvas render (a print preview dialog). Also implemented (because it was faster than writing a Visual Report Designer) is a reporting unit that can convert report designs from Stimulsoft to fpReport. fpReport's native file format is JSON - it can read and write report designs.

So fingers crossed - any day now. :)
« Last Edit: October 01, 2016, 01:28:31 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazarus, report and CGI
« Reply #11 on: October 06, 2016, 08:26:41 am »
News on fpReport project?
From my side, fpReport is ready for the v1.0 release. So now it is up to Michael to decide when he wants to publish the code to the FPC repository. Michael has in the mean time started work on a Visual Report Designer component, and I'm currently working on adding Font Subset Embedding to fpPDF (fpPDF was already released). Both are not critical feature to use fpReport.

[edit]
I've also implemented a few report export renderers for PDF, PNG (via AggPas - thus giving high quality graphics), PNG (via fpImage/fpCanvas), a LCL Canvas render (ideal for print preview dialogs - two are included) and a fpGUI Canvas render (a print preview dialog). Also implemented (because it was faster than writing a Visual Report Designer) is a reporting unit that can convert report designs from Stimulsoft to fpReport. fpReport's native file format is JSON - it can read and write report designs.

So fingers crossed - any day now. :)
But it will have some sort of compatibility with reports designed with LazReport? Or not?
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #12 on: October 06, 2016, 09:56:15 am »
But it will have some sort of compatibility with reports designed with LazReport? Or not?
fpReport was designed and written from the ground up - it wasn't based on any existing code. Saying that, we did take a lot of ideas for features from FastReport 4/5 and Stimulsoft. There was no point basing anything on LazReport, which is based on very old FastReport 2 code. Internally, LazReport is a total mess. In general, most reporting engines work very similarly. fpReport is no exception - it too is based on a banded report design, so in that sense, it shouldn't be hard to recreate a LazReport using fpReport. From my experience creating an automatic Stimulsoft-to-fpReport converter - creating a LazReport-to-fpReport converter should be very easy too, but that was not part of my work order.
« Last Edit: October 06, 2016, 10:05:52 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

xinyiman

  • Hero Member
  • *****
  • Posts: 2256
    • Lazarus and Free Pascal italian community
Re: Lazarus, report and CGI
« Reply #13 on: October 06, 2016, 10:12:47 am »
But it will have some sort of compatibility with reports designed with LazReport? Or not?
fpReport was designed and written from the ground up - it wasn't based on any existing code. Saying that, we did take a lot of ideas for features from FastReport 4/5 and Stimulsoft. There was no point basing anything on LazReport, which is based on very old FastReport 2 code. Internally, LazReport is a total mess. In general, most reporting engines work very similarly. fpReport is no exception - it too is based on a banded report design, so in that sense, it shouldn't be hard to recreate a LazReport using fpReport. From my experience creating an automatic Stimulsoft-to-fpReport converter - creating a LazReport-to-fpReport converter should be very easy too, but that was not part of my work order.

It would be very helpful to have the converter. Because it would allow those who have already created a history of easily convert projects. It would be very useful so avoid writing the designer because just use LazReport and then convert it.
Win10, Ubuntu and Mac
Lazarus: 2.1.0
FPC: 3.3.1

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Lazarus, report and CGI
« Reply #14 on: October 06, 2016, 10:28:03 am »
It would be very helpful to have the converter.
Indeed, and I hope the existing demos and converter code I wrote would inspire someone to write a LazReport converter. As I mentioned, it was not part of my work assignment, hence I didn't do it.

Quote
It would be very useful so avoid writing the designer because just use LazReport and then convert it.
Please try a few other visual report designers, then you will see just how crap LazReport's report designer is. Initially, we thought we could reuse the LazReport designer for fpReport, but the code was such a mess. It also doesn't have all the features that fpReport supports. It was better and faster to simply start from scratch. Also, writing a visual report designer is much less effort than implementing a reporting engine. :)

Please take a look at Stimulsoft's JavaScript report designer. This is very impressive - even for a web app. They have desktop versions of this designer too, but I haven't looked at those.
     http://js.stimulsoft.com/
« Last Edit: October 06, 2016, 10:29:41 am by Graeme »
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

TinyPortal © 2005-2018