Closed unitedsoftwork closed 5 years ago
Of course ... Create a PR and I'll review it for sure!!
I submitted the request.
I wasn't quite sure what to name the method so I simply did GenerateBarcode.
Naming the new method Encode seems more descriptive, and passing the image generation to a different function named "GenerateImage" or something seems to be more ideal, but something like that would no doubt break the API since the "Encode" method is currently so heavily used.
If you think of a more descriptive name of what is happening, please feel free to change it.
I gotta find time to review this
Merged
I think it would be very beneficial to move the encoding of the barcode to its own public function so that you can get the actual binary value of the barcode without actually having to go through the whole generation process.
I am writing a library that interfaces with yours in order to render barcodes as dxf files(for AutoCad drawings). Returning the binary EncodedValue of the Barcode object is fine, but the Encode method runs through the whole image rendering process before setting the EncodedValue. (Line 481 of BarcodeLib.cs)
Moving the actual encoding of the barcode away from the image generation (which is on line 484) into its own public function (maybe called from the constructor) would allow this to happen without generating the image.
Here is a (working) example of the code.