Bug 3390 Enabling ZIP compression in pdf generation to reduce file size

Enabling compression gives a ~26% *reduction* over non-compressed Type 3 font embedding.
ie. 4.5 K/pg (compressed graphic) vs. 17.5 K/pg (uncompressed Type 3 font) vs 111 K/pg
(uncompressed graphic).

It also appears that most other applications that export in pdf use compression by
default. (OO Writer, etc.) So this approach appears justified. One could always add code
to allow the user to select embedding mode and compression.

Also correcting mode parameter value.

Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
This commit is contained in:
Chris Nighswonger 2009-07-04 00:14:50 -04:00 committed by Galen Charlton
parent f779f9815c
commit d1e03bbf11
2 changed files with 8 additions and 7 deletions

View file

@ -1165,7 +1165,7 @@ sub DrawBarcode {
ySize => ( .02 * $height ),
xSize => $xsize_ratio,
hide_asterisk => 1,
mode => '', # the only other option here is Type3...
mode => 'graphic', # the only other option here is Type3...
);
};
}
@ -1186,7 +1186,7 @@ sub DrawBarcode {
ySize => ( .02 * $height ),
xSize => $xsize_ratio,
hide_asterisk => 1,
mode => '', # the only other option here is Type3...
mode => 'graphic', # the only other option here is Type3...
);
};
}
@ -1208,7 +1208,7 @@ sub DrawBarcode {
xSize => $xsize_ratio,
hide_asterisk => 1,
text => 0,
mode => '', # the only other option here is Type3...
mode => 'graphic', # the only other option here is Type3...
);
};
}
@ -1297,7 +1297,7 @@ sub build_circ_barcode {
# prolong => 2.96,
xSize => .85,
ySize => 1.3,
mode => '', # the only other option here is Type3...
mode => 'graphic', # the only other option here is Type3...
);
};
}

View file

@ -112,6 +112,7 @@ print $cgi->header( -type => 'application/pdf', -attachment => 'barcode.pdf' );
prInitVars();
$| = 1;
prFile(); # No args means to STDOUT
prCompress(1); # turn on zip compression which dramatically reduces file size
prMbox( $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY );
# drawbox( $lowerLeftX, $lowerLeftY, $upperRightX, $upperRightY ); #do page border