Reputation: 33
I have a PHP script that makes a pdf from dynamic data. I need to put printer marks on the page that I tried to achieve this way:
function drawPrinterMarks($obj, $pageWidth, $pageHeight){
$registrationMarks=array(
array($pageWidth/2, 5),
array($pageWidth/2, $pageHeight-5),
array(5, $pageHeight/2),
array($pageWidth-5, $pageHeight/2)
);
$regLineStyle=array('width'=>0.07, 'color'=>array(100,100,100,100));
$whiteLineStyle=array('width'=>0.07, 'color'=>array(0,0,0,0));
foreach($registrationMarks as $rM){
$obj->Ellipse($rM[0], $rM[1], 2, 0, 0, 0, 360, '', '', array(0,0,0,0));
$obj->Ellipse($rM[0], $rM[1], 1, 0, 0, 0, 360, 'F', '', array(100,100,100,100));
$obj->Line($rM[0]-2.5, $rM[1], $rM[0]+2.5, $rM[1], $regLineStyle);
$obj->Line($rM[0], $rM[1]-2.5, $rM[0], $rM[1]+2.5, $regLineStyle);
$obj->Line($rM[0]-1, $rM[1], $rM[0]+1,$rM[1], $whiteLineStyle);
$obj->Line($rM[0], $rM[1]-1, $rM[0], $rM[1]+1, $whiteLineStyle);
}
}
It draws the first mark (at the middle of the top) the way I want. (looks like the standard registration mark that Acrobat uses) But it doesn't draw the outer circle at the others. See the example
Any ideas?
Upvotes: 3
Views: 333
Reputation: 4029
Here, you tell TCPDF to draw an ellipse with the current line style:
$obj->Ellipse($rM[0], $rM[1], 2, 0, 0, 0, 360, '', '', array(0,0,0,0));
But the last lines drawn for each registration mark are white. So for the subsequent marks the ellipse is drawn with white lines and white fill.
If you explicitly set the linestyle parameter on the first ellipse, it'll draw the outside circle for all your marks.
$obj->Ellipse($rM[0], $rM[1], 2, 0, 0, 0, 360, '', $regLineStyle, array(0,0,0,0));
Upvotes: 1