📜 ⬆️ ⬇️

I will give in good hands ...

... LGPL project:



Developers

The main and only developer is yours truly.
The project is sponsored by Darren Gates, owner of tufat.com.

Why give away?

Lack of time for own projects. Alas, in the last year I cut out 1-2 hours a week from strength to work on html2ps / pdf, which was mainly the answers to the forum , editing the bugs as they were discovered and (rarely) rarely added new small features.
Naturally, the project is a pity - if only because some of its features are unique among the LGPL tools. I would like to find a continuer.
')

What does "give" mean?


Short story

The project was born in the fall of 2004 as a clone of the well-known html2ps, written in Perl. More precisely, it was a clone for about 5 minutes before I looked into the html2ps code ...
$pta=defined $p{"text-align"}?$p{"text-align"}:$body{"text-align"};
$pal=0;
$pal=1 if($pta=~/^c/i);
$pal=2 if($pta=~/^r/i);
$pal=3 if($pta=~/^j/i);
$bgcol=&col2rgb($body{"background"});
if(!$bgcol) {$bgcol="[16#FF 16#FF 16#FF]"};
if(!$p{"color"}) {$p{"color"}="black"};
$tcol=&col2rgb($p{"color"});
$lcol=&col2rgb($a__link{"color"});
if($lcol) {
$Lc="/Lc t D\n/Dl $lcol D\n";
$Lc.=$tcol ne $lcol?"/LX t D":"/LX f D";
} else {
$Lc="/Lc f D\n/LX f D";
}
$pcol=&col2rgb($pre{"color"});
if(!$pcol) {$pcol="[0 0 0]"};
$deftbg=&col2rgb($table{"background"});

... and decided that I would save time by writing my own bike from scratch.

By the beginning of 2005, a code was born that could chew plain HTML without tables, parse simple CSS, and generate the corresponding Postscript. (It is possible for some to be shocked to find out that 90% of the calculations related to the placement of text on a page occurred inside the Postscript file).

In January 2005, it was decided to change the license for the LGPL (instead of the initially proposed model “all for $ 5”).

Over the course of a year, the Scrith developed, grew fat, replenished with features and lost bugs. By the end of the year it became clear that the chosen approach “write everything down to Postscript and the printer will figure it out” is far from ideal - the amount of computation grew along with the complexity of the pages being processed and even the conversion using ps2pdf on the “big” computer began to take several seconds. It was decided to stop raping printers with calculations, and, finally, to remove the algorithms for placing elements from postscript. This change was marked by the release of html2ps / pdf 1.0

In the new form, the script existed almost until the end of 2006, when it finally became clear that it was impossible to continue this way - users asked for new features in amounts unexpected for such a small community, a convenient API for embedding html2ps / pdf into third-party projects, and The algorithms transferred from Postscript made it to PHP in a rather “strange” way, without at all simplifying the changes. The time has come for the second (and last) rewriting of the kernel and the appearance of version 2.0.

The first two thirds of 2007 was perhaps the best time of the project: the emergence of a normal API, optimization (no, the script did not work really fast; however, his passionate love for resources was somewhat reduced) and many new features.

Since summer 2007, my personal life and another project are beginning to occupy more and more time. As a result, html2ps / pdf received a measly 1-2 hours a week, which were spent mainly on supporting the script on the forum. In May 2008, I decided that it was no longer necessary to continue in the same spirit, I spoke with Darren and stopped trying to find time for further development.

Advantages and disadvantages

At the moment it is the only LGPL tool I know that supports floats, position: absolute and position: fixed. In addition, there is support for such nice little things (not to mention the "basic" HTML / CSS), such as:

There is a well documented API with examples.

The script tries (from my point of view - rather successfully) to edit such things as unclosed tags, missing quotes around attributes, <,> and & in the wrong places and so on in the source code of the pages.

Now with the bad and the scary. First, a solid part of the code was written by me four years ago (respectively, the design and programming experience was four years less); secondly, the code experienced one change of coding style and two kernel rewrites. The natural result of this is that in some places you can find code for which I am ashamed, and in some places for which I am very ashamed. (And I am ashamed of the miserable 5% test coverage).

Another problem is the size of the code (~ 1.5 megabytes in ~ 350 files) and a rather complicated subject area (you yourself can’t imagine how much interpretation space the standards actually leave).

If you are interested in and bad and terrible did not scare you - write. I will be glad to answer.

Source: https://habr.com/ru/post/38090/


All Articles