Jump to content

TCPDF


honkmaster
 Share

Recommended Posts

Hi I'm stuck with an issue i can't work out. I'm using php and TCPDF to create a pdf label. The user uses a simple form and selects the colour the label needs to be. Problem I have got is no matter what I post TCPDF does not pick up the colour variable.

 

In the below code the SetFillColour works if i put RGB or CMYK info in direct but not if I post it so $pdf->SetFillColor(219, 200, 19); works but if i post from a form $pdf->SetFillColor($getcolour); it does not???

 

Any ideas or help would be grateful, Cheers

$getcolour = $_POST['colour'];// Format Store ID Block	$pdf->StartTransform();	$pdf->SetFont('Helvetica', 'B', 40);	$pdf->setCellPaddings(0, 0, 0, 0);	$txt = $storeid;	$pdf->SetXY(1,49);	$pdf->Rotate(90);	$pdf->SetFillColor($getcolour);	$pdf->MultiCell(48, 0, $txt."n", 0, 'C', 1, 1, '' ,'', true);	$pdf->StopTransform();
Link to comment
Share on other sites

Have you checked what parameters the SetFillColor() method accepts? Check what value $getcolour has and make sure it's what you expected it to be.

Link to comment
Share on other sites

Are you saying that you are submitting something like the string "219, 200, 19" and expecting that to work? In that case you are sending the function a single string parameter, when it expects 3 number parameters. That is not the same thing. Split up the string into individual values, figure out whether you have 3 or 4, validate them, and then call the appropriate function with the values.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...