Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Resolves #4708 - adding transparent background support to barcode #5385

Merged
merged 11 commits into from
Feb 23, 2014

Conversation

steverhoades
Copy link
Contributor

There are currently no tests for this, the code in general here could probably be cleaned up a bit. Also, I have noticed that there is currently no 2.0 documentation on Barcode and ZendPdf doesn't exist.

Example Usage for Image:

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

        // No required options
        $rendererOptions = array('imageType'=> 'png', 'transparentBackground' => true);

        \Zend\Barcode\Barcode::factory(
            'code39', 'image', $barcodeOptions, $rendererOptions
        )->render();

Example Usage for SVG:

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

        // No required options
        $rendererOptions = array('transparentBackground' => true);

        \Zend\Barcode\Barcode::factory(
            'code39', 'svg', $barcodeOptions, $rendererOptions
        )->render();

@steverhoades
Copy link
Contributor Author

Want to follow this up with a quick note, that it is discouraged to output barcodes that are NOT black on white. They may still work with your scanner though.

Source

@weierophinney
Copy link
Member

@steverhoades We deprecated ZendPdf with ZF2; too difficult to maintain, as the spec is constantly evolving, and it's a very difficult thing to get the various features right.

We do have the old Barcode documentation -- I suspect it's simply not linked in the TOC and/or index, which is why you cannot see it in the rendered manual.

@weierophinney
Copy link
Member

@steverhoades Any chance I can get some unit tests?

@steverhoades
Copy link
Contributor Author

@weierophinney Actually, I think I may have been wrong with with the documentation, it may be in 2.

Should we remove the PDF Renderer for barcode?

I'll work on getting some unit tests in to support this.

@weierophinney
Copy link
Member

@steverhoades Let's deprecate the PDF renderer for the next minor revision (2.3.0), and then we can remove in 3.

* Will work for SVG and Image (png and gif only)
*
* @param $bool
* @return $this
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return self

@weierophinney
Copy link
Member

@steverhoades Any chance of getting this completed soon?

@steverhoades
Copy link
Contributor Author

Matthew,

So sorry! Been on vacation with the Family for the Holidays. I'll look at
this as soon as I get settled in to see what is left.

Happy New Year!

Steve

On Fri, Jan 3, 2014 at 1:55 PM, weierophinney notifications@github.51.alwrote:

@steverhoades https://github.com/steverhoades Any chance of getting
this completed soon?


Reply to this email directly or view it on GitHubhttps://github.com//pull/5385#issuecomment-31556929
.

@steverhoades
Copy link
Contributor Author

Matthew,

Better late than never, just added the unit tests for the new feature to
barcode. Sorry it took so long!

#5385

Steve

On Wed, Jan 8, 2014 at 8:41 AM, Steve Rhoades sedonami@gmail.com wrote:

Matthew,

So sorry! Been on vacation with the Family for the Holidays. I'll look
at this as soon as I get settled in to see what is left.

Happy New Year!

Steve

On Fri, Jan 3, 2014 at 1:55 PM, weierophinney notifications@github.51.alwrote:

@steverhoades https://github.com/steverhoades Any chance of getting
this completed soon?

Reply to this email directly or view it on GitHubhttps://github.com//pull/5385#issuecomment-31556929
.

$backgroundColor & 0x0000FF
);

if($this->getImageType() != "jpeg" && $this->transparentBackground) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a comment explaining why jpeg is excluded here.

@Maks3w
Copy link
Member

Maks3w commented Feb 21, 2014

@steverhoades Fix the CS and ready to merge :)

Maks3w added a commit that referenced this pull request Feb 23, 2014
Maks3w added a commit that referenced this pull request Feb 23, 2014
Maks3w added a commit that referenced this pull request Feb 23, 2014
@Maks3w Maks3w merged commit ae011e6 into zendframework:master Feb 23, 2014
@Maks3w Maks3w added the Barcode label Feb 23, 2014
weierophinney pushed a commit to zendframework/zend-barcode that referenced this pull request May 14, 2015
weierophinney pushed a commit to zendframework/zend-barcode that referenced this pull request May 14, 2015
weierophinney pushed a commit to zendframework/zend-barcode that referenced this pull request May 14, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants