|
|
@@ -82,10 +82,7 @@ public partial class DocumentViewer : UserControl
|
|
|
|
|
|
public async Task<byte[]?> GetPage()
|
|
|
{
|
|
|
- if(RenderedPage is null)
|
|
|
- {
|
|
|
- RenderedPage = await PlatformTools.PdfRenderer.PdfToImageAsync(PdfData, Page, 300);
|
|
|
- }
|
|
|
+ RenderedPage ??= await PlatformTools.PdfRenderer.PdfToImageAsync(PdfData, Page, 300);
|
|
|
return RenderedPage;
|
|
|
}
|
|
|
}
|
|
|
@@ -108,8 +105,16 @@ public partial class DocumentViewer : UserControl
|
|
|
RightButton.IsVisible = _pages.Length > 1;
|
|
|
LeftButton.IsEnabled = _page > 0;
|
|
|
RightButton.IsEnabled = _page < _pages.Length - 1;
|
|
|
+ if(_pages.Length > 1)
|
|
|
+ {
|
|
|
+ FileNameLabel.Content = $"{FileName} (Page {_page + 1}/{_pages.Length})";
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ FileNameLabel.Content = FileName;
|
|
|
+ }
|
|
|
|
|
|
- var imageSource = ByteArrayToImageSourceConverter.Instance.Convert(await _pages[_page].GetPage());
|
|
|
+ var imageSource = ByteArrayToImageSourceConverter.Instance.Convert(await _pages[_page].GetPage());
|
|
|
if(imageSource is not null)
|
|
|
{
|
|
|
Image.Source = imageSource;
|
|
|
@@ -126,6 +131,7 @@ public partial class DocumentViewer : UserControl
|
|
|
{
|
|
|
LeftButton.IsVisible = false;
|
|
|
RightButton.IsVisible = false;
|
|
|
+ FileNameLabel.Content = FileName;
|
|
|
|
|
|
NoImage.IsVisible = true;
|
|
|
Zoom.IsVisible = false;
|
|
|
@@ -150,6 +156,7 @@ public partial class DocumentViewer : UserControl
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ FileNameLabel.Content = FileName;
|
|
|
NoImage.IsVisible = true;
|
|
|
Zoom.IsVisible = false;
|
|
|
}
|