With prFile('data.pdf') being within the loop, a new document is being created at every line. This is how I think it should look ;
#!/usr/bin/perl use PDF::Reuse; use strict; use warnings; printinterrr(); sub printinterrr { open(MYINPUTFILEONE, "data.txt"); $| = 1; my @linesone = <MYINPUTFILEONE>; # read file into list close (MYINPUTFILEONE); printf (" =================\n\n"); printf (" | VERIFY NAME |\n\n"); printf (" =================\n\n"); printf (" \n\n"); printf (" PLEASE INSERT NAME TO VERIFY:\n\n"); printf (" \n\n\n\n\n\n\n\n"); my $interrrverify = <STDIN>; $interrrverify = <STDIN> until defined $interrrverify; chomp($interrrverify); printf (" ========================================\n\n"); printf (" | NAME | NUMBER | TYPE | OWNER | INTER |\n\n"); printf (" ========================================\n\n\n"); my $found = 0; my $pageTop = 800; my $pageBottom = 40; my $x = 35; # Left margin my $y = 760; my $step = 10; # Distance between lines (fontsize = 12) prFile('data.pdf'); prCompress(1); # Compress streams prFont('Times-Roman'); prText(50, 800, "======================================="); prText(50, 790, "NAME NUMBER TYPE OWNER INTER"); prText(50, 780, "======================================="); + my $format = " %-13s %-15s %-11s %-10s %0s\n"; foreach my $interrrverify2 (@linesone) { my @fieldone = split(":", $interrrverify2); if ($fieldone[4] =~ /(?<![\w-])$interrrverify(?![\w-])/i) { printf ($format, $fieldone[0], $fieldone[1], $fieldone[2], $fiel +done[3], $fieldone[4]); prText(50, $y, "$fieldone[0]"); prText((50 + 90), $y, "$fieldone[1]"); prText((50 + 195), $y, "$fieldone[2]"); prText((50 + 272), $y, "$fieldone[3]"); prText((50 + 335), $y, "$fieldone[4]"); $found =1; if ($y < $pageBottom) { prPage(); $y = $pageTop; } else { $y -= $step; } } } # END FILE LOOP prEnd; } sleep 10;
Note the prEnd is also outside the loop.
poj

In reply to Re^3: Print to PDF by poj
in thread Print to PDF by PilotinControl

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.