[PC4P-users] Bug in setting the compression factor? And a possible fix
Status: Inactive
Brought to you by:
eru
From: Jason W. <pc...@gr...> - 2002-01-08 03:06:53
|
I've been trying to use pc4p_set_compression() without success. Looking at the source code for pc4p_main.inc I found that pc4p_set_compression contains a bug: ------------------------------------------------------------------------ function pc4p_set_compression( $compress ) { if( $compress < 0 ) { $compress = 0; } elseif( $compress > 9 ) { $compress = 9; } else { die("Error: ".get_class( $this )." - ".$compress." is not a valid compression-factor"); } pdf_set_value( $this->pdfp, "compress", $compress ); } ------------------------------------------------------------------------ As it stands pdf_set_value() never gets called! I have rewritten it as: function pc4p_set_compression($compress) { if (is_integer($compress)) { if ($compress < 0) { $compress = 0; } else { if ($compress > 9) { $compress = 9; }} pdf_set_value($this->pdfp, "compress", $compress); } else { die("Error: ".get_class($this)." - ".$compress." is not a valid compression-factor"); } } Incidentally what is the purpose of the compression factor? And what is the default? I have set it to 9, but the size of the PDF that I'm getting is the same as if I hadn't set the compression. However If I view the file in Adobe Acrobat then do a "Save As..." it results in a file that is 1/10th of the original size (from 4MB to 400KB). -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk /* You are wise, witty, and wonderful, but you spend too much time reading this sort of trash. */ |