![](/img/trans.png)
[英]ZXing Barcode ImageView not showing generated barcode Xamarin Forms
[英]How to print Generated Barcode ZXING in xamarin forms
我设法使用 ZXING 库生成了一个条码,现在我想打印生成的条码,因为它来自 ZXingBarcodeImageView 具有相同的大小,我该怎么做
private async Task<Item> getItem()
{
HttpResponseMessage _response = await _client.GetAsync(url + txt_Barcode.Text);
if (_response.IsSuccessStatusCode)
{
string itemDetailes = await _response.Content.ReadAsStringAsync();
return JsonConvert.DeserializeObject<Item>(itemDetailes);
}
return new Item();
}
private async void Btn_GetInfo(object sender, EventArgs e)
{
var selected_item = await getItem();
// Item_barcode.Text = selected_item.Value;
Item_Description.Text = selected_item.Description;
Item_name.Text = selected_item.Name;
Item_price.Text = selected_item.Price.ToString();
item_barcode.BarcodeValue = selected_item.Value;
}
xaml 代码
<!--<Image HeightRequest="300" WidthRequest="300" Margin="1" x:Name="img_barcode"></Image>-->
<zxing:ZXingBarcodeImageView x:Name="item_barcode" HeightRequest="20" WidthRequest="100" BarcodeFormat="CODE_39" BarcodeValue="Place Barcode" >
<zxing:ZXingBarcodeImageView.BarcodeOptions>
<zxingcomon:EncodingOptions Height="80" Width="1000"></zxingcomon:EncodingOptions>
</zxing:ZXingBarcodeImageView.BarcodeOptions>
</zxing:ZXingBarcodeImageView>
<StackLayout Orientation="Horizontal" Spacing="20" >
<Label TextColor="Black" x:Name="Item_Description"></Label>
<Label TextColor="Black" x:Name="Item_price"></Label>
</StackLayout>
<StackLayout x:Name="SLPrint" BackgroundColor="GhostWhite" VerticalOptions="FillAndExpand">
<Button Text="print" BackgroundColor="Black" TextColor="White"></Button>
</StackLayout>
</StackLayout>
</StackLayout>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.