<div dir="ltr">2013/1/30 Michael Van Canneyt <span dir="ltr"><<a href="mailto:michael@freepascal.org" target="_blank">michael@freepascal.org</a>></span><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">


On Wed, 30 Jan 2013, silvioprog wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
2013/1/30 Tobias Diekershoff <<a href="mailto:tobias.diekershoff@gmx.net" target="_blank">tobias.diekershoff@gmx.net</a>><br>
      Dear list,<br>
<br>
      I have a problem compiling PowerPDF and seek your knowledge to solve it.<br>
<br>
      I've written a program on Linux where the PowerPDF works perfectly, but<br>
      when I tried to compile it on the machine at work (Windows XP) it gives<br>
      an<br>
<br>
      "Illegal type conversion 'Short String' to 'PChar'"<br>
<br>
      in powerpdf/pdftypes.pas lines 1007, 1010 and 1146 (see below).<br>
<br>
      I'm using Lazarus 1.0, FPC 2.6.0 and PowerPDF 0.9.9.<br>
<br>
      Thanks in advance<br>
        Tobias<br>
<br>
      ------ Code Sniplet (lines 1005 to 1011)-----<br>
        {$IFNDEF UNIX}<br>
        Len := MultiByteToWideChar(0, CP_ACP,<br>
          PChar(Value), Length(Value), nil, 0);<br>
        GetMem(PW, Len * 2);<br>
        Len := MultiByteToWideChar(0, CP_ACP,<br>
          PChar(Value), Length(Value), PW, Len * 2);<br>
        {$ELSE}<br>
<br>
      ------ Code Sniplet (lines 1143 to 1147)-----<br>
      // _WriteString<br>
      procedure _WriteString(const Value: string; AStream: TStream);<br>
      begin<br>
        AStream.Write(PChar(Value)^, Length(Value));<br>
      end; <br>
<br>
<br>
Hm... I'm using PowerPDF fine on Windows 7.<br>
<br>
I even managed to remove the dependency of LCL to be able to create PDFs and CGI applications:<br>
</blockquote>
<br>
Interesting.<br>
<br>
Do you think the basics could be included in the standard FPC distribution ?<span class=""><font color="#888888"><br>
<br>
Michael.</font></span></blockquote></div><div class="gmail_extra"><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">Perfectly. IMHO, PowerPDF is well modeled, separated by layers. My changes uses pure FCL. :)</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">There are some things to be improved in PowerPDF:</div><div class="gmail_extra"><br></div><div class="gmail_extra">. Native support to PNG images; (I'm working on this)</div>

<div class="gmail_extra">. Use a new version of PDF (at least 1.4);</div><div class="gmail_extra">. FlateDecode support; (I'm studying this right now)</div><div class="gmail_extra">. Removes LCL dependences; (I'm studying this right now)</div>

<div class="gmail_extra"><br></div><div class="gmail_extra">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. :)</div><div class="gmail_extra">

<br></div><div class="gmail_extra">ps. IMHO, this is wrong: <a href="https://github.com/jepafi/Free-JPDF-Pascal/blob/master/libjpfpdf.pas#L1681">https://github.com/jepafi/Free-JPDF-Pascal/blob/master/libjpfpdf.pas#L1681</a>. He promises to support multiple images, but internally it converts them all to JPEG, and this causes lose quality in some images.</div>

<div class="gmail_extra">PDF supports PNG natively, but need to implement the specification exactly how Adobe explains. Two explains below:</div><div class="gmail_extra"><br></div><div class="gmail_extra">For JPEG:</div>
<div class="gmail_extra">
1 - DCTDecode a lossy filter based on the JPEG standard; (I implemented it)</div><div class="gmail_extra"><br></div><div class="gmail_extra">For PNG:</div><div class="gmail_extra">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);</div>

<div class="gmail_extra">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;</div>

</div></div></div><div class="gmail_extra" style><br></div><div class="gmail_extra">-- <br>Silvio Clécio<br>My public projects - <a href="http://github.com/silvioprog" target="_blank">github.com/silvioprog</a>
</div></div>