Giter Club home page Giter Club logo

barcode's Introduction

Packagist Downloads Stable version License

This is a barcode generation package inspired by https://github.com/tecnickcom/TCPDF. Actually, I use that package's underline classes for generating barcodes. This package is just a wrapper of that package and adds compatibility with Laravel 5.

I used the following classes of that package.

  • src/Milon/Barcode/Datamatrix.php (include/barcodes/datamatrix.php)
  • src/Milon/Barcode/DNS1D.php (tcpdf_barcodes_1d.php)
  • src/Milon/Barcode/DNS2D.php (tcpdf_barcodes_2d.php)
  • src/Milon/Barcode/PDF417.php (include/barcodes/pdf417.php)
  • src/Milon/Barcode/QRcode.php (include/barcodes/qrcode.php)

Read More on TCPDF website

This package is compatible with Laravel 4.* , 5.*, 6.*, 7.*, 8.*, 9.* and 10.*

This package relies on php-gd extension. So, make sure it is installed on your machine.

Installation

Begin by installing this package through Composer. Just run following command to terminal-

composer require milon/barcode

You can also edit your project's composer.json file to require milon/barcode.

"require": {
    "milon/barcode": "^9.0"
}

For Laravel 8.* use this-

"require": {
    "milon/barcode": "^8.0"
}

For Laravel 7.* use this-

"require": {
    "milon/barcode": "^7.0"
}

For Laravel 6.* use this-

"require": {
    "milon/barcode": "^6.0"
}

For Laravel 5.0 and 5.1 use this-

"require": {
    "milon/barcode": "^5.1"
}

For Laravel 4.0, 4.1 and 4.2 use this-

"require": {
    "milon/barcode": "^4.2"
}

Next, update Composer from the Terminal:

composer update

Once this operation completes, the final step is to add the service provider. Open config/app.php, and add a new item to the providers array.

'providers' => [
    // ...
    Milon\Barcode\BarcodeServiceProvider::class,
]

For version 4.* add these lines on app/config/app.php file-

'providers' => array(
    // ...
    'Milon\Barcode\BarcodeServiceProvider',
)

If you want to change Bar-code's settings (Store Path etc.), you need to publish its config file(s). For that you need to run in the terminal-

# Laravel 5.x
php artisan vendor:publish

# Laravel 4.x
php artisan config:publish milon/barcode

Make sure you have write permission to the storage path. By default it sets to /storage folder.

Now add the alias.

'aliases' => [
    // ...
    'DNS1D' => Milon\Barcode\Facades\DNS1DFacade::class,
    'DNS2D' => Milon\Barcode\Facades\DNS2DFacade::class,
]

For version 4.2 alias will be like this-

'aliases' => array(
    // ...
    'DNS1D' => 'Milon\Barcode\Facades\DNS1DFacade',
    'DNS2D' => 'Milon\Barcode\Facades\DNS2DFacade',
)

Bar-code generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

generator in html, png , jpeg embedded base64 code and SVG canvas

echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');
echo '<img src="data:image/png,' . DNS1D::getBarcodePNG('4', 'C39+') . '" alt="barcode"   />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T');
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+') . '" alt="barcode"   />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T');
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+') . '" alt="barcode"   />';
echo DNS1D::getBarcodeSVG('4445645656', 'C39');
echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');
echo '<img src="data:image/png;base64,' . DNS2D::getBarcodePNG('4', 'PDF417') . '" alt="barcode"   />';

Width and Height example

echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33);
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33) . '" alt="barcode"   />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33);
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33) . '" alt="barcode"   />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33);
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33) . '" alt="barcode"   />';

Color

echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green');
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode"   />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode"   />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0));
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33,array(1,1,1)) . '" alt="barcode"   />';

Show Text

echo DNS1D::getBarcodeSVG('4445645656', 'PHARMA2T',3,33,'green', true);
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T',3,33,'green', true);
echo '<img src="' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode"   />';
echo DNS1D::getBarcodePNGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '<img src="data:image/png;base64,' . DNS1D::getBarcodePNG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode"   />';
echo DNS1D::getBarcodeJPGPath('4445645656', 'PHARMA2T',3,33,array(255,255,0), true);
echo '<img src="data:image/jpeg;base64,' . DNS1D::getBarcodeJPG('4', 'C39+',3,33,array(1,1,1), true) . '" alt="barcode"   />';

2D Barcodes

