[Lazarus] compiling PowerPDF on win32

silvioprog silvioprog at gmail.com
Wed Jan 30 12:01:56 CET 2013


2013/1/30 Michael Van Canneyt <michael at freepascal.org>

> On Wed, 30 Jan 2013, silvioprog wrote:
>
>> 2013/1/30 Tobias Diekershoff <tobias.diekershoff at gmx.net>
>>       Dear list,
>>
>>       I have a problem compiling PowerPDF and seek your knowledge to
>> solve it.
>>
>>       I've written a program on Linux where the PowerPDF works perfectly,
>> but
>>       when I tried to compile it on the machine at work (Windows XP) it
>> gives
>>       an
>>
>>       "Illegal type conversion 'Short String' to 'PChar'"
>>
>>       in powerpdf/pdftypes.pas lines 1007, 1010 and 1146 (see below).
>>
>>       I'm using Lazarus 1.0, FPC 2.6.0 and PowerPDF 0.9.9.
>>
>>       Thanks in advance
>>         Tobias
>>
>>       ------ Code Sniplet (lines 1005 to 1011)-----
>>         {$IFNDEF UNIX}
>>         Len := MultiByteToWideChar(0, CP_ACP,
>>           PChar(Value), Length(Value), nil, 0);
>>         GetMem(PW, Len * 2);
>>         Len := MultiByteToWideChar(0, CP_ACP,
>>           PChar(Value), Length(Value), PW, Len * 2);
>>         {$ELSE}
>>
>>       ------ Code Sniplet (lines 1143 to 1147)-----
>>       // _WriteString
>>       procedure _WriteString(const Value: string; AStream: TStream);
>>       begin
>>         AStream.Write(PChar(Value)^, Length(Value));
>>       end;
>>
>>
>> Hm... I'm using PowerPDF fine on Windows 7.
>>
>> I even managed to remove the dependency of LCL to be able to create PDFs
>> and CGI applications:
>>
>
> Interesting.
>
> Do you think the basics could be included in the standard FPC distribution
> ?
>
> Michael.


Perfectly. IMHO, PowerPDF is well modeled, separated by layers. My changes
uses pure FCL. :)

There are some things to be improved in PowerPDF:

. Native support to PNG images; (I'm working on this)
. Use a new version of PDF (at least 1.4);
. FlateDecode support; (I'm studying this right now)
. Removes LCL dependences; (I'm studying this right now)

I was thinking of creating a fork and work on it, but if these new changes
can be implemented PowerPDF and distributed in FPC, I would be very happy.
:)

ps. IMHO, this is wrong:
https://github.com/jepafi/Free-JPDF-Pascal/blob/master/libjpfpdf.pas#L1681.
He promises to support multiple images, but internally it converts them all
to JPEG, and this causes lose quality in some images.
PDF supports PNG natively, but need to implement the specification exactly
how Adobe explains. Two explains below:

For JPEG:
1 - DCTDecode a lossy filter based on the JPEG standard; (I implemented it)

For PNG:
1 - FlateDecode a commonly used filter based on the zlib/deflate algorithm
(a.k.a. gzip, but not zip) defined in RFC 1950 and RFC 1951; introduced in
PDF 1.2; it can use one of two groups of predictor functions for more
compact zlib/deflate compression: Predictor 2 from the TIFF 6.0
specification and predictors (filters) from the PNG specification (RFC
2083);
2 - LZWDecode a filter based on LZW Compression; it can use one of two
groups of predictor functions for more compact LZW compression: Predictor 2
from the TIFF 6.0 specification and predictors (filters) from the PNG
specification;

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20130130/e5b8ed04/attachment-0003.html>


More information about the Lazarus mailing list