cristofayre has asked for the wisdom of the Perl Monks concerning the following question:
Before I ask the question, can I explain the ultimate goal in case there is an easier alternative.
I'm trying to create a PDF page of labels. Not the normal lines of text print. Rather, each label has a QR code on the right, (generated via GD) and a line of text along the bottom.
There is also a generic image to the right of QR code(An arrow with "Find your photos here") The label format is 3 wide x 8 deep
I am using PDF::AP12, and - by experimenting - have managed to =more or less= lay the lines of text where the bottom of labels will be.
This morning, I thought I would double check the layout, so created a Photoshop graphic (A4 @72dpi). IN THEORY, I can load the graphic, and then print text on top. (This would also be handy to learn for when I import the QR graphics. However ...
With text, I used:
$text = $page->text(); # Adds some text to page $text->font($font, 8); $across=12; $up=36; for ($x=0; $x<3; $x++){ # Across in 183dpi steps $new_across=$across+(183*$x); for ($y=0; $y<8; $y++){ # Up in 96dpi steps $new_up=$up+(98*$y); $text->translate($new_across, $new_up); $text->text('http://www. ###/abcde/122345'); $pdf->save
But now (lifted from CPAN docs) I have: $jpg=$pdf->image_jpeg('Path\To\label_layout.jpg');
What the heck do I do with the $jpg variable to add it to the PDF file??? I tried $jpg->translate(0,0) ... but that threw an error. So how do I position the graphic as well?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Add images to PDF using pdf::ap12
by vinoth.ree (Monsignor) on Feb 19, 2015 at 13:34 UTC | |
by cristofayre (Sexton) on Feb 20, 2015 at 16:52 UTC | |
|
Re: Add images to PDF using pdf::ap12
by gpapkala (Acolyte) on Feb 19, 2015 at 14:10 UTC | |
by cristofayre (Sexton) on Feb 20, 2015 at 17:02 UTC | |
by gpapkala (Acolyte) on Feb 24, 2015 at 21:08 UTC | |
by cristofayre (Sexton) on Feb 26, 2015 at 18:35 UTC |