Git Product home page Git Product logo

zend-barcode's Introduction

zend-barcode

Repository abandoned 2019-12-31

This repository has moved to laminas/laminas-barcode.

Build Status Coverage Status

Zend\Barcode provides a generic way to generate barcodes. The Zend\Barcode component is divided into two subcomponents: barcode objects and renderers. Objects allow you to create barcodes independently of the renderer. Renderer allow you to draw barcodes based on the support required.

zend-barcode's People

Contributors

akrabat avatar bakura10 avatar dasprid avatar evandotpro avatar ezimuel avatar freeaqingme avatar froschdesign avatar jonathanmaron avatar koopzington avatar maks3w avatar marc-mabe avatar michalbundyra avatar micheh avatar mikaelkael avatar mpinkston avatar mwillbanks avatar ocramius avatar padraic avatar prolic avatar ralphschindler avatar samsonasik avatar sgehrig avatar stefanotorresi avatar steverhoades avatar thinkscape avatar thomasweidner avatar vahid-sohrabloo avatar veewee avatar wdalmut avatar weierophinney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

zend-barcode's Issues

Check All Headers In Documentation

Check headers are correct

TLDR; Headers should use the #, ## etc to format different levels of headers, and not be underlines using ===== or ``-----`, or be psuedo header using bold

Check all headers on the documentation - headers should use the hash style of declaration rather then be underlined with equals or dashes. The more hashes, the more of a subheading. Eg:

  • # is equal to <h1>
  • ## is equal to <h2>
  • ### is equal to <h3>
  • #### is equal to <h4>
  • ##### is equal to <h5>

Headings should be appropriate for their level in the documentation.

Psuedo headers using bold tags ** should be replaced with appropriate level of heading tag.

Problems generating barcodes with the checksum already in the text

I have a database with a bunch of EAN13 codes that already includes the checksums (the last character in the code). I'm trying to render barcodes out of these but I'm only getting the following error message:

"The input should have a length of 13 characters"

Reproducible code:

$barcodeOptions = [
    'text' => '7090037170787' // valid barcode including the checksum character
];
$rendererOptions = [
    'imageType' => 'png',
];
$barcode = \Zend\Barcode\Barcode::factory(
    'ean13',
    'image',
    $barcodeOptions,
    $rendererOptions
);
$barcode->render();

This results in an image that has the error message mentioned above.

Is there any other options I can use that informs the barcode object and/or renderer that the checksum is already included in the text option? I could of course do 'text' => substr('7090037170787', 0, -1) but this seems rather counterintuitive.

GS1-128 Barcode standard

The GS1-128 barcode 'extends' the Code128 standard and uses special function characters FNC1 etc.
Here is their spec http://www.gs1.org/docs/barcodes/GS1_General_Specifications.pdf

I notice the charset in the Code128 class mentions these special FNC1 characters, but as of yet their use hasn't been implemented.

This SO Post claims to have a solution to get these characters working:
http://stackoverflow.com/questions/10880333/create-code-128-barcode-with-zend-barcode-component-that-contains-an-fnc3-functi

Also, here's some guys class where he hacked in some fix for GS1:
https://gist.github.com/delboy1978uk/0ac571edda658f4d477effa2debd09a4#file-gistfile1-txt-L684-L687

I am going to attempt to extend Code128 with my own class and get GS1 type barcodes working.

If I'm successful, I'll fork the Zend repo, add the class, and send a pull request! If anyone else knows how to do this quickly though, please help me! :-)

Thanks
Derek

Orientation breaks barcode

This issue has been moved from the zendframework repository as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html


Original Issue: zendframework/zendframework#7130
User: @yahor-kalinin
Created On: 2015-01-16T21:48:16Z
Updated At: 2015-10-02T09:22:03Z
Body
When I'm trying to render a vertical Code39 barcode it's looks like:
screenshot from 2015-01-16 04 03 26

Code example:

$barcode = new Code39([
    'orientation' => 90,
    'text'        => 'ZEND',
    'drawText'    => false
]);

$renderer = new Image([
    'barcode' => $barcode,
]);

$renderer->render();

When I change this line:

$point1 = $this->rotate($xpos, $ypos + $bar[2] * $barLength);

to:

$point1 = $this->rotate($xpos - 1, $ypos + $bar[2] * $barLength);

The barcode renders in right way:
screenshot from 2015-01-16 04 04 44

But, this change breaks render of horizontal barcodes.
Can someone help me in determining the source of this behavior?


Comment

User: @ArtemGordinsky
Created On: 2015-10-02T09:21:41Z
Updated At: 2015-10-02T09:22:03Z
Body
Encountered the exact same bug in ZF 1. Does anyone have any workarounds besides manually rotating the generated image?


Check Documentation For Other Things

Check docs for other problems

TLDR; Cast your eye over the documetation for any problems not covered in the other issues

Things slip through the net, so check the documentation for other problems that have been missed. Common other problems include

  • Bullet lists (should be single * then space at the start of line)
  • Inline code - should be marked by three backticks at start and finish
  • bookdown.json file is correctly formated and has the right escaping
  • Links between documentation using RST have been stripped
  • Any other RST has been removed correctly
  • Anything and everything not covered

