Recent

Author Topic: PowerPDF (free PDF creation package)  (Read 19635 times)

Anonymous

  • Guest
PowerPDF (free PDF creation package)
« on: August 26, 2005, 10:36:09 am »
Wouldn't be nice to have PowerPDF ported to Lazarus? As far as I know, it's the only free OpenSource PDF generation package available for Delphi...

http://www.est.hi-ho.ne.jp/takeshi_kanno/powerpdf/

matthijs

  • Hero Member
  • *****
  • Posts: 537
RE: PowerPDF (free PDF creation package)
« Reply #1 on: August 26, 2005, 12:34:58 pm »
Yes, it would be nice.
So, why don't you have a go at it? :D State you are working on it on this page and keep us posted.
What's in a sig? Would my posting look less if it didnot have a sig? (Free after William S.) :)

:( Why cannot I upload my own Avatar? :(

Anonymous

  • Guest
RE: PowerPDF (free PDF creation package)
« Reply #2 on: August 26, 2005, 01:49:15 pm »
As soon as I have time, I'll give it a shot.

Is there any documentation about creating packages for Lazarus, or is there no difference with Delphi packages?

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page

chtk

  • Guest
PowerPDF (free PDF creation package)
« Reply #4 on: October 19, 2005, 09:41:46 am »
I tried for some time to register an account to post this, but the forum wouldn't send me an activation e-mail. So I'll post this semi-anonymous.

Some time ago I worked on a port of PowerPdf to Lazarus, the result of which has been merged with a partial port by Jesus Reyes. I've put a link to the package on the page Matthijs linked to ( or here for the lazy people :) ). I've tested the package under Lazarus 0.9.10, but higher versions should work as well.

Vincent Snijders

  • Administrator
  • Hero Member
  • *
  • Posts: 2661
    • My Lazarus wiki user page
PowerPDF (free PDF creation package)
« Reply #5 on: October 19, 2005, 09:48:28 am »
Can you create a page about on on lazarus-ccr, for example here? Look for an example to other component pages mentioned on Lazarus CCR download page.

Then I can upload the file to sourceforge, people might find it quicker then.

Anonymous

  • Guest
PowerPDF (free PDF creation package)
« Reply #6 on: December 08, 2005, 05:08:35 pm »
This is a great package that I've used a lot in Delphi. The only downside I found is that the TPrJPEGImage doesn't handle 256/greyscale JPEGS.

This is the Delphi fix, and it might work in Lazarus:

In PdfJpegImage.pas, function TPdfJpegImage.CreateImage, change

      AddItem('ColorSpace', TPdfName.CreateName('DeviceRGB'));

to:

      if  TJpegImage(AImage).Grayscale then
       AddItem('ColorSpace', TPdfName.CreateName('DeviceGray'))
      else AddItem('ColorSpace', TPdfName.CreateName('DeviceRGB'));

chtk

  • Guest
PowerPDF (free PDF creation package)
« Reply #7 on: December 11, 2005, 02:07:15 pm »
'Doesn't handle' greyscale jpegs in what way? Are greyscale jpegs displayed wrongly on screen or in the generated pdf files? Please give me some more info to work with.

I've found some corruption when displaying a TPRJpegImage with a greyscale jpeg loaded. The left 1/3 part displays a squashed version of the image, while the right 2/3 part displays garbage. But I get the same when I load the same greyscale image in a TImage widget.

wes12

  • New Member
  • *
  • Posts: 21
PowerPDF (free PDF creation package)
« Reply #8 on: December 11, 2005, 04:52:23 pm »
Quote from: "chtk"
'Doesn't handle' greyscale jpegs in what way? Are greyscale jpegs displayed wrongly on screen or in the generated pdf files? Please give me some more info to work with.

Its a while ago, but I seem to remember that greyscale JPGs couldn't even be loaded into the PowerPDF JPG image component under Delphi, basically because they are a different format (256 pallet greyscale).
Quote from: "chtk"
I've found some corruption when displaying a TPRJpegImage with a greyscale jpeg loaded. The left 1/3 part displays a squashed version of the image, while the right 2/3 part displays garbage. But I get the same when I load the same greyscale image in a TImage widget.

The 1/3 suggests that three colours are being used when the image only has one 'colour'. Normal JPGs (and images) have a three colour 'rgb' pixel, greyscale only has a single intensity pixel, which uses less bytes per pixel.

I'll try the PowerPDF stuff in Lazarus with greyscale JPGs and see what I find, but I can't do anything for a week or more. But I'd suggest you try the code fragment I gave above (and again below) and see if it solves your greyscale JPG problem.

I emailed takeshi kanno about this in November 2002:

PowerPDF 0.9 is very good. Many thanks for your work!

There is a problem with 'jf8bit' JPG file types.
They do not convert to PDF properly in PowerPDF.

 TJPEGPixelFormat = (jf24Bit, jf8Bit);
 property PixelFormat: TJPEGPixelFormat;

I have found a way to fix this.

In PdfJpegImage.pas , TPdfJpegImage.CreateImage:  

Change from:  
AddItem('ColorSpace', TPdfName.CreateName('DeviceRGB'));

To:
if  TJpegImage(AImage).Grayscale then
  AddItem('ColorSpace', TPdfName.CreateName('DeviceGray'))
else AddItem('ColorSpace', TPdfName.CreateName('DeviceRGB'));

chtk

  • Guest
PowerPDF (free PDF creation package)
« Reply #9 on: December 12, 2005, 09:45:04 am »
Quote from: "wes12"

The 1/3 suggests that three colours are being used when the image only has one 'colour'. Normal JPGs (and images) have a three colour 'rgb' pixel, greyscale only has a single intensity pixel, which uses less bytes per pixel.

That's pretty much what I suspected.
Quote from: "wes12"

I'll try the PowerPDF stuff in Lazarus with greyscale JPGs and see what I find, but I can't do anything for a week or more. But I'd suggest you try the code fragment I gave above (and again below) and see if it solves your greyscale JPG problem.

I probably won't be able to spend a lot of time on fixing this either. I'll see if I can find some time this week. If you find a solution before I do, please drop me a line on stefan <at> iquad.nl.

Anonymous

  • Guest
PowerPDF (free PDF creation package)
« Reply #10 on: June 16, 2006, 10:59:52 am »
I have made a few changes to PowerPDF making it possible to use it as a "TPrinter like object".

I.e like this
  Pdf := TPdfCoc.Create;
  Pdf.NewDoc;

  Pdf.AddPage;

  MyPrintToCanvasFunction(Pdf.Canvas);

  Pdf.AddPage;

  MoreMyPrintToCanvas(Pdf.Canvas);

  Pdf.SaveToStream(PdfStream);
...

  Code is a bit messy but if anyone is interested in cleaning it up I could send it to him/her.

/Erik

Anonymous

  • Guest
PowerPDF (free PDF creation package)
« Reply #11 on: June 16, 2006, 11:01:01 am »
OOOPPPPSSSS!

Forgot my email is erik dot brannlund at telia dot com

Anonymous

  • Guest
PowerPDF (free PDF creation package)
« Reply #12 on: July 04, 2006, 02:45:32 pm »
Quote from: "Anonymous"
OOOPPPPSSSS!

Forgot my email is erik dot brannlund at telia dot com

Hello Erik, I have wrote an email to you recently. It was concerning your modifications of PowerPDF component for Lazarus. Could you be so kind to share it with us?