in reply to perl script to print data like this in pdf.

veerubiji:

You can make your program output the data on the console in the format you want, right? If so, it's a simple step to making a PDF document look just like it. The bit I did for you with Data::Dumper is a straight ripoff from the PDF::API2 documentation.

If you can't write your perl script to output the data on the console in the format you want, then you ought to start with that first.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: perl script to print data like this in pdf.

Replies are listed 'Best First'.
Re^2: perl script to print data like this in pdf.
by veerubiji (Sexton) on Oct 21, 2011 at 08:17 UTC

    Hi I modified but i am getting syntax errores at near ")[" and also at end "}".

    my %nums; while ($reader->nextElement( 'Number' )) { my $number = $reader->copyCurrentNode(1)->textContent; $reader->nextElement( 'address' ); my $node = $reader->copyCurrentNode(1); my $infohash = { house => $node->getElementsByTagName( 'housenumber' )[0]->tex +tContent, street => $node->getElementsByTagName( 'streetname' )[0]->tex +tContent, }; $nums{$number} = $infohash; }

      veerubiji:

      The syntax is nearly there. Try it this way:

      my %nums; while ($reader->nextElement('Number')) { my $number = $reader->copyCurrentNode(1)->textContent; $reader->nextElement('address'); my $node = $reader->copyCurrentNode(1); my $infohash = { house => $node->getElementsByTagName( 'housenumber' )->[0]->t +extContent, street => $node->getElementsByTagName( 'streetname' )->[0]->t +extContent, }; $nums{$number} = $infohash; }

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.