PDF::APIx::Layout is newly released module for marking up text parapgraphs with PDF::API2. It can produce quite advanced text markup, including mixing fonts colors, with justification and reflow etc.

It would be nice to be able to utilize this stuff from PDF::Template, either through direct embedding of these tags in whatever markup language that you come up with, or through your proposed plugin scheme!

A simple 'hello world' example follows:

#!/usr/bin/perl use strict; use PDF::API2; use PDF::APIx::Layout; my $pdf=PDF::API2->new; my @fonts = ( [$pdf->corefont('Times-Roman',-encode=>'latin1'), 'default', $pdf->corefont('Times-Bold',-encode=>'latin1'), 'bold', 'regular' +] ); my $cell = PDF::APIx::Layout->MarkupText( q|<p size="15">Hello <span color="blue" face="bold">bold new</span +> world</p>|, -fontreg=>\@fonts, -background=>'#aff', -align=>'c' ); my $page = $pdf->page; my $gfx = $page->gfx; $cell->render($pdf,$page,$gfx,100,500,100,100); $pdf->saveas('/tmp/hello_world.pdf');

In reply to Re: PDF::Template redesign - I want your ideas! by snoopy
in thread PDF::Template redesign - I want your ideas! by dragonchild

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.