echo DNS2D::getBarcodeHTML('4445645656', 'QRCODE');
echo DNS2D::getBarcodePNGPath('4445645656', 'PDF417');
echo DNS2D::getBarcodeSVG('4445645656', 'DATAMATRIX');

1D Barcodes

echo DNS1D::getBarcodeHTML('4445645656', 'C39');
echo DNS1D::getBarcodeHTML('4445645656', 'C39+');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E');
echo DNS1D::getBarcodeHTML('4445645656', 'C39E+');
echo DNS1D::getBarcodeHTML('4445645656', 'C93');
echo DNS1D::getBarcodeHTML('4445645656', 'S25');
echo DNS1D::getBarcodeHTML('4445645656', 'S25+');
echo DNS1D::getBarcodeHTML('4445645656', 'I25');
echo DNS1D::getBarcodeHTML('4445645656', 'I25+');
echo DNS1D::getBarcodeHTML('4445645656', 'C128');
echo DNS1D::getBarcodeHTML('4445645656', 'C128A');
echo DNS1D::getBarcodeHTML('4445645656', 'C128B');
echo DNS1D::getBarcodeHTML('4445645656', 'C128C');
echo DNS1D::getBarcodeHTML('4445645656', 'GS1-128');
echo DNS1D::getBarcodeHTML('44455656', 'EAN2');
echo DNS1D::getBarcodeHTML('4445656', 'EAN5');
echo DNS1D::getBarcodeHTML('4445', 'EAN8');
echo DNS1D::getBarcodeHTML('4445', 'EAN13');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCA');
echo DNS1D::getBarcodeHTML('4445645656', 'UPCE');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI');
echo DNS1D::getBarcodeHTML('4445645656', 'MSI+');
echo DNS1D::getBarcodeHTML('4445645656', 'POSTNET');
echo DNS1D::getBarcodeHTML('4445645656', 'PLANET');
echo DNS1D::getBarcodeHTML('4445645656', 'RMS4CC');
echo DNS1D::getBarcodeHTML('4445645656', 'KIX');
echo DNS1D::getBarcodeHTML('4445645656', 'IMB');
echo DNS1D::getBarcodeHTML('4445645656', 'CODABAR');
echo DNS1D::getBarcodeHTML('4445645656', 'CODE11');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA');
echo DNS1D::getBarcodeHTML('4445645656', 'PHARMA2T');

Running without Laravel

You can use this library without using Laravel.

Example:

use \Milon\Barcode\DNS1D;

$d = new DNS1D();
$d->setStorPath(__DIR__.'/cache/');
echo $d->getBarcodeHTML('9780691147727', 'EAN13');

License

This package is published under GNU LGPLv3 license and copyright to Nuruzzaman Milon. Original Barcode generation classes were written by Nicola Asuni. The license agreement is on project's root.

License: GNU LGPLv3
Package Author: Nuruzzaman Milon
Original Barcode Class Author: Nicola Asuni
Package Copyright: Nuruzzaman Milon
Barcode Generation Class Copyright:
Nicola Asuni
Tecnick.com LTD
www.tecnick.com

barcode's People

Contributors

alex-alvarado avatar ank91 avatar crishoj avatar cyberhicham avatar dhanar98 avatar durbintl avatar eduavila avatar f7urry avatar gduymaz avatar jasonmccreary avatar jerodev avatar jerome2710 avatar junereycasuga avatar kisglaci avatar laravel-shift avatar manticorp avatar maosalah avatar milon avatar mix5003 avatar omarxtream avatar paolaruby avatar roblui avatar rudashi avatar sorelio avatar spidfire avatar squatto avatar tannguyenit avatar tcardwell-ck avatar wlsupport avatar yoshkin 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  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

barcode's Issues

When will be created the 4.2.3 tag?

I made a pull request, where was fixed the path configuration problem for version 4.2, and you accepted it.

And Now, when will be created the 4.2.3 tag for this branch? because I do not think pretty cool install the package with the new update, using the dev-version-4.2 directly.

Permission Denied to unlink png file

Hi

thanks for this library, but I am a little lost on an error I get.
I got it all working on my local environment, but when I push it to prod (on Ubuntu 16.04.3 hosted by DigitalOcean), I get an error during creation of the Barcode.

The error I get is :
ErrorException in DNS1D.php line 2371:
unlink(4445645656.png): Permission denied

I guess this has to do with folder permissions, but I don't see where the library is trying to save the file and why it is not allowed to delete it.

Do you have any advice?

