eymengunay / php-passbook

iOS passbook library for PHP
http://eymengunay.github.io/php-passbook/
MIT License
263 stars 53 forks source link

Align text into passbook #83

Closed sbellver closed 4 years ago

sbellver commented 4 years ago

Is any way to center the text?

I try into logoText and Secondary Field with no success

sbellver commented 4 years ago

I use as:

$secondary = new Field('nombre', 'TEXTO A MOSTRAR' ); $secondary->setTextAlignment('ALIGN_CENTER'); $secondary->setLabel('Nombre'); $structure->addSecondaryField($secondary);

But then the passbook have an error and cannot open it. If i comment

$secondary->setTextAlignment('ALIGN_CENTER');

Passbook is generated/opened without problems

razvanphp commented 4 years ago

The values you have to pass are different, see here: https://github.com/eymengunay/php-passbook/blob/master/src/Passbook/Pass/Field.php#L23

In your case you are not using the constants, try this:


$secondary->setTextAlignment(\Passbook\Pass\Field::ALIGN_CENTER);
sbellver commented 4 years ago

Your right, thx