Converting a text file for printing

From: O-Dzin Tridral (tridralo_at_Cardiff.ac.uk)
Date: 01/28/05


Date: Fri, 28 Jan 2005 13:06:09 +0000
To: <beginners@perl.org>

Dear all,
 
We have an application which produces a plain ASCII text file which then needs to be printed on a laser printer.
 
Because it gets printed to pre-printed stationery things have to be correctly aligned.
 
The method that we have been given is to use MSWord to set the margins and font for the file and then print from there. The process of reading the file in, setting margins and sizes has to be repeated every time this process is carried out.
 
I would like to know if there's a good way to script this kind of process in perl so that if the script is run it will do all the work.
 
The paper size is A4, the printer is an hp9000.
The margins are
(top) 0.42cm, (bottom) 0.44cm, (left) 0.6cm, (right) 0.6cm.
The font is Courier New, Regular, 10pt.

I started playing with the Win32::OLE things, to read the file and set the parameters, but now I'm not sure if we need word at all. Is there a way that we can read the file, and output something to go to the printer without Word?

The kind of thing I was doing was:
my $doc = $word->{'Documents'}->Open("xxxxxxxxxx.rpt");
 
#
#+
# Select the entire document and set the font name and size
#-
$word->Selection->WholeStory;
$word->Selection->Font->{Name} = 'Courier New';
$word->Selection->Font->{Size} = 10;
#

and

my $page = $doc->{'PageSetup'};
$page->{'TopMargin'} = 11.9;
$page->{'BottomMargin'} = 14.2;
$page->{'LeftMargin'} = 11.9;
$page->{'RightMargin'} = 14.2;

Where the measurements are in points (I think).

I'd appreciate any pointer in the right direction. (We may also go back to the people who wrote this adnd ask them to make the file printable in the first place, but in the meantime I'd like to automate this as much as possible).

Thank you for any help.

'o-Dzin Tridral

--
the pearl is the oyster's autobiography. (Federico Fellini)
'ö-Dzin Tridral, Project Team Leader, Business Information Systems, Information Services, Cardiff University
+44(0)29 20876160, tridralo@cf.ac.uk


Relevant Pages

  • Re: Printing in Office 2004 vs. Office X
    ... track changes in balloons in the margins" bug. ... I'm not sure about the "draft font", that was a vague memory, but it's ... which does not support Unicode. ... Select your HD in the left list & click Repair Disk Permissions - ...
    (microsoft.public.mac.office.word)
  • Re: Font per vbs installieren
    ... Das von dir abgeanderte script bringt die Meldung (Uninstall the ... Font first) bei allen Fonts. ... dass die bereits installierte Schriftart ... Set oFSO = CreateObject ...
    (microsoft.public.de.german.scripting.wsh)
  • Re: Writing text into images, and setting text size
    ... generic billboard maker script, ... All options can be input from the command line in the form ... The problem is that the font that is identified by the index "5" is too ...
    (php.general)
  • Re: Printing in Office 2004 vs. Office X
    ... The font is Times New Roman ... The margins are Top 1", ... which does not support Unicode. ... Select your HD in the left list & click Repair Disk Permissions - ...
    (microsoft.public.mac.office.word)
  • Re: Printing in Office 2004 vs. Office X
    ... But what happens if you click the Font Substitution button? ... The margins are Top 1", ... Where are those Printer Settings? ... Select your HD in the left list & click Repair Disk Permissions - ...
    (microsoft.public.mac.office.word)