If you end up fixing the same problem over and over, please ping Gary Hockin - we may be able to add bespoke issue for that problem, or fix in automated capacity

Check For Blockquotes In Docs

Check the document for bad blockquoutes

TLDR; Check blockquotes are formatted correctly using > and check headings in blockquotes are using ###

Blockquotes are donated by a single greater than character and then a space. Make sure all the blockquotes in every doc file are correctly formatted. Headings in blockquotes should use ### and not bold.

Any paragraph spacing in blockquotes should be marked using a single greater than, then a space.

Error with Zend\ServiceManager from ZF3

Try to use Barcode separate from ZF.
I use composer for install
"zendframework/zend-barcode": "2.7.0",
"zendframework/zend-config": "^2.6.0"

By default composer install requirement zend service manger from ZF3 which is not BC with ZF2
After switch to "zendframework/zend-servicemanager": "^2.7.8" error has gone away

Code to reproduce the issue

<?php
namespace Project;

use \Zend\Barcode\Barcode;
use \Zend\Barcode\Object\Code25interleaved;

class BarcodeGenerator {
    protected $config = [];

    function __construct($config = null)
    {
        $arConf = array(
            'barcode'        => Code25interleaved::class,
            'barcodeParams'  => [
                'text' => $config['text'],
                'withBorder' => true,
                'barHeight' => 38,
                'factor' => 2,
                'font' => 5
            ],
            'renderer'       => 'image',
            'rendererParams' => [
                'imageType' => 'png'
            ],
        );

        $this->config = new \Zend\Config\Config($arConf);
    }

    public function draw(){
        $barcode = Barcode::factory($this->config);
        return $barcode->draw();
    }
    public function render(){
        $barcode = Barcode::factory($this->config);
        $barcode->render();
    }
}

Expected results

Rendered barcode

Actual results

Deprecated: Zend\ServiceManager\AbstractPluginManager::__construct now expects a Interop\Container\ContainerInterface instance representing the parent container; please update your code in ./vendor/zendframework/zend-servicemanager/src/AbstractPluginManager.php on line 85

Check Documentation Code Blocks

Check code blocks are correct

TLDR; Check in all files that codeblocks are correct, in PSR-2 format and have PHP syntax highlighting applied.

Code blocks should be in the following format...

```php
 'ZEND-FRAMEWORK');

// No required options
$rendererOptions = array();
$renderer = Barcode::factory(
    'code39', 'image', $barcodeOptions, $rendererOptions
);

```

Note the three backticks then php in the opening fence, and the closing fence is just three backticks. It's common for the opening backticks to have no code type, or something like source.

Code should also have been automatically formatted into PSR-2 format, but sometimes these slip through the net.

Appears to be tightly coupled to Zend Validate?

I'm trying to create my own Barcode class for generating GS1-128 barcodes. But there doesn't appear to be a way to set the validator. Or is there?

Fatal error: Uncaught exception 'Zend\Validator\Exception\InvalidArgumentException' with message 'Barcode adapter matching "Zend\Validator\Barcode\Gs1" not found"

<?php

require_once 'vendor/autoload.php';

use Zend\Barcode\Barcode;

// Only the text to draw is required.
$barcodeOptions = array(
    'text' => '1234567890etc',
    'barcodeNamespace' => 'My\Package\Barcode',
);

// No required options.
$rendererOptions = array();

$traversable = new ArrayObject();
$traversable['barcode'] = 'My\Package\Barcode\Gs1';
$traversable['params'] = $barcodeOptions;

$renderer = Barcode::factory(
    $traversable,
    'image',
    $barcodeOptions,
    $rendererOptions
)->render();

Class 'Zend\ServiceManager\AbstractPluginManager' not found in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php

Hello :-)

I was testing the examples shown on http://framework.zend.com/manual/current/en/modules/zend.barcode.creation.html but I was getting:

Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found
    in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php on line 22

I've checked https://github.com/zendframework/zend-barcode/blob/master/composer.json and found:

    "suggest": {
        "zendframework/zend-servicemanager": "Zend\\ServiceManager component, required when using the factory methods of Zend\\Barcode.",
        "zendframework/zendpdf": "ZendPdf component"
    },

so I used another example, without ::factory, but there was still the same error:

Fatal error: Class 'Zend\ServiceManager\AbstractPluginManager' not found
    in .../vendor/zendframework/zend-barcode/src/ObjectPluginManager.php on line 22

This issue was fixed by modifying my composer.json by adding "zendframework/zend-servicemanager": "^2.5" in the require section.

My example code:

<?php
error_reporting(E_ALL);
ini_set('display_errors', 'On');

require 'vendor/autoload.php';

// Only the text to draw is required
$barcodeOptions = array('text' => 'ZEND-FRAMEWORK');

// No required options
$rendererOptions = array();

// Draw the barcode in a new image,
// send the headers and the image
Zend\Barcode\Barcode::render(
    'code39', 'image', $barcodeOptions, $rendererOptions
);

