.prn is the text/binary output of a printer driver, change the driver and
you change the content of the .prn file.

To get your text easily you could use a generic text driver then easily
parse it, the problem with here is that Microsoft text printer driver behave
strangely if your screen resolution is not 640x480.

Another solution would be to print with postscript driver to the .prn file.
Then use either Aladdin or GNU Ghostscript. One of them (maybe both) has a
"ps2ascii" batch file.

ch

----- Original Message -----
From: "Ted Zeng" <[EMAIL PROTECTED]>
To: "Peter Eisengrein" <[EMAIL PROTECTED]>
Cc: "Perl-Win32-Users Mailing List (E-mail)"
<[EMAIL PROTECTED]>
Sent: Sunday, April 01, 2001 6:14 PM
Subject: Re: prn to txt


> I thought that you can print the file in Postscript, or PDF file format to
a
> file.
> Then you can easily view or edit your report after that.( Postscript file
is not
> easy to
> edit. But you can alwasy distill it to PDF file.)
>
> The only thing you need to do is setting it up when printing.
>
> I probably didn't understand what you want to do.
>
> Ted Zeng
>
> Peter Eisengrein wrote:
>
> > Thanks. This program did in fact let me view the file. But here's what I
am
> > trying to do. We have in-house software that creates a report that I can
> > view and print but not save (so I can resort, edit, etc). So I tried
"Save
> > to file" but now I have the challenge of interpreting PCL. With a few
> > people's suggestions I have been able to regex most of the junk out of
the
> > file but I have to go through a few girations to do it (see script
below),
> > and even then there's still a few lines of junk. But it'll have to do
for
> > now. (it's better than waiting for the app that created the report to
get
> > changed, trust me)
> >
> > Thanks to all that helped.
> >
> > #### pcl2txt.pl
> >
> > if (@ARGV)
> > {
> >         $file=$ARGV[0];
> > }
> > else
> > {
> >         print "Enter input filename: ";
> >         chomp($file=<STDIN>);
> > }
> >
> > $out="$file\.txt";
> >
> > $/ ="\033";
> >
> > open(FILE,$file) || die "Cannot open the file $file : $!\n";
> > open(OUT,"> $out") || warn "Cannot open output file $out. Will only
write to
> > screen: $!\n";
> >
> > foreach (<FILE>)
> > {
> >         ### Get rid of trailing \042 (can't get regex to do it)
> >         chop($_);
> >
> >         ### Get rid of asterisk at beginning (can't seem to get regex to
do
> > it)
> >         @_=split(//);
> >         shift(@_);
> >         $_ = join("",@_);
> >
> >         (undef, undef, $line) = split(/(\w\d{0,}[XY])(.*)/);
> >
> >         print "$line|";
> >         print OUT "$line|";
> >
> >         ### Column starts with MM/DD date
> >         if (($line =~ /^\d{2}\/\d{2}$/) || ($line eq "Sent"))
> >         {
> >                 $count=1;
> >         }
> >         elsif ($line eq '')
> >         {
> >                 $count++;
> >                 print "|";
> >                 print OUT "|";
> >         }
> >         else
> >         {
> >                 $count++;
> >         }
> >
> >         ### This is a 15 column report
> >         if ($count >= "15")
> >         {
> >                 print "\n";
> >                 print OUT "\n";
> >         }
> > }
> >
> > -----Original Message-----
> > From: Dirk Bremer [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, March 30, 2001 10:28 AM
> > To: Peter Eisengrein
> > Cc: Perl-Win32-Users Mailing List (E-mail)
> > Subject: Re: prn to txt
> >
> > Peter,
> >
> > I don't recall why you wanted to read this file, but it is definitely
PCL.
> > There is a standalone PCL-viewer named swiftview that you
> > can download a free evaluation version of if you just want to view the
file.
> > Do a web search for swiftview. If you have other
> > purposes in mind for the file that you are dealing with, the other
replies
> > you received should suffice.
> >
> > Dirk Bremer - Systems Programmer II - AMS Department - NISC
> > 636-922-9158 ext. 652 fax 636-447-4471
> >
> > <mailto:[EMAIL PROTECTED]>
> >
> > ----- Original Message -----
> > From: "Peter Eisengrein" <[EMAIL PROTECTED]>
> > To: "'Ted Zeng'" <[EMAIL PROTECTED]>; "Peter Eisengrein"
> > <[EMAIL PROTECTED]>
> > Cc: "Perl-Win32-Users Mailing List (E-mail)"
> > <[EMAIL PROTECTED]>
> > Sent: Thursday, March 29, 2001 4:36 PM
> > Subject: RE: prn to txt
> >
> > > Sorry if I was being vague. I can open it with notepad but there is
gobs
> > of
> > > control stuff in there (I am guessing 60% of it is control info). The
> > > control info is not necessarily just "non-keyboard" characters. Here's
a
> > > snippet of what it looks like:
> > >
> > > *p798XC7GQ04183*p1442XT1*p1911X
> > >
> > > interspersed throughout the document. So I guess I am asking if
there's a
> > > script that can tell the difference between the control junk and the
real
> > > data, and then removes the control junk? And therefore, is the
postscript
> > > control junk a standard?
> >
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
> > _______________________________________________
> > Perl-Win32-Users mailing list
> > [EMAIL PROTECTED]
> > http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [EMAIL PROTECTED]
> http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-users

Reply via email to