#1 2010-11-01 06:30:22

TPrami
Member
Registered: 2010-07-06
Posts: 119

Problem with ForceJPEGCompression

Hello,

I use TPdfImage to add HighResolution bitmaps to the (Pdf)Canvas (Not the VCL one).

Dow not matter which value I set for the ForceJPEGCompression (Tested values 0, 30, 60 and 90 (At least)). File will have exact same size, no matter of the value of the property.

I even made 850mb .pdf file, and compressed it with 7-zip and it compressed into about 8.5MB, so it definitely have some room for compression.

Same results with an .CompressionMethod    := cmFlateDecode;

Don't know will this lib support compressing images with (de)Flate/Zip/Zlib (What ever called wink )

Any ideas, is this an bug in library, or in my code??? What could cause this.

This is not an issue for me now, but maybe later it is... (so no panic, for me, just wondering wink )

And BTW. Could do some good to have comment like this in the code
0 = Disabled
1 = Low compression (Large files, good quality)
100 = High compression (Small files, poor quality)
(Or other way round, can't remember which way it was wink

-TP-

Offline

#2 2010-11-01 19:13:56

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Problem with ForceJPEGCompression

Did you try step by step debugging to guess what is the ForceJPEGCompression usage?

Offline

#3 2010-11-02 07:16:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Problem with ForceJPEGCompression

SynPdf supports:
1) deflate compression (zlib);
2) JPEG compression

I suspect you've some problems of parameters / methods calls.

Check that:
1) TPdfDocument.CompressionMethod equals cmFlateDecode (this is the default set in TPdfDocument.Create, but you may have changed this);
2) you add TJpegImage pictures in order to enable Jpeg compression.

The ForceJPEGCompression parameter is available only if you call TPdfImage.Create with TJpegImage kind of TGraphic (not TBitmap).

See TPdfImage.Create code.

Offline

#4 2010-11-02 07:35:00

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,660
Website

Re: Problem with ForceJPEGCompression

Another possibility is to use TPdfDocumentGDI, and its VCLCanvas property to draw your bitmaps.

In this case, if the ForceJPEGCompression is not set to 0, it will create automatically creates the bitmap as JPEG.

Offline

#5 2010-11-02 08:58:56

TPrami
Member
Registered: 2010-07-06
Posts: 119

Re: Problem with ForceJPEGCompression

OK,

I need to add something else than Jpeg image, but I could change it into it. (I just Assign TBitmap into it)

I just tough it would compress all images as Jpeg if property set smile Because it says it'll Force it smile

Thanks for your support!!!

I'll look into it...

-TP-

Offline

Board footer

Powered by FluxBB