Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6719089
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:03:05+00:00 2026-05-26T09:03:05+00:00

Possible Duplicate: How can I produce a PDF file using data in an XML

  • 0

Possible Duplicate:
How can I produce a PDF file using data in an XML file, in Perl?

I have xml tags that stored in a hash as shown below.

$var1={
     'stud.xml'={ 
                '24'=>'<address>
                        <streetname="xxxx"/>
                         <housenum="138"/">
                        </address>'
                 '20'=>'<address>
                       <streetname="xxxx"/>
                        <housenum="110"/">
                       </address>'
                     }...........

now I need to convert into pdf by using perl script. I searched and I found PDF::API2 is best module to convert into pdf. After reading module I am able to create new pdf file and set some settings like font, format,like….but I can’t understand how to process this xml data into pdf.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T09:03:05+00:00Added an answer on May 26, 2026 at 9:03 am

    Create a LaTeX template, populate the template using the data, and then run pdflatex on it.

    Note that the XMLish thing you posted is not helpful. Either post the actual XML or the Perl data structure.

    Here is an example:

    #!/usr/bin/env perl
    
    use warnings; use strict;
    use HTML::Template;
    use XML::Simple;
    
    my $xml = <<'EO_XML';
    <students>
        <student id="24">
            <address>
                <streetname val="xxxx"/>
                <housenum val="138" />
            </address>
        </student>
        <student id="20">
            <address>
                <streetname val="xxxx"/>
                <housenum val="110" />
            </address>
        </student>
    </students>
    EO_XML
    
    my $data = XMLin($xml)->{student};
    
    my @loop_data;
    
    for my $student (values %$data) {
        my $address = $student->{address};
        push @loop_data, {
            HOUSENUM => $address->{housenum}{val},
            STREETNAME => $address->{streetname}{val},
        };
    }
    
    my $tmpl = HTML::Template->new(filehandle => \*DATA);
    
    $tmpl->param(STUDENTS => \@loop_data);
    $tmpl->output(print_to => \*STDOUT);
    
    __DATA__
    \documentclass{article}
    
    \begin{document}
    
    <TMPL_LOOP STUDENTS>
    <TMPL_VAR HOUSENUM> <TMPL_VAR STREETNAME>
    
    </TMPL_LOOP>
    \end{document}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Can Read-Only Properties be Implemented in Pure JavaScript? I have an Object
Possible Duplicate: How can I convert my java program to an .exe file ?
Possible Duplicate: How can I find the method that called the current method? I
Possible Duplicate: How can I take screenshots with Perl? How can I take a
Possible Duplicate: When is it OK to use an XML file to save information?
Possible Duplicate: Generate a Hash from string in Javascript/jQuery Can anyone suggest a simple
Possible Duplicate: Python: Date Ordinal Output? In Python time.strftime can produce output like Thursday
Possible Duplicate: What tool(s) can I use to produce iPhone App Screencasts? I've heard
Possible Duplicate: In C#, why can't a List<string> object be stored in a List<object>
Possible Duplicate: Why am I getting an “Out of memory” error with Perl's XML::Simple?

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.