use Class::Declarative qw(PDF::Declarative);
pdf (displaytitle, encoding=latin1) "mynewpdf.pdf"
author "Michael Roberts"
title "PDF::Declarative Example 1"
subject "Building PDFs with explicitly placed elements"
keywords "Declarative PDF generation"
mediabox "105mm x 148mm"
#bleedbox "5mm, 5mm, 100mm, 143 mm"
cropbox "7.5mm 7.5mm 97.5 mm 140.5mm"
#artbox "10mm, 10mm, 95mm, 138mm"
page
graphic blue_box
fill (darkblue)
rect "5mm, 125mm, 95mm, 18mm"
graphic red_line
stroke (red)
move "5mm, 125mm"
line "100mm, 125mm"
text heading (flow=no, x=95mm, y=131mm, align=right, color=white, font=helvetica, bold, fontsize=18pt)
Using PDF::Declarative
graphic background
stroke (lightgrey)
circle "20mm, 45mm, 45mm"
circle "18mm, 48mm, 43mm"
circle "19mm, 40mm, 46mm"
box left_column (border) "10mm, 121mm, 41mm, 111mm"
text (lead=7pt, parspace=0, align=justify, color=black, font=times, fontsize=6)
Perci ent ulluptat vel eum zzriure feuguero core consenis adignim...
text (align=center, font=helvetica, bold, fontsize=6pt, color=blue)
Enim eugiamc ommodolor sendre feum zzrit at. Ut prat. Ut lum quisi.
text (align=right, font=times, color=black, fontsize=6pt)
It augait ate magniametum irit, venim doloreet augiamet...
graphic
image "54mm, 66mm, 41mm, 55mm"
jpeg "Portrait.jpg"
box right_column (border, dash=2 2 1 2, color=blue) "54mm, 64mm, 41mm, 54mm"
text (lead=7pt, parspace=0pt, align=justify, indent=5pt, fontsize=6pt, bullet=B7)
Orpero do odipit ercilis ad er augait ing ex elit autatio....
Again: the above is a complete Perl program, and it generates a valid PDF file with justified text in columnar boxes. With a few extensions to the existing code, I think it's going to be just about time to release it into the wild, my first semantic module to qualify.
Current calendar time invested: 11 days. I think about a month would be necessary to do PDFs right - probably far more to do them right, but "good enough" in a month is pretty fast work. Fast enough I haven't lost interest before finishing something useful.
No comments:
Post a Comment