Thanks!

Andries

Export as png

Hello,

is it possible to Export the Barcode as png?

Best regards
Patrick

URGENT strange characters while reading DATAMATRIX barcode

if I need to generate a barcode for the following code:
M-CNS301-1-4-86104-851-2018-01-15-2018-01-15-000001-0000000000

It's generated. but once you scan it you got this:
M-CNS301-1-4k-"LL2;IM":V$2:NK)D.%)L.#": K(JB!B:B (JB (D>82

Im using it like this in my view
{!! \DNS2D::getBarcodeSVG($barcode->barcode, "DATAMATRIX") !!}

I have over 100 barcodes and all of them once scanned they produce the same code except these that starts with "M-CNS301" Why??

[HELP] Print data under Barcode PNG

Hi, thank you for this awesome package.
Is there a way to print the barcode data-string under the barcode in the PNG?

E.g. if i create "933-2-6x10" print this name under the barcode.

Thank you for Help!

Text under barcode

I would like to know if they have any way to get barcode content text under barcode image.

Checksum Error

Hello, if I follow the instructions from https://tcpdf.org/ how to generate barcode with checksum the code returns this error

ErrorException in DNS1D.php line 171:
imagecreate(): Invalid image dimensions 

DNS1D::getBarcodePNG($order->id, "CODABAR+") !!}

The plus sign is to issue checksum bellow the barcode but it's not working. Without the plus sign everything is fine but I need the checksum. Thanks in advance

DNS1D::getBarcodeHTML() error

I have been fighting with this package for a couple hours now trying to find a way to get it to function properly. I have used the way defined in the documentation as well as using call_user_func function. The closest I have to it working is using call_user_func, which puts out a white blank screen no barcode. Any help on this issue would be great.

Controller Code:

return view('modules.toolshop.sheet')->with([
            'log' => $transfer,
            'barcode' => '<img src="data:image/png;base64,' . call_user_func_array([new DNS1D(), 'getBarcodePNG'], ["10-057-00-000", "C39"])
        ]);

View Code:

<?php echo $barcode;?>
{!! dd($barcode) !!}

PHP Fatal error: Class 'Config' not found

Using Lumen Framework 5.3, I get the following error:
PHP Fatal error: Class 'Config' not found in DNS2D.php
when creating a qr code image by using:

$qr = new DNS2D();
$qr->getBarcodePngPath('abc123', 'QRCODE');

This can be fixed by using app('config')->get() instead of \Config::get()

Barcode not displayed in Ubuntu

Hi, i cannot resolve this problem in my ubuntu server. The barcode works perfectly fine in my localhost but it turns out blank when i try to generate in my server.

<img style="height: 40px;" src="data:image/png;base64,{!! \Milon\Barcode\DNS1D::getBarcodePNG(342434244, "C39") !!}" alt="barcode" />

this is the code i use in both localhost and server.

Copyright and License infringement

I have noticed that this project is using source code copied from the project https://github.com/tecnickcom/TCPDF originally hosted at http://sourceforge.net/projects/tcpdf/ but all original notices about author, copyright and license were removed or replaced.

Apparently you forked or copied the code from another project that has been already shut down with a DMCA takedown notice.

