Hi @Cenk ,
The html render code requires a certain response time. JS interop calls will not wait for the html render. You can add a delay to achieve your requirement:
private async void PrintReport()
{
ShowEdit = false;
await Task.Delay(1000);
JSRuntime.InvokeVoidAsync("print");
}
If you also need redisplay the edit button after printing, you need change your code:
private async void PrintReport()
{
ShowEdit = false;
await Task.Delay(1000);
JSRuntime.InvokeVoidAsync("printInvoke");
ShowEdit = true;
InvokeAsync(() => StateHasChanged());
}
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.
Best Regards,
Rena