Angular 9 report printing

Viewed 865

I have an Angular 9 application and I want to print reports.

1. What should I use for the report printing as when a user clicks on the print button a record should come from the database?

2. I do not want to use window.print() because it prints the screen and I did not want this, but also I want to show a preloader while a report record is being loaded.

As a back end development I am using .Net Core.

Any help will be very much appreciated.

1 Answers

You have to deal it at back end side , make a method at your backend that would do the job for you . You can make use of database there as per your need. You can make use of ViewAsPDF method.

Just writing desired code , make it useful accordingly

Supposing you have service and method that would do the Database related stuff

public IActionResult RDPReport()
        {
            var model = _reportService.GetRDPReport(); //it would fetch stuff from DB and return those things you want to view in your report

            var report = new ViewAsPdf("RDPReport")
            {
                PageMargins = { Left = 5, Bottom = 5, Right = 5, Top = 5 }, // Do as per need
                Model = model
            };
            return report;
        }
Related