I'm trying to use spot color as fill on my text background and I can't seem to make it work
This is my code.
$p->setcolor("fill", "cmyk", 0.0, 1.0, 0.8,0.0);
$red = $p->makespotcolor("Redspot");
$p->setcolor("fill","spot",$red,1.0,0.0,0.0);
$p->fit_textline('spot color back',0,0,"matchbox={boxheight={88% 24.5%} fill={".$red." 1 0 0}} position={center bottom}");
The expected output is a text on top of a box both using Redspot as spot color name and the fill of the box behind it being lighter.
I see a few small problems in your code snippet, but I get it the expected output
when I change your code to:
$fontopt = "fontname=NotoSerif-Regular fontsize=24";
$p->setcolor("fill", "cmyk", 0.0, 1.0, 0.8,0.0);
$red = $p->makespotcolor("Redspot");
$p->setcolor("fill","spot",$red,1.0,0.0,0.0);
$p->fit_textline('spot color back',0,0, $fontopt .
" matchbox={boxheight={88% 24.5%} fillcolor={spot ".$red." 0.1}} " .
" position={center bottom}");
The following have I changed:
fillcolor
(see PDFlib 10 API Reference 6.2.1 "Defining Matchboxes")spot
, then the spotcolor handle (here $red) and then the tint value. In my sample set this to 0.1 (10%)Please see also PDFlib 10 API reference chapter 1.1.4 Color Data Type for details about the correct option list syntax for colors.
I hope helps.