Delete the status message once the PDF has been successfully created using C# and Rotativa

We have implemented an "export to PDF" feature that generates a detailed report when the button is clicked. The PDF generation process is powered by Rotativa. While the PDF is being generated, we want to display a message (which is easy), and then dismiss it once the PDF is ready (which is proving to be challenging). Unfortunately, there doesn't seem to be any built-in hooks in the ViewAsPdf() method that would allow us to automatically dismiss the message after the PDF has been generated. Has anyone encountered this issue before? What solutions or workarounds did you use?

I am currently trying to figure out how to hide the message after the PDF generation process is complete.

Thank you in advance for any assistance.

The Message Displayed in the View

<!-- This is the message displayed to users after they click the export to PDF button -->
<div id="pdfProcessing" style="display: none; border:1px solid #666666;">
                <img src="@Url.Content("~/Content/images/logo.png")" alt="@Index.PdfProcessing ..." />
                <h2>@Index.PdfProcessing ...</h2>
                <div>@Index.PdfProcessingMessage</div>
</div>

Javascript Function for Handling Button Click

// This function displays the message when the export to PDF button is clicked
<script type="text/javascript">

    $("#export-pdf-btn").click(function () {

        $('#pdfProcessing').show();
    });
</script>

Controller Action for Exporting to PDF

// Controller action handler for exporting to PDF
public ActionResult Pdf(string districtId, int year, int month)
{
    return new ViewAsPdf("Index", EducationReportTasks.BuildViewModel(User, districtId, year, month, true))
    { 
        FileName = districtId + "-" + year + "-" + month + "-report.pdf"
    };
}

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Prevent fixed element from scrolling beyond a specific point

I'm working on a fixed sidebar that needs to scroll along with the main content and stop at a specific point when scrolling down, and vice versa when scrolling up. I've created a script that calculates the window height, current scroll position ...

Implementing a translucent overlay onto a specific HTML section using sidebar.js/jQuery

Searching for a way to enhance the functionality of my website using Sidebar.js, I came across an interesting feature on hypebeast.com. When you click on the three-bar icon, the main container section's opacity changes. How can I achieve this effect? ...

What is the process for identifying the word that appears second most frequently in the text?

Below is the code I am currently using: string userInput = TextBox1.Text; string sourceText = userInput.ToString(); var wordFrequencies = new Dictionary<string, int>(); wordFrequencies.Add("item", 0); string mostFrequentWord = null; var m ...

Exploring Methods for Unit Testing a Basic Form

As I delve into the world of writing unit tests for basic scenarios, I struggle to find resources that cater to such simplicity. Let's say I am working with a web form containing two fields: FirstName LastName On the backend, there exists a class: ...

Modifying a single element within a class with Jquery

Is it possible to create a stack of pages on a website using JQuery? I found this image that shows what I'm trying to achieve: image. Instead of applying ID css for each page, I'd like to use JQuery. While researching similar questions, I came ac ...

Center align the text in a vertical group placed over an image

Here is my html page along with its corresponding css code: <div class="container"> <div class="row mt-4"> <div class="col-sm-8"> <h2>blah blah</h2> <p>blah blah&l ...

What is the reason behind the reflector not displaying that IDictionary<TKey, TValue> actually incorporates IEnumerable<T>?

After delving into the world of Dictionaries, I discovered a peculiar difference: key-value pairs can only be added if the variable is declared as an IDictionary<TKey, TValue>. This led me deeper down the rabbit hole, where I found conflicting inform ...

Is there documentation available for the Google Cloud Storage .Net Client Library?

Currently, I am delving into the realm of Google Cloud Storage with C# .Net4.5. The aim is to efficiently manage a vast number of files that will be uploaded to Google Cloud Storage, where these images will predominantly serve as backup copies. I have man ...

Challenges of converting code from C++ to C# and the confusion between reference and value types

Apologies for the potentially confusing title, feel free to suggest a new one if it fits better. I recently undertook the task of converting a math library from C++ to C#. The actual porting of the code happened fairly quickly within a couple of days. How ...

A full-width div containing a child span is unable to be aligned to the right

After reviewing this fiddle, I'm struggling to get my menu aligned correctly at the right edge of the overall "card". Despite trying various methods like margins, right: 0, and float, nothing seems to work as expected. In some cases, I even end up los ...

Background image of HTML Iframe element does not display - Inline style block

https://i.stack.imgur.com/JW26M.png After setting the iframe's innerHTML using this line of code: iframedoc.body.innerHTML = tinyMCE.activeEditor.getContent(); The styles for the elements within the iframe are contained in an inline style block. Ho ...

Is it necessary for a class containing a Thread member to also implement IDisposable?

Consider a situation where there is a class called Logger that logs strings in a low-priority worker thread, which is not a background thread. The strings are queued in Logger.WriteLine and processed in Logger.Worker. It is important to note that no queued ...

The jquery dialog session will automatically expire upon closing

Within my web application, I utilize jQuery dialogs to display popups. The function responsible for this task is as follows: function OpenPopup(popupTarget, width, height, params, onOpenFunction, onCloseFunction, popupElement){ // code to process paramet ...

What is the easiest method to stop text from wrapping around an icon within a bulleted list?

Imagine having rows filled with various icons, each one being quite large. <li><i class="bi bi-patch-check-fill icon-green" style="font-size:40px;"></I>Some text about whatever</li> <li><i class="b ...

What is the best way to determine if a user is logged in on one tab but not on another tab within the same browser session?

GitHub has recently introduced a new functionality where if you are browsing a page as a guest in one tab and then log in from another tab, the tab where you are still a guest will show a specific message. This feature also functions in incognito or privat ...

Python Selenium error: NoSuchElementException - Unable to find the specified element

Coding Journey: With limited coding knowledge, I've attempted to learn through various resources without much success. Now, I'm taking a different approach by working on a project idea directly. The goal is to create a program that interacts wi ...

Which data structure is suitable for storing a JSON object?

Currently, I have a form set up in the following way: using (Ajax.BeginRouteForm( ... new AjaxOptions { HttpMethod = "POST", OnFailure = "OnFailure", OnSuccess ...

Having trouble uploading an excel file to the database table on the server

My current situation involves importing excel data into a DB table using the code provided below. The process works smoothly on my local machine, but encounters issues when transferred to the server. Strangely, no error messages are displayed, and I receiv ...

Update a variety of CSS properties simultaneously

Is it possible to change multiple CSS attributes of an element with just one line of code? Currently, if I want to alter various CSS attributes of an element, I have to write separate lines of code for each attribute. For instance: $("div#start").cli ...

center text within grandparent element

Within my Angular application, I have a list where each item can be comprised of either a small image with accompanying text or just text alone. li { display: flex; border: 1px solid black; width: 80%; margin-bottom: 5%; list-style: none; po ...