* * *

Author Topic: Library or component HTML2PDF  (Read 2460 times)

GillesH

  • New member
  • *
  • Posts: 34
Library or component HTML2PDF
« on: November 02, 2016, 05:57:00 pm »
Hello,

I'd like to know if it is possible for your team to build a library or a component HTML2PDF compatible with Windows/Linux 32 and 64bits. In the generated pdf files, I'd like to display tables including formated cells in miniHTML of TMS. If we suppose it is possible, what would be the cost specific to my company? What would be the cost of a component that would meet my specifications and would go into public domain after a few months and what would be the expected deadline for such a project?

Regards.
« Last Edit: November 02, 2016, 07:21:41 pm by GillesH »

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: Library or component HTML2PDF
« Reply #1 on: November 03, 2016, 11:52:25 am »
The fpPDF included with FPC (Trunk) and the soon to be released FPC 3.0.2 has the capabilities to generate all kinds of PDF documents (from simple to complex). It gives you the raw drawing primitives to accomplish what you need. So that part is not the problem. The question is more, how complex is the HTML that you want to convert to PDF? Does it use simple HTML like HTML 4 or much more complex HTML 5 features? Does it use extensive CSS for layouting, or is layouting done via HTML tables?

Can you supply a sample HTML file that you would like to convert? That will give a more clear indication of how complex the job will be.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

GillesH

  • New member
  • *
  • Posts: 34
Re: Library or component HTML2PDF
« Reply #2 on: November 10, 2016, 10:37:13 am »
Hello,

Thank you for the answer. The reality is that we don't seek to convert an HTML file to PDF. This would naturally require to make unnecessary HTML files.

Assuming a table of a database :
Rec   id   title             im            blob
1      1   First         base64        <span style="color:blue">blue</span> eyes
2      2   Secund        NULL        <span style="background-color:yellow">My background is yellow</span>

We search the best way to get the result provided in the attachment. This has been achieved by using LibreOffice. I am not allowed to use a client base. We generally use NCReport (with Qt) to get pdf files.

 Best regards. Gilles

Thaddy

  • Hero Member
  • *****
  • Posts: 4023
Re: Library or component HTML2PDF
« Reply #3 on: November 10, 2016, 10:43:47 am »
LibreOffice simply does that in memory. But it still does the intermediate step. That's a programmer task.
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

GillesH

  • New member
  • *
  • Posts: 34
Re: Library or component HTML2PDF
« Reply #4 on: November 10, 2016, 12:03:48 pm »
Hello,

we don't want to use LibreOffice. We are looking for a solution integrated in Lazarus (library, component). Hence our request.

Regards. Gilles
« Last Edit: November 10, 2016, 12:05:41 pm by GillesH »

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: Library or component HTML2PDF
« Reply #5 on: November 10, 2016, 12:33:21 pm »
Hi Gilles,

Thanks for the example, that gives me a better idea of what you want. Lastly, where does the "assuming a table of a database" information come from? Does you program query an actual relational database, and wants to format the output as in your example pdf? Or does the data come from another file (ODT, txt, XML etc)?

I can say that fpPDF definitely has the capabilities to generate a PDF as your example. The work is more in reading the "table data" and parsing the Blob field data.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

GillesH

  • New member
  • *
  • Posts: 34
Re: Library or component HTML2PDF
« Reply #6 on: November 10, 2016, 06:00:21 pm »
Hi Graeme,

If such a component existed, we would use a TSQLQuery. All our data are stored in MySQL (MariaDB) and PostgreSQL databases.

We need :

First page : a "band" Header : Logo + [Title + RC + Subtitle] (HTML Strings >> Title : single line - Subtitle : multiline)
Other page : a "band" Header (String HTML single line)
All pages : a "band" Footer (String HTML 1 line)
Internal pagination [ 2 fields : page number and total number of pages ]

We started to invest in improving an old library : libjpfpdf.pas. The principle is simple (cells)... for simple editions. Header, footer and pagination meet our specifications.  I
We have been tinkering with "super cells" to contain multiple cells in a "row" of the pdf document. The result isn't satisfying in our point of view.

Our principal IDE is Qt (default choice for Windows - Linux - OS X). With no time to develop lazrus components, so even if we have done so before, I (we) appreciate lazarus (more than delphi). But to use it in a professional way,  we need a tool to store and edit HTML data in pdf files.

Best regards. Gilles

Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: Library or component HTML2PDF
« Reply #7 on: November 10, 2016, 11:19:05 pm »
The soon to be release fpReport - a new reporting engine I was commissioned to develop for FPC - can do what you need with ease. It can report from TDataset or custom user-data. The standard reporting features like headers, footers, alternate layouting between start/end page and the rest  are all supported. The fpReport engine is totally non-GUI (unlike any other Object Pascal reporting engine we could find), and so is fpPDF (already released to FPC Trunk). fpReport also has exporters to PDF, PNG, any other image format, LCL Canvas (optional), fpGUI Canvas (optional) and HTML. So if you can hold off for a couple more weeks until fpReport gets released, you will have a easy solution to your problem.
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

GillesH

  • New member
  • *
  • Posts: 34
Re: Library or component HTML2PDF
« Reply #8 on: November 11, 2016, 03:28:05 pm »
Hi Graeme,

"It can report from TDataset or custom user-data."  Including datafields "miniHTML TMS" formatted ? :D Yes, we can expect it.

If this occurs, we may ask you to perform a few additional monetised and public functions : compatibility with Unidac, and display of embedding base64 images (<img alt="Embedded Image" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." />). This fund will be our way to support your work and Lazarus.

Please don't hesitate to contact me at  my current email address. Regards. Gilles






Graeme

  • Hero Member
  • *****
  • Posts: 1363
    • Graeme on the web
Re: Library or component HTML2PDF
« Reply #9 on: November 11, 2016, 04:43:55 pm »
Including datafields "miniHTML TMS" formatted ? :D Yes, we can expect it.
As for user-defined data, fpReport can do reporting on anything, so yes TMS formatted data should be just fine. I've created demo reports reporting from TStringList, TObjectList, TDataset etc. No problems.

We don't have an exact released date for fpReport. I've completed the implementation of fpReport, wrote a couple report exporters, 12+ demos and a report converter from Stimulsoft to fpReport. The person that hired me to do this said he would like developers to have the best possible experience when fpReport is released - so we decided we are going to implement a visual report designer as well, before we make the release. So the release has now been postponed by a couple more weeks.

--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus