|
Re: alignmargins - printer ignores settings: msg#00174printing.cups.general
On Sun, 14 Sep 2003 17:06:06 +0200, The Eye <michael.hellwig-6WDnQFJhonGzZXS1Dc/lvw@xxxxxxxxxxxxxxxx> wrote: [...] > >What do I have to do for the margins to also apply to text-files? >printed just with "lpr <nameoffile>" > >I'm kinda confused here, haven't seen this behaviour mentioned anywhere. > [...] The problem is, the texttops filter does not use the HWMargins info that alignmargins adds to the ppd. Instead, it uses the ImageableArea lines in the ppd to determine the margins. I'll bet your PPD has ImageableArea's set the same as the page sizes. I ran into this myself, so I wrote a perl script that will modify the ImageableArea lines. This script is attached at the end of this message. To use it, save this message, then edit it to remove everything above (but not including) the "#!/usr/bin/perl" line, and make the file executable (chmod +x filename). Run alignmargins (if you havn't already) to put the correct HWMargins data in the ppd. Then, run this script specifying the print queue name as its only argument. Repeat for every print queue that needs adjustment. - Heath Kehoe ______CUT_HERE_______ #!/usr/bin/perl $ppd_dir = "/etc/cups/ppd"; die "Usage: $0 <print_queue>" if ( @ARGV != 1 ); open IN, "$ppd_dir/$ARGV[0].ppd" or die "Can't open $ppd_dir/$ARGV[0].ppd ($!)"; @lines = <IN>; close IN; foreach ( @lines ) { if(/HWMargins.\s*([\d.-]+)\s+([\d.-]+)\s+([\d.-]+)\s+([\d.-]+)/) { $ml = $1; $mb = $2; $mr = $3; $mt = $4; } } if(!defined($ml)) { die "Didn't find HWMargins in the ppd. Run alignmargins first.\n"; } foreach ( @lines ) { if(m|^\s*\*PaperDimension (.+?)/.+?\:\s*(.*)$|) { $pd{$1} = $2; } if(m|^\s*\*ImageableArea (.+?)/.+?\:\s*(.*)$|) { $ia{$1} = $2; } } foreach $p ( keys %ia ) { unless(exists($pd{$p})) { warn "No PaperDimension given for size '$p'"; next; } if($pd{$p} =~ /([\d.-]+)\s+([\d.-]+)/) { $newia{$p} = "\"$ml $mb " . ($1 - $mr) . " " . ($2 - $mt) . '"'; } else { warn "Can't parse '$pd{$p}'"; } } foreach ( @lines ) { if(m|^\s*\*ImageableArea (.+?)/(.+?)\:|) { if(exists($newia{$1})) { $old = $_; $_ = "*ImageableArea $1/$2: $newia{$1}\n"; print "Replacing: ${old}With: $_" if($old ne $_); } } } open OUT, ">$ppd_dir/$ARGV[0].ppd" or die "Can't open $ppd_dir/$ARGV[0].ppd for write ($!)"; print OUT @lines; close OUT; |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Can't calcel jobs.: 00174, Jordi |
|---|---|
| Next by Date: | Re: Can't calcel jobs.: 00174, Jordi |
| Previous by Thread: | alignmargins - printer ignores settingsi: 00174, The Eye |
| Next by Thread: | Re: alignmargins - printer ignores settings: 00174, The Eye |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | Mail Home | sitemap | FAQ | advertise |