-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Barcodelib 2.4.0 compatibility with 3.0.0 #156
Comments
I found this example. If you are working on windows you can export the barcode as System.Drawing.Image. On other platforms use SKImage.
|
This was done to support more platforms besides windows. SkiaSharp is the path to multi-platform support. :) |
You did point out that the symbology namespace was never converted to BarcodeStandard but still resides in BarcodeLib. I will fix that. |
Yeah I have the same issue after upgrading from 2.4.0 to 3.0.0. I have reverted back to 2.4.0. I'll wait for your next release after you fix it. Thanks. |
It follows that the examples at https://github.com/barnhill/barcodelib/blob/master/README.md should be updated. |
I upgraded to 3.0 and it busted my app but I have it working now. Here is another example. I hope it helps someone out. Even though this is for a WPF app and it returns a BitmapFrame, it is well commented, and you can see it's easy to do what you want with the barcode image. First add your usings: Then your method: `public static BitmapFrame Create(int barcodeNum)
}` |
Yes I had to get away from using |
@barnhill have you got an example of how to output this to a FileContentResult without the reliance on System.Drawing? |
@nfplee : look at this example and linkt to documentation #156 (comment).
|
@kzimny thanks. I ended up with: public IActionResult Barcode(string text)
{
using var ms = new MemoryStream();
using var barcode = new Barcode()
{
Alignment = AlignmentPositions.Left,
IncludeLabel = false
};
barcode.Encode(Type.Code39, text, 300, 80);
barcode.SaveImage(ms, SaveTypes.Png);
return File(ms.ToArray(), "image/png");
} Having looked at the source code, it looks like adding a using statement when initiating the barcode should dispose of the |
This was done to preserve memory space when done with the barcode object. I think this would be expected behavior? |
It seems the new version is not compatible with the previous one 2.4.0.
E.g. the code
var barcode = new BarcodeLib.Barcode()
causes compilation errors.When I tried to change the namespace from
BarcodeLib
toBarcodeStandard
then parameters likeHoritontalResolution
were not supported.Please, could you provide updated examples to understand how to use the new version of the library?
The text was updated successfully, but these errors were encountered: