Barcode Fonts, Components, ActiveX and .NET Windows Forms Controls, Java Servlets, 
DLLs and Barcode Scanners. IDAutomation.com, Inc., Computers Hardware, Software & Services, Tampa, FL   This site chose the Norton Secured Seal to promote trust online with consumers.    View your cart in the IDAutomation Store   


Home > Barcode Components > Xamarin Compatible .NET Standard PCL > User Manual:

.NET Standard PCL Manual | Tutorial

Order Pocket PC DLL Download Demo of Barcode .NET Standard PCL Release log for .NET Standard PCL Support for the .NET Standard PCL

Tutorial

This installation example is using the "WorkingWithFonts" Xamarin sample project that was created in Visual Studio 2017 Community Version with Xamarin and C#. Refer to the compatibility chart for use in other development environments.

  1. Download and extract the package into a directory on the development computer.
  2. Copy the DLL that is to be used to the project directory. Do not copy the components to the bin directory; upon compiling the project, the DLL in the project folder will be copied to the appropriate bin folder with the associated files automatically. The application must be able to access the control after it is installed from a local drive for security purposes.
  3. Select Project - Add Reference by opening Solution Explorer, right click on References and Add Reference. Using the open dialog, Browse for the specific DLL file and add it to the project.
    Add the reference to the QR Code .NET Standard PCL by opening the Solutions Explorer.
  4. Place the IDAutomation 2D font in the respective (Android, iOS, UWP, etc) Assets folder, within the project. A standard system font may also be used, however, the IDAutomation 2D font will usually produce cleaner images.
    Place the IDAutomation 2D font in the respective (Android, iOS, UWP, etc) Assets folder.
  5. Display the result of the EncodeQR method in a label on a form with the IDAutomation2D font. To understand more about how to display the barcode image, refer to the FontPageCs.cs file, located in the WorkingWithFonts example project.

If it is desired to use the .cs file instead of the DLL, the procedure below should be followed. The Unlimited Developer License is required to obtain the C# file.

  1. Within Solution Explorer, choose Add > Existing Item > navigate to the .cs file and choose Add.
  2. Clean and rebuild the project or solution.
  3. Add the following to the top of the FrontPage.cs file:
    using IDAutomation.NetStandard;
  4. Within the project, add the local instantiation, for example:
    QRCode qr = new QRCode(); //local instance
  5. The function will now be available, for example:
    Text = qr.EncodeQR(DataToEncode, true, EncodingModes.Byte, Versions.AUTO, ErrorCorrectionLevels.M, OutputTypes.IDA2DFont);

Implementation Code Examples

using IDAutomation.NetStandard;
 QRCode qr = new QRCode();

C# Example - IDAutomation2D Font in Xamarin.Forms Label:

var labelEncodedText = new Label
            {
                Text = qr.EncodeQR(DataToEncode, true, EncodingModes.Byte, Versions.AUTO, ErrorCorrectionLevels.M, OutputTypes.IDA2DFont),
               
                TextColor = Color.White,

                //Embedded IDAutomation2D Font 
                FontFamily = Device.OnPlatform(
                    "IDAutomation2D", // iOS
                    "IDAutomation2D.ttf#IDAutomation2D", // Android
                    "Assets/Fonts/IDAutomation2D.ttf#IDAutomation2D" //Windows
                ),

                VerticalOptions = LayoutOptions.Center,
                HorizontalOptions = LayoutOptions.Center,
            };

C# Example - System Font (Proportional) in Xamarin.Forms Label:
//Formatted Label to produce barcode characters with varying colors (makes spaces transparent)
            var labelFormatted = new Label();
            var fs = new FormattedString();

            //Barcode String
            var bc = qr.EncodeQR(DataToEncode, true, EncodingModes.Byte, Versions.AUTO, ErrorCorrectionLevels.M, OutputTypes.IDAProportionalFont);

            //Barcode Color
            var colorFront = Color.White;

            //Space Color (transparent is default)
            var colorBack = Color.Transparent;

            //Font Size for barcode
            var fntSize = 7;

            //Vertical proportionality (added to height)
            var fntExtra = .3;           

            //Loop through and color the barcode
            foreach (char c in bc)
            {
                if (c != (char)(9617))
                {
                    fs.Spans.Add(new Span { Text = c.ToString(), ForegroundColor = colorFront, FontSize = fntSize });
                }
                else
                {
                    fs.Spans.Add(new Span { Text = c.ToString(), ForegroundColor = colorBack, FontSize = (fntSize + fntExtra) });
                }

            }

            //Assigns formatted text to label
            labelFormatted.FormattedText = fs;

Functions and Parameters

Namespace:  IDAutomation.NetStandard
Assembly:  IDAutomation.NetStandard.QRCode (in IDAutomation.NetStandard.QRCode.dll)

public string EncodeQR(
string DataToEncode,
bool ApplyTilde = true,
EncodingModes EncodingMode = EncodingModes.Byte,
Versions Version = Versions.AUTO,
ErrorCorrectionLevels ErrorCorrectionLevel = ErrorCorrectionLevels.M,
OutputTypes OutputType = OutputTypes.IDA2DFont,
bool BestMask = true
)	
Parameter Optional Type Notes
Return Value No String 2D font text that creates an image when combined with the IDAutomation2D font (the default), native text image which uses a proportional system font, or a native text image which uses a mono-spaced font such as Courier New or Consolas.
DataToEncode No String The data that is encoded in the barcode.
ApplyTilde Yes Boolean Enables processing of tilde and parentheses characters for purposes of encoding ASCII functions and GS1 application identifiers.
EncodingMode Yes IDAutomation.NetStandard.EncodingModes The mode of compaction used to encode data in the symbol. Valid values are Byte, Alphanumeric, and Numeric mode.
Version Yes IDAutomation.NetStandard.Versions Sets the size of the symbol; valid values are from 01 (21X21) to 40 (177X177); the default value of "Auto" is used for automatic formatting.
ErrorCorrectionLevel Yes IDAutomation.NetStandard.ErrorCorrectionLevels Four levels of Reed-Solomon error correction, which allow verification of data and recovery in the event that part of the symbol is physically damaged.
OutputType Yes IDAutomation.NetStandard.OutputTypes Determines the Return Value. (Refer to the notes about Return Value)
BestMask Yes Boolean Use a best mask for pattern in the QRCode.

Support

Forum Support
Release log for Windows Mobile and/or PocketPC

Free product support may be obtained by reviewing the knowledgebase articles that are documented below and by searching the resolved public forum threads. Priority phone, email and forum support is provided up to 30 days after purchase. Additional priority phone, email and forum support may be obtained if the Priority Support and Upgrade Subscription is active.

 

Back to Top

 ©Copyright 2018 IDAutomation.com, All Rights Reserved. Legal Notices.

 Barcode Fonts | Components | Scanners | Support | Contact Us

Training Videos on YouTube  Join us on Google Plus  Join us on LinkedIn  Follow us on Twitter  Like us on Facebook
Over 70% of Fortune 100 companies use IDAutomation's products to automate their businesses.