You can compare the files yourself against TCPDF version 6.0.025 released 4 September 2013 (https://github.com/tecnickcom/TCPDF/tree/6.0.025):

In this project the following files appears to be almost verbatim copies of the original ones, with the exception of the legal notices removed (author, copyright and license):

  • src/Milon/Barcode/Datamatrix.php (include/barcodes/datamatrix.php)
  • src/Milon/Barcode/DNS1D.php (tcpdf_barcodes_1d.php)
  • src/Milon/Barcode/DNS2D.php (tcpdf_barcodes_2d.php)
  • src/Milon/Barcode/PDF417.php (include/barcodes/pdf417.php)
  • src/Milon/Barcode/QRcode.php (include/barcodes/qrcode.php)

The original code is released under the GNU LGPLv3 license and copyrighted by Nicola Asuni - Tecnick.com LTD, but none of this information is present in the copied files.
https://github.com/tecnickcom/TCPDF/blob/6.0.025/LICENSE.TXT

The options to remedy the infringement are:

  1. delete the project - this seems the best option as this project seems not adding any new functionality;
  2. if the license is compatible with GNU-LGPLv3, replace the infringing files with the original ones, or reinstate all the original notices (author, copyright, license);
  3. delete the infringing files and use the new external library https://github.com/tecnickcom/tc-lib-barcode (originally based on the same code).

An immediate action is required as this infringement is serious.

EAN Barcode numbers at the bottom

Thanks for your great library.

How do we display the numbers below the barcode?

Which configuration do we set?
barcode

Thanks in advance,
Edwin

No barcode in Laravel 5*

No barcode in Laravel 5*
Only HTML Version Works
PNG :

data:image/png,iVBORw0KGgoAAAANSUhEUgAAAQAAAAAeAQMAAAD5F1J6AAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAACJJREFUKJFjOHD+/Jkz/GiY588fEAbJMYwqGFUwqmBoKgAAqn+OB+RXYEAAAAAASUVORK5CYII=

It's invalid

SVG Works

syntax error, unexpected '.'

FatalErrorException in DNS1D.php line 2444:
syntax error, unexpected '.'

Laravel 5.2
Ubuntu 14
PHP 5.5.9
Apache2

Class 'Milon\Barcode\imagickpixel' not found

I am getting an error "Class 'Milon\Barcode\imagickpixel' not found" on line 290 in DNS2D.php, though Imagick and ImagicPixel are enabled . I am using php 7.0 and Laravel version 5.4.

kindly help.

Getting "invalid image dimensions" error

Hi, I'm getting this error:

ErrorException in DNS2D.php line 195:
imagecreate(): Invalid image dimensions
in DNS2D.php line 195
at HandleExceptions->handleError(2, 'imagecreate(): Invalid image dimensions', '/home/www/api/vendor/milon/barcode/src/Milon/Barcode/DNS2D.php', 195, array('code' => '855544872321115624231', 'type' => 'EAN13', 'w' => 3, 'h' => 3, 'color' => array(0, 0, 0), 'width' => 0, 'height' => 0, 'imagick' => false))

when running this code:

DNS2D::getBarcodePNG('855544872321115624231', 'EAN13');

Am I missing something? do I have to specify image dimensions somewhere?

Thank you for your help!

Class 'Milon\Barcode\BarcodeServiceProvider::class' not found - Laravel 4

Hi everyone,
we have installed milon barcode on local server successfully. but when we go on live server we got "Class 'Milon\Barcode\BarcodeServiceProvider::class' not found" Error

i have checked vendor directory also everything is fine there all files are placed properly

please refer to below link for screen shot
Thanks in Advance
image

production problems

Hi,

I'm using Laravel 5.2 and I've the follow html:

<img class="barcode" src="data:image/png;base64, {{ DNS1D::getBarcodePNG($id, 'C39') }}"/>

In my development environment works like a charm! But in production environment I having a problem. The base64 isn't generated, for example:

DEV:

<img class="barcode" src="data:image/png;base64, iVBORw0KGgoAAAANSUhEUgAAAGAAAAAeAQMAAADpfonKAAAABlBMVEX///8AAABVwtN+AAAAAXRSTlMAQObYZgAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABhJREFUGJVjOHD+/JkzPH/+gGiGUc7AcADTphJI4YlzuAAAAABJRU5ErkJggg==">

screen shot 2016-10-26 at 23 39 41

## PROD:

<img class="barcode" src="data:image/png;base64, ">

screen shot 2016-10-26 at 23 40 26

Anybody help me?
Thanks.

Barcode displaying as blocks instead of barcode

I have been using this package to generate barcodes for various pieces in my application. Yesterday I had to make updates to the linux server that the application is running on now the barcodes come out as blocks instead of like a barcode. I have added photograph to show what I mean. I have not been able to reproduce this issue in my local development.

What it looks like now:
barcode_as_blocks

What it used to look like:
barcode

Class 'DNS1D' not found

Segui os passos recomendados porém esta com esse erro, Class 'DNS1D' not found.

Versão Laravel 5.1.40
composer.json
"laravel/framework": "5.1.*",
"milon/barcode": "^5.1"

Add Parameter the description barcode

Is there a parameter to add the description of the barcode?
Ex,
Echo DNS1D :: getBarcodeHTML ($barcodeLargo, "C128B", 1,53,COLOUR,PARAMETER???)

Tks.

Make default storage path to storage_path('cache')

Hi,
First; thanks for restoring dinesh/barcode repo.
Hope DMCA wont delete this one.

Here is the actual issue :
Your readme.md file says that -

Make sure you have write permission to the storage path. By default it sets to /storage folder.

while config.php file says it is public folder.

return [
    'store_path' => public_path("/"),
];

It should be like this -

return [
    'store_path' => storage_path("cache"),
];

I believe this the folder where barcodes will be stored temporary.
FYI: I am using this one on Laravel 4.2.

What your thoughts on this .

Config syntax on 1.0.1

There's still pending to change config syntax from "barcode::store_path" to "barcode.store_path" on getBarcodeHTML, getBarcodePNG, getBarcodePNGPath on DNS1D.php, on tag 1.0.1

I have a error. Please can you help me? pls pls.

Non-static method Milon\Barcode\DNS1D::getBarcodeHTML() should not be called statically, assuming $this from incompatible context

My code is this
echo DNS1D::getBarcodeHTML("4445645656", "C128");

If I change with this

echo DNS1D->getBarcodeHTML("4445645656", "C128");

gives another error
syntax error, unexpected '->' (T_OBJECT_OPERATOR), expecting ',' or ';'

What can I do? Please somebody help me

I am using laravel version 5.1

UPCE barcode gives different value

I'm trying to create a UPCE barcode using echo DNS1D::getBarcodeHTML('123456', 'UPCE'); but when I scan the barcode, it gives me a different value

adding option to print labels under the barcode

Hi,

First I want to thank you for your code. It is really well developed and simple to understand.
As many people ask for labels under the 1D barcode, I just added a parameter for the function "getBarcodeHTML" to choose or not to display labels :

public function getBarcodeHTML($code, $type, $w = 2, $h = 30, $color = 'black', $labels = false) { // .......... // }

Am only using EAN-13 barcodes, so I modified the function code to display labels in the right position.
I dont have time to make all the changes with the other encoding protocols and functions (PNG, SVG..), so I decided to share my code with you !

You can find the modified file in attachements

Thank you a lot again for your code !

Wassim
DNS1D_modified.txt

How to create an EAN without control digit?

I need to transform to EAN ( yes, UNVALID codes...) some arbitrary number sequences.

In short, I need to create, for example, the ean-8 of 5551147 WITHOUT adding the checkdigit at the end, or, seen from another perspective, generate the ean-8 '0551147' even if ean check digit is NOT valid

Is there any way to realize this?

Memory size exhaushted error

  • Allowed memory size of 134217728 bytes exhausted (tried to allocate 64 bytes) in C:\wamp64\w
    ww\GA-Food\trunk\vendor\dompdf\dompdf\src\Frame.php

i have more than 500 barcodes please give me solution to overcome this error..

If i increase the memory_limit in php.in file the max_execution_time error shows..

save barcode in storage folder in the app

Hello,

is it possible to save the barcode image in the storage folder (it would be best if i could save the image as bloob ) in my laravel app,and how ca i do that ??

Missing argument 3 for Milon\Barcode\WrongCheckDigitException::__construct()

Missing argument 3 for Milon\Barcode\WrongCheckDigitException::__construct(), called in /vendor/milon/barcode/src/Milon/Barcode/DNS1D.php on line 1427 and defined

Code DNS1D.php line 1427
throw new \Milon\Barcode\WrongCheckDigitException($r, intval($code{$data_len}));
which has 2 arguments

But your class WrongCheckDigitException
public function __construct($actual = NULL, $expected = NULL, $code, \Exception $previous = NULL)
require argument 3

Too few arguments to function Milon\Barcode\WrongCheckDigitException::__construct(),

vendor/milon/barcode/src/Milon/Barcode/DNS1D.php1427

throw new \Milon\Barcode\WrongCheckDigitException($r, intval($code{$data_len}));

vendor/milon/barcode/src/Milon/Barcode/WrongCheckDigitException.php:16

public function __construct($actual = NULL, $expected = NULL, $code, \Exception $previous = NULL) {

Error text:

Too few arguments to function Milon\Barcode\WrongCheckDigitException::__construct(), 2
passed in <project_folder>/vendor/milon/barcode/src/Milon/Barcode/DNS1D.php on line 1427 and at least 3 expected

In my case this happens doing what follows in a blade.php of laravel

DNS1D::getBarcodePNG("55591118", "EAN8",  2, 25);

Version:

milon/barcode (5.3.6)

How do I validate values before generating bar code image?

Is there any validation method present in package so I can check input values are valid or not(return true/false) for the specific bar code? I want to validate values before I generate PNG of bar codes. Currently it gives error when non supported values passed to generate bar code image.

Laravel: 5.2
PHP Version: 5.6
Library: php-gd

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.