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:
parent
4f770c9bba
commit
f4786191eb
|
|
@ -1202,6 +1202,7 @@ sub DrawBarcode {
|
|||
ySize => ( .02 * $height ),
|
||||
xSize => $xsize_ratio,
|
||||
hide_asterisk => 1,
|
||||
mode => 'graphic', # the only other option here is Type3...
|
||||
);
|
||||
};
|
||||
if ($@) {
|
||||
|
|
@ -1227,6 +1228,7 @@ sub DrawBarcode {
|
|||
ySize => ( .02 * $height ),
|
||||
xSize => $xsize_ratio,
|
||||
hide_asterisk => 1,
|
||||
mode => 'graphic', # the only other option here is Type3...
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -1252,7 +1254,8 @@ sub DrawBarcode {
|
|||
ySize => ( .02 * $height ),
|
||||
xSize => $xsize_ratio,
|
||||
hide_asterisk => 1,
|
||||
text => 0,
|
||||
text => 0,
|
||||
mode => 'graphic', # the only other option here is Type3...
|
||||
);
|
||||
};
|
||||
|
||||
|
|
@ -1370,6 +1373,7 @@ sub build_circ_barcode {
|
|||
xSize => .85,
|
||||
|
||||
ySize => 1.3,
|
||||
mode => 'graphic', # the only other option here is Type3...
|
||||
);
|
||||
};
|
||||
if ($@) {
|
||||
|
|
|
|||
|
|
@ -106,6 +106,17 @@ my $lowerLeftY = 0;
|
|||
my $upperRightX = $page_width;
|
||||
my $upperRightY = $page_height;
|
||||
|
||||
warn "Active profile: " . ($profile->{prof_id} || "None") if $DEBUG;
|
||||
|
||||
#### PRINT PRELIMINARY DATA ####
|
||||
print $cgi->header( -type => 'application/pdf', -attachment => 'barcode.pdf' );
|
||||
# Don't print header until very last possible moment
|
||||
# That way if error or die occurs, fatals_to_browser will still work.
|
||||
# After we print this header, there is no way back to HTML. All we can do is deliver 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 );
|
||||
|
||||
my $codetype; # = 'Code39';
|
||||
|
|
|
|||
Loading…
Reference in New Issue