Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
#!/usr/bin/perl -w use strict; foreach (@ARGV) { open CODE, '<', $_ or die "Error opening $_: $!\n"; (my $ps = $_) =~ s/\.[^.]+$/.ps/; open PS, '>', $ps or die "Error opening $ps: $!\n"; print PS <<EOT; %!PS-Adobe-3.0 /Courier findfont 10 scalefont setfont /pageNo 0 def /lineNo 0 def /linefeed {y 84 le {showpage startPage} if /y y 12 sub def 1 eq {/line +No lineNo 1 add def lineNo 5 mod 0 eq {61 y lineNo printNum} if} if 6 +6 y moveto} def /hyphen {1 0 0 setrgbcolor (-) show 0 0 0 setrgbcolor 0 linefeed} def /startPage {/pageNo pageNo 1 add def 66 725 moveto ($_) show 546 725 p +ageNo printNum 66 722.5 moveto 480 0 rlineto stroke /y 722 def} def /printNum {/str 20 string def str cvs stringwidth pop 3 2 roll sub neg + exch moveto str show} def startPage EOT while (<CODE>) { chomp; 1 while s/\t+/' ' x (length($&)*8 - length($`)%8)/e; print PS "1 linefeed\n"; getline: my $line = substr $_, 0, length > 80 ? 79 : 80, ''; $line =~ s/([()\\])/\\$1/g; print PS "($line) show "; if ($_) {print PS "hyphen "; goto getline; } } print PS "showpage\n"; }

In reply to Code Typesetter by Minimiscience

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (8)
As of 2024-04-24 09:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found