Recent

Author Topic: Paper forms reporting question  (Read 10772 times)

JD

  • Hero Member
  • *****
  • Posts: 1910
Paper forms reporting question
« on: February 06, 2017, 11:05:40 am »
Hi there everyone,

I've seen programs written in other languages like Java & C# being able to present users with identical versions of paper based forms on screen as either

a) an on screen form that the user can fill and later print or save to PDF
b) the end result of a standard data entry process or querying of a database that the user can later print or save to PDF

Is such a thing possible in Lazarus, if so how can it be done?

Thanks,

JD

EDIT: I've always wondered if the on-screen form was actually a background image
« Last Edit: February 06, 2017, 11:30:06 am by JD »
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

balazsszekely

  • Guest
Re: Paper forms reporting question
« Reply #1 on: February 06, 2017, 11:54:59 am »
It depends...if a form only contains controls that doesn't have scrolling or paging, you can do something like this:
Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   Bmp: TBitmap;
  4. begin
  5.   Button1.Hide;
  6.   Application.ProcessMessages;
  7.   Sleep(1000);
  8.   Bmp := Form1.GetFormImage;
  9.   Bmp.Canvas.Changed;
  10.   //print
  11.   //save to file
  12.   Button1.Show;
  13. end;

else you need some kind of reporting tool.

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #2 on: February 06, 2017, 12:11:43 pm »
@ GetMem Thanks for your reply

The kind of form I'm refering to is in the attachments. It is just a sample I got from the Internet.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Zoran

  • Hero Member
  • *****
  • Posts: 1980
    • http://wiki.lazarus.freepascal.org/User:Zoran
Re: Paper forms reporting question
« Reply #3 on: February 06, 2017, 01:03:34 pm »
Perhaps Graeme's new pdf reporting engine will have this feature.
I do not know, we are looking forward to see it.
Graeme says it's finished, but we are still waiting, see here.
Swan, ZX Spectrum emulator https://github.com/zoran-vucenovic/swan

zeljko

  • Hero Member
  • *****
  • Posts: 1830
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: Paper forms reporting question
« Reply #4 on: February 06, 2017, 01:08:24 pm »
Such thing is possible with FastReport5 for lazarus too. You set bmp as non printable page background or picture and then drop memos on lines which will show data. So when you print it it will not print background image , but data only. Also, feature is that when you export such form eg. to pdf it can contain complete formular.

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #5 on: February 06, 2017, 01:11:52 pm »
Perhaps Graeme's new pdf reporting engine will have this feature.
I do not know, we are looking forward to see it.
Graeme says it's finished, but we are still waiting, see here.

Yes I'm waiting to see it too.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #6 on: February 06, 2017, 01:12:49 pm »
Such thing is possible with FastReport5 for lazarus too. You set bmp as non printable page background or picture and then drop memos on lines which will show data. So when you print it it will not print background image , but data only. Also, feature is that when you export such form eg. to pdf it can contain complete formular.

Can LazReport or FortesReport do it too?
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

balazsszekely

  • Guest
Re: Paper forms reporting question
« Reply #7 on: February 06, 2017, 01:31:38 pm »
@JD
Ok. I see. That's easily doable with lazreport +PdfExport + pack_powerPdf.

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #8 on: February 06, 2017, 01:36:20 pm »
@JD
Ok. I see. That's easily doable with lazreport +PdfExport + pack_powerPdf.

 :D I'm ALL ears. Tell me how? Thanks.
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Paper forms reporting question
« Reply #9 on: February 06, 2017, 02:03:19 pm »
Although this can always be done using standard Lazarus / FPC provided classes and components (all canvas based, which has the same abstarction for a printer canvas and a screen canvas. etc), I'd recommend to install a pdf printer driver server side, render the PDF and let the user download that pdf. It is often more versatile.
There are several free and commercial drivers available. In principle this is also doable yourself by writing a service or daemon using fcl-pdf.  Note it takes some getting used to to choose proper fonts and sizes to provide really identical results.
« Last Edit: February 06, 2017, 02:05:38 pm by Thaddy »
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #10 on: February 06, 2017, 03:31:56 pm »
Although this can always be done using standard Lazarus / FPC provided classes and components (all canvas based, which has the same abstarction for a printer canvas and a screen canvas. etc), I'd recommend to install a pdf printer driver server side, render the PDF and let the user download that pdf. It is often more versatile.
There are several free and commercial drivers available. In principle this is also doable yourself by writing a service or daemon using fcl-pdf.  Note it takes some getting used to to choose proper fonts and sizes to provide really identical results.

Thanks Thaddy. Point noted. However the form still has to filled from a database on the server side. Scanning the form is easy - as PDF, JPEG etc, it is putting data into it - i.e rendering that I need help with. Graphics are one of my areas of weakness.  :(
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

Thaddy

  • Hero Member
  • *****
  • Posts: 18729
  • To Europe: simply sell USA bonds: dollar collapses
Re: Paper forms reporting question
« Reply #11 on: February 06, 2017, 03:36:06 pm »
The printer driver should also be on your server side, not at the user side.
If Europe sells their USA bonds the USD will collapse. Europe can affort that given average state debts. The USA can't affort that. Just an advice...

balazsszekely

  • Guest
Re: Paper forms reporting question
« Reply #12 on: February 06, 2017, 04:37:36 pm »
@JD
I will try to make a small example later or tomorrow.  So basically you want to transfer some data to that image you posted and print to paper/pdf. Is this correct?

JD

  • Hero Member
  • *****
  • Posts: 1910
Re: Paper forms reporting question
« Reply #13 on: February 06, 2017, 05:26:47 pm »
@JD
I will try to make a small example later or tomorrow.  So basically you want to transfer some data to that image you posted and print to paper/pdf. Is this correct?

Exactly!
Linux Mint - Lazarus 4.0/FPC 3.2.2,
Windows - Lazarus 4.0/FPC 3.2.2

mORMot 2, PostgreSQL & MariaDB.

balazsszekely

  • Guest
Re: Paper forms reporting question
« Reply #14 on: February 06, 2017, 06:42:33 pm »
Ok. I made a very basic example(it's not related to your image, something similar based on a form I found online). Hope this is what are you after. You can print it, export to pdf, etc... Please follow this steps:

1. Install lazreport(if not already installed)
2. Install pdf_export. I made a version that works with trunk: https://drive.google.com/file/d/0B9Me_c5onmWoTGpKMjhOZDR1TU0/view?usp=sharing
3. Install lazreportpdfexport(Install/Uninstall packages dialog --> Available for installation list)
4 Download program(attachment)

PS: You can put any image as background but is not worth it. You can add shapes, lines etc. and the quality is better.  If you switch to fortesreport you will have even more options.

 

TinyPortal © 2005-2018