psliwa/PdfBundle

Barcode

Closed this issue · 2 comments

<pdf>
    <dynamic-page>
        Hello {{ app.user.completename }}!
        <barcode type="code25" code="1234567890" />
    </dynamic-page>
</pdf>

I get this error:

Catchable Fatal Error: Argument 3 passed to PHPPdf\Core\Engine\AbstractGraphicsContext::drawBarcode() must be an instance of Zend\Barcode\Object, instance of Zend\Barcode\Object\Code128 given, called in C:\wamp\www\Symfony\vendor\PHPPdf\lib\PHPPdf\Core\Node\Barcode.php on line 134 and defined in C:\wamp\www\Symfony\vendor\PHPPdf\lib\PHPPdf\Core\Engine\AbstractGraphicsContext.php line 160 

Im using the default config:
ps_pdf:
    nodes_file: ~
    fonts_file: ~
    complex_attributes_file: ~
    colors_file: ~
    use_cache_in_stylesheet: ~
    cache:
      type: ~
      options: ~
    markdown_stylesheet_filepath: ~
    markdown_document_template_filepath: ~
    document_parser_type: ~


my autoload:


          'Ps' => __DIR__.'/../vendor/bundles',
      'PHPPdf' => __DIR__.'/../vendor/PHPPdf/lib',
      'Imagine' => array(__DIR__.'/../vendor/PHPPdf/lib', __DIR__.'/../vendor/PHPPdf/lib/vendor/Imagine/lib'),
      'Zend' => __DIR__.'/../vendor/PHPPdf/lib/vendor/Zend/library',//If you have used ZF2 packages already, you should skip this entry


my appkernel:

            new Ps\PdfBundle\PsPdfBundle(),

Probably you use ZF2 beta5. Old versions of PHPPdf (1.1.2 and down) was compatible with old versions ZF2, try to update to the newest PHPPdf version (1.1.3) - this issue has been fixed few days ago (psliwa/PHPPdf#12)

TY! That resolved my problem. It would be usefull to change the documentation in order to download the newest PHPPdf version.