54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
using Microsoft.AspNetCore.Components;
|
|
using Microsoft.Extensions.Options;
|
|
using Microsoft.JSInterop;
|
|
using System.Diagnostics.CodeAnalysis;
|
|
using System.Xml.Linq;
|
|
using ZXingBlazor.Components;
|
|
|
|
namespace EgwCoreLib.Razor
|
|
{
|
|
public partial class PdfDisplay
|
|
{
|
|
/// <summary>
|
|
/// URL del documento da mostrare
|
|
/// </summary>
|
|
[Parameter]
|
|
public string PdfUrl { get; set; } = "";
|
|
|
|
/// <summary>
|
|
/// Larghezza desiderata
|
|
/// </summary>
|
|
[Parameter]
|
|
public string Width { get; set; } = "100%";
|
|
/// <summary>
|
|
/// Altezza desiderata
|
|
/// </summary>
|
|
[Parameter]
|
|
public string Height { get; set; } = "80%";
|
|
|
|
/// <summary>
|
|
/// Boolean Mobile vs Desktop
|
|
/// </summary>
|
|
private bool isMobile { get; set; }
|
|
|
|
[Inject]
|
|
[NotNull]
|
|
private IJSRuntime? JS { get; set; }
|
|
|
|
private IJSObjectReference? module;
|
|
|
|
protected override async Task OnAfterRenderAsync(bool firstRender)
|
|
{
|
|
try
|
|
{
|
|
if (!firstRender) return;
|
|
|
|
module = await JS.InvokeAsync<IJSObjectReference>("import", "./_content/EgwCoreLib.Razor/PdfDisplay.razor.js");
|
|
isMobile = await JS.InvokeAsync<bool>("isDevice");
|
|
}
|
|
catch
|
|
{ }
|
|
|
|
}
|
|
}
|
|
} |