【发布时间】:2022-12-07 10:20:25
【问题描述】:
我想将 StackLayout 中的内容转换为 .png 或 .pdf 格式,并且需要从我的 iOS 设备打印相同的内容。我的打印机将只支持图像和 pdf。我怎样才能以 xamarin 形式实现这一目标。请帮助我。这是我的 Xaml。
<StackLayout HorizontalOptions="FillAndExpand" Padding="20" VerticalOptions="CenterAndExpand">
<Frame HasShadow="False" BorderColor="LightGray"
CornerRadius="0" VerticalOptions="Center"
HorizontalOptions="Center">
<StackLayout HorizontalOptions="Center" Spacing="30">
<Label HorizontalTextAlignment="Center">
<Label.FormattedText>
<FormattedString>
<Span Text="ID : " FontAttributes="Bold"
TextColor="Black"/>
<Span Text="1234" TextColor="Green" FontAttributes="Bold"/>
</FormattedString>
</Label.FormattedText>
</Label>
<Frame CornerRadius="1" BorderColor="Green"
HasShadow="False" WidthRequest="40" HorizontalOptions="Center">
<Image Source="ProfileImg" HeightRequest="70"
WidthRequest="50"/>
</Frame>
<Label Text="Xamarin" HorizontalTextAlignment="Center"
FontSize="40" TextColor="Black"
FontAttributes="Bold"/>
<Label HorizontalTextAlignment="Center">
<Label.FormattedText>
<FormattedString>
<Span Text="Phone No : " TextColor="Gray" FontAttributes="Bold"/>
<Span Text="1234567890" TextColor="Green" FontAttributes="Bold"/>
</FormattedString>
</Label.FormattedText>
</Label>
</StackLayout>
</Frame>
</StackLayout>
【问题讨论】:
-
Xamarin Essentials 有截图功能
标签: c# image pdf xamarin.forms xamarin.ios