summaryrefslogtreecommitdiffstats
path: root/perl-install
diff options
context:
space:
mode:
authorTill Kamppeter <tkamppeter@mandriva.com>2002-08-27 01:11:27 +0000
committerTill Kamppeter <tkamppeter@mandriva.com>2002-08-27 01:11:27 +0000
commit11725c693bfdf12e7f221e653476844c835f1276 (patch)
tree7f8a92733a5dc3c9366b593577d938065e0ad28e /perl-install
parent5dbcbceabc4ac39029b47871a122e10bc8780493 (diff)
downloaddrakx-backup-do-not-use-11725c693bfdf12e7f221e653476844c835f1276.tar
drakx-backup-do-not-use-11725c693bfdf12e7f221e653476844c835f1276.tar.gz
drakx-backup-do-not-use-11725c693bfdf12e7f221e653476844c835f1276.tar.bz2
drakx-backup-do-not-use-11725c693bfdf12e7f221e653476844c835f1276.tar.xz
drakx-backup-do-not-use-11725c693bfdf12e7f221e653476844c835f1276.zip
Set default text margins to half an inch and default size for images
to be printed to the full page.
Diffstat (limited to 'perl-install')
-rw-r--r--perl-install/printer.pm32
1 files changed, 32 insertions, 0 deletions
diff --git a/perl-install/printer.pm b/perl-install/printer.pm
index 9255411c9..d5bc1e22b 100644
--- a/perl-install/printer.pm
+++ b/perl-install/printer.pm
@@ -1052,6 +1052,29 @@ sub read_cups_options ($) {
return \@args;
}
+sub set_cups_special_options {
+ my ($queue) = $_[0];
+ # Set some special CUPS options
+ my @lpoptions = chomp_(cat_("$prefix/etc/cups/lpoptions"));
+ # If nothing is already configured, set text file borders of half an inch
+ # and decrease the font size a little bit, so nothing of the text gets
+ # cut off by unprintable borders.
+ if(!grep {/$queue.*\s(page-(top|bottom|left|right)|lpi|cpi)=/} @lpoptions){
+ run_program::rooted($prefix, "lpoptions",
+ "-p", $queue,
+ "-o", "page-top=36", "-o", "page-bottom=36",
+ "-o", "page-left=36", "-o page-right=36",
+ "-o", "cpi=12", "-o", "lpi=7", "-o", "wrap");
+ }
+ # Let images fill the whole page by default
+ if (!grep {/$queue.*\s(scaling|natural-scaling|ppi)=/} @lpoptions) {
+ run_program::rooted($prefix, "lpoptions",
+ "-p", $queue,
+ "-o", "scaling=100");
+ }
+ return 1;
+}
+
#------------------------------------------------------------------------------
sub read_cups_printer_list {
@@ -1418,6 +1441,11 @@ sub configure_queue($) {
"-C", "up", $printer->{currentqueue}{queue});
}
+ # In case of CUPS set some more useful defaults for text and image printing
+ if ($printer->{SPOOLER} eq "cups") {
+ set_cups_special_options($printer->{currentqueue}{queue});
+ }
+
# Check whether a USB printer is configured and activate USB printing if so
my $useUSB = 0;
foreach (values %{$printer->{configured}}) {
@@ -1682,6 +1710,10 @@ sub copy_foomatic_queue {
"-s", $printer->{SPOOLER},
"-n", $newqueue,
"-C", $oldspooler, $oldqueue);
+ # In case of CUPS set some more useful defaults for text and image printing
+ if ($printer->{SPOOLER} eq "cups") {
+ set_cups_special_options($newqueue);
+ }
}
# ------------------------------------------------------------------