Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

text file to pdf file

by babug_prg (Hermit)
on Oct 10, 2006 at 02:20 UTC ( #577308=perlquestion: print w/replies, xml ) Need Help??
babug_prg has asked for the wisdom of the Perl Monks concerning the following question:

{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit;}\viewkind4\uc1\pard\f0\fs20 my %chash;\par my %chash;\par while ($binstr =~ m#(<ref(?:>| ^>*>)(?:(?:(?!</ref>).)+)</ref>)#isg)\{\par my $cline=$1;\par my $reference;\par my $etal;\par \tab\par \tab my ($id)=$cline =~ m#<ref id="(^"*)">#is;\par \par \tab my ($year)=$cline =~ m#<Year>((?:(?!</Year>).)+)</Year>#is;\par \tab\par \tab\tab my @bibauthor; \par \par \par \tab\tab while ($cline =~ m#<surname>((?:(?!</surname>).)+)</surname>#isg)\tab\tab\par \tab\tab\{ my $con=$1;\par \tab\tab\tab \par \tab\tab\tab\tab push(@bibauthor,$con); \par \tab\tab\tab\par \tab\tab\}\par \par \par \tab\tab my $i =$#bibauthor -1;\par \par \tab\tab for my $j(0..$i)\par \tab\tab\{\par \tab\tab\tab $reference .='van '.quotemeta($bibauthor$j).', \\(\\)&\\#38;*';\par \tab\tab\tab\par \tab\tab\}\par \par \par \tab\tab\par \tab\tab if($i eq '-1')\par \tab\tab\{\par \par \tab\tab $reference =~ s#^#$bibauthor[0].'\\, \\(\\)*'.'(?:(?:\\d\{4\}\\, \\(\\)*)</ref>)*)'.$year#ise;\par \tab\tab $chash\{$reference\}=$id;\par \par \par \tab\tab\}\par \tab\tab elsif($i eq '0')\par \tab\tab\{ my $t=$i+1;\par \tab\tab\tab $reference =~ s#$#'\\, and \\(\\)&\\#38 *'.$bibauthor$t.'\\, \\(\\)*'.'(?:(?:\\d\{4\}\\, \\(\\)*)</ref>)*)'.$year#ise;\par \tab\tab\tab $chash\{$reference\}=$id;\par \tab\tab \}\par \tab\tab else\tab \{\par \tab \tab my $t=$i+1;\par \tab \tab\par \tab\tab\tab\par \tab\tab\tab $reference =~ s#$#'\\, and \\(\\)&\\#38 *'.$bibauthor$t.'\\, \\(\\)*'#ise;\par \tab\tab\tab $etal ='(?:'.$reference.'|'.$bibauthor[0].'\\, et al\\., \\(\\)*'.')'.'(?:(?:\\d\{4\}\\, \\(\\)*)</ref>)*)'.$year;\par \tab\tab\tab $chash\{$etal\}=$id;\tab\tab\tab\par \}\par \tab \par \tab \par \tab\tab\par \tab\par \tab\}\par \tab\par \par \tab\par \}\par \par \par \par my @creference=keys %chash;\par for my $ref(@creference)\par \{\par \par $binstr =~ s#($ref)#<cite refid="$chash\{$ref\}">$1</ref>#isg;\par \}\par \par $input =~ m#(<ref ^><*>)\\(((?:(?:(?!</ref>).)+)</ref>;((?: *<ref ^><*>^\\((?:(?:(?!</ref>).)+)^\\)</ref>;*)*)<ref ^><*>^\\((?:(?:(?!</ref>).)+))\\)(</ref>)#\\($1$2$3\\)#isg;\par \par \par \par }

Replies are listed 'Best First'.
Re: text file to pdf file
by GrandFather (Sage) on Oct 10, 2006 at 02:29 UTC
Re: text file to pdf file
by grep (Monsignor) on Oct 10, 2006 at 04:34 UTC
    I assume from your post you want to get the text from a Word document, but your title says 'text file'. It will help us give good answers, if you use good titles.

    You're better off if you can avoid the MS Word format and use plain text or RTF. It's difficult to read the text out of a Word document - take a look at Open a Microsoft Word Doc and Save as plain text file. Though you may want to try the newer OpenOffice::OODoc modules.

    This was also found with Super Search

    One dead unjugged rabbit fish later
Re: text file to pdf file
by jbrugger (Parson) on Oct 10, 2006 at 05:32 UTC
    It's easy to 'print' any word / text document in windows using 'PDFCreator'
    see for more information
    But eh.... what was the Perl question?

    "We all agree on the necessity of compromise. We just can't agree on when it's necessary to compromise." - Larry Wall.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://577308]
Approved by GrandFather
and the monastery is silent...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (10)
As of 2018-06-25 16:53 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (127 votes). Check out past polls.