public string Generate(int width, int height, string message) { string targetFilePath = _filePath + "_" + _barcodeType.ToString(); BarcodeImageConfiguration imageConfiguration = new BarcodeImageConfiguration(width, height, targetFilePath, BarcodeImageFormat.Jpeg); QrConfiguration qrConfiguration = new QrConfiguration(ConvertQrMode(_qrModelType), ConvertEccLevel(_eccLevel), _version); BarcodeGenerator.GenerateImage(message, qrConfiguration, imageConfiguration); return(targetFilePath + ".jpg"); }
/// <summary> /// Generates QR code image with Tizen API. /// </summary> /// <param name="textToEncode">String value that will be encoded intro QR code.</param> /// <returns>Path to QR code image.</returns> public string Generate(string textToEncode) { string path = TizenApp.Application.Current.DirectoryInfo.SharedTrusted + "/QRCode"; QrConfiguration qrConfig = new QrConfiguration(QrMode.Utf8, ErrorCorrectionLevel.High, 6); BarcodeGenerationConfiguration barConfig = new BarcodeGenerationConfiguration { TextVisibility = Visibility.Invisible }; BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration (192, 192, path, BarcodeImageFormat.Jpeg); BarcodeGenerator.GenerateImage(textToEncode, qrConfig, imageConfig, barConfig); return(path + ".jpg"); }
//Silly, but native barcode generation not aviable on TV platform :-) public string GenerateQR(string textToEncode) { try { string path = DependencyService.Get <ICurrentDir>().GetShared() + "/QRCode"; QrConfiguration qrConfig = new QrConfiguration(QrMode.Utf8, ErrorCorrectionLevel.High, 6); BarcodeGenerationConfiguration barConfig = new BarcodeGenerationConfiguration { TextVisibility = Visibility.Invisible }; BarcodeImageConfiguration imageConfig = new BarcodeImageConfiguration (400, 400, path, BarcodeImageFormat.Jpeg); BarcodeGenerator.GenerateImage(textToEncode, qrConfig, imageConfig, barConfig); return(path + ".jpg"); } catch (Exception e) { Console.WriteLine(e); throw; } }