Font color property in PDF using perl PDF::Create -


how set font-color property when creating pdf through perl module pdf::create? below code snippet using. how can set font color property here?

use warnings; use strict;  use pdf::create; use pdf::image::jpeg;  print "pdf image\n";  #create $pdf = new pdf::create(     'filename' => "./image_embed_test.pdf",     'version'  => 1.2,     'pagemode' => 'usenone',     'author'   => 'madhan',     'title'    => 'my pdf', );  # prepare 2 fonts $f1 = $pdf->font('subtype'  => 'type1',                     'encoding' => 'winansiencoding',                     'basefont' => 'helvetica');  $f2 = $pdf->font('subtype'  => 'type1',                     'encoding' => 'winansiencoding',                     'basefont' => 'helvetica-bold');  $f3 = $pdf->font('subtype'  => 'type1',                     'encoding' => 'winansiencoding',                     'basefont' => 'helvetica-bold');   $root = $pdf->new_page('mediabox' => [ 0, 0, 612, 792 ]);  @page; $page[1]=$root->new_page;  $jpg1 = $pdf->image('./logo1.jpg'); $page[1]->image( 'image'  => $jpg1,                  'xscale' => 0.5,                  'yscale' => 0.5,                  'xpos'   => 56,                  'ypos'   => 698);     $page[1]->stringc($f2, 8, 484, 738, "add line 1");    $page[1]->stringc($f2, 8, 521, 718, "city");    $page[1]->stringc($f2, 8, 530, 698, "phone");    $page[1]->stringc($f3, 8, 530, 698, "myid@example.com");  $pdf->close; 

in $f3 mail id link need set color blue.

you need use setrgbcolor method pdf::create::page.

setrgbcolor($r, $g, $b)
sets fill colors used normal text or filled objects.

it looks need set before run stringc operation @ set color subsequent operations. turn blue, write blue text, , turn black (or default).

$page[$num]->setrgbcolor(1, 0, 0); # blue $page[$num]->stringc($f3, 8, 530, 698, "myid@example.com"); $page[$num]->setrgbcolor(0, 0, 0); # black 

directly below setrgbcolor there setrgbcolorstroke, explains parameters values between 0 , 1.


Comments

Popular posts from this blog

matlab - error with cyclic autocorrelation function -

django - (fields.E300) Field defines a relation with model 'AbstractEmailUser' which is either not installed, or is abstract -

c# - What is a good .Net RefEdit control to use with ExcelDna? -