Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Monday, April 17, 2017 8:30:27 AM(UTC)

Hadi  
Hadi

Groups: Manager, Tech Support, Administrators
Posts: 218

Was thanked: 12 time(s) in 12 post(s)

I have written a small sample demo that shows how to use our Automated annotations along with our BarcodeEngine and BarcodeWriter classes to write barcodes to a AnnStampObject.

Here is a screenshot of what the demo looks like:

demo screenshot

Here is the relevant code from the sample:

Code to write the barcode to an image:

Code:
RasterImage barcodeImage = RasterImage.Create(300, 300, 24, 150, RasterColor.White);

LogicalRectangle writebounds = LogicalRectangle.FromLTRB(0, 0, barcodeImage.ImageSize.Width, barcodeImage.ImageSize.Height, LogicalUnit.Pixel);
BarcodeEngine barcodeEngine = new BarcodeEngine();
QRBarcodeData qrData = BarcodeData.CreateDefaultBarcodeData(BarcodeSymbology.QR) as QRBarcodeData;
qrData.Value = barcodestring;

QRBarcodeWriteOptions options = new QRBarcodeWriteOptions();
options.HorizontalAlignment = BarcodeAlignment.Center;
options.VerticalAlignment = BarcodeAlignment.Center;

barcodeEngine.Writer.CalculateBarcodeDataBounds(writebounds, barcodeImage.XResolution, barcodeImage.YResolution, qrData, options);
barcodeEngine.Writer.WriteBarcode(barcodeImage, qrData, options);


Code to add the Barcode Image to the stamp and the stamp to the Automation programmatically:

Code:
AnnStampObject stamp = new AnnStampObject();
stamp.Rect = LeadRectD.Create(200, 200, 600, 600);
stamp.Text = "";
stamp.Stroke.Stroke = AnnSolidColorBrush.Create("");

using (MemoryStream ms = new MemoryStream())
using (RasterCodecs codecs = new RasterCodecs())
{
     codecs.Save(barcodeImage, ms, RasterImageFormat.Png, 32);
     stamp.Picture = new AnnPicture(ms.ToArray());
}

annAutomation.Container.Children.Add(stamp);
annAutomation.InvalidateObject(stamp);


You can download the project here:
File Attachment(s):
LEADTOOLS Barcode Annotation Demo.zip (12kb) downloaded 298 time(s).
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.042 seconds.