and the fixed composer.json:

{
    "name": "websafe/zendframework-zend-barcode-example",
    "description": "Just testing",
    "license": "BSD-3-Clause",
    "require": {
        "zendframework/zend-servicemanager": "^2.5",
        "zendframework/zend-barcode": "^2.5"
    }
}

Check Documentation Tables

Check the tables in a document

TLDR; All tables should be in the format of GHFM using | and - as horizontal and vertical separators respectively

Check all tables are in the correct format. Please don't use leading and trailing | - more information on github flavoured markdown tables can be found here.

Grapheme_substr Warning

I get the same error when I use barcode:

$barcodeOptions = array('text' => 'TEST');

$rendererOptions = array(
   'imageType' => 'png'
);

$data128 = Barcode::factory('code128', 'image', $barcodeOptions, $rendererOptions)->draw();

Error Trace:

[18-Jul-2016 09:43:19 America/Lima] PHP Warning:  grapheme_substr(): grapheme_substr: start not contained in string in D:\proyectos\vendor\zendframework\zendframework\library\Zend\Stdlib\StringWrapper\Intl.php on line 73
[18-Jul-2016 09:43:19 America/Lima] PHP Stack trace:
[18-Jul-2016 09:43:19 America/Lima] PHP   1. {main}() D:\proyectos\public\index.php:0
[18-Jul-2016 09:43:19 America/Lima] PHP   2. Zend\Mvc\Application->run() D:\proyectos\public\index.php:17
[18-Jul-2016 09:43:19 America/Lima] PHP   3. Zend\EventManager\EventManager->trigger() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php:314
[18-Jul-2016 09:43:19 America/Lima] PHP   4. Zend\EventManager\EventManager->triggerListeners() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:205
[18-Jul-2016 09:43:19 America/Lima] PHP   5. call_user_func:{D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444}() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444
[18-Jul-2016 09:43:19 America/Lima] PHP   6. Zend\Mvc\DispatchListener->onDispatch() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444
[18-Jul-2016 09:43:19 America/Lima] PHP   7. Zend\Mvc\Controller\AbstractController->dispatch() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php:93
[18-Jul-2016 09:43:19 America/Lima] PHP   8. Zend\EventManager\EventManager->trigger() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php:118
[18-Jul-2016 09:43:19 America/Lima] PHP   9. Zend\EventManager\EventManager->triggerListeners() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:205
[18-Jul-2016 09:43:19 America/Lima] PHP  10. call_user_func:{D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444}() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444
[18-Jul-2016 09:43:19 America/Lima] PHP  11. Zend\Mvc\Controller\AbstractActionController->onDispatch() D:\proyectos\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php:444
[18-Jul-2016 09:43:19 America/Lima] PHP  12. Application\Controller\DocumentoElectronicoController->documentoPdfAction() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php:82
[18-Jul-2016 09:43:19 America/Lima] PHP  13. Application\Model\DocelectronicocabTable->obtenerDocumentoElectronicoPDF() D:\proyectos\module\Application\src\Application\Controller\DocumentoElectronicoController.php:104
[18-Jul-2016 09:43:19 America/Lima] PHP  14. Zend\Barcode\Renderer\AbstractRenderer->draw() D:\proyectos\module\Application\src\Application\Model\DocelectronicocabTable.php:447
[18-Jul-2016 09:43:19 America/Lima] PHP  15. Zend\Barcode\Renderer\AbstractRenderer->drawInstructionList() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Renderer\AbstractRenderer.php:423
[18-Jul-2016 09:43:19 America/Lima] PHP  16. Zend\Barcode\Object\AbstractObject->draw() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Renderer\AbstractRenderer.php:447
[18-Jul-2016 09:43:19 America/Lima] PHP  17. Zend\Barcode\Object\AbstractObject->checkParams() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Object\AbstractObject.php:1118
[18-Jul-2016 09:43:19 America/Lima] PHP  18. Zend\Barcode\Object\AbstractObject->checkText() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Object\AbstractObject.php:910
[18-Jul-2016 09:43:19 America/Lima] PHP  19. Zend\Barcode\Object\AbstractObject->validateText() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Object\AbstractObject.php:932
[18-Jul-2016 09:43:19 America/Lima] PHP  20. Zend\Barcode\Object\AbstractObject->validateSpecificText() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Object\AbstractObject.php:1253
[18-Jul-2016 09:43:19 America/Lima] PHP  21. Zend\Validator\Barcode->isValid() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Barcode\Object\AbstractObject.php:1280
[18-Jul-2016 09:43:19 America/Lima] PHP  22. Zend\Validator\Barcode\Code128->hasValidCharacters() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Validator\Barcode.php:167
[18-Jul-2016 09:43:19 America/Lima] PHP  23. Zend\Stdlib\StringWrapper\Intl->substr() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Validator\Barcode\Code128.php:183
[18-Jul-2016 09:43:19 America/Lima] PHP  24. grapheme_substr() D:\proyectos\vendor\zendframework\zendframework\library\Zend\Stdlib\StringWrapper\Intl.php:73

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.