我有一个 Angular 9 应用程序,我想打印报告。
1.我应该使用什么来打印报告,因为当用户单击打印按钮时,记录应该来自数据库?
2. 我不想使用 window.print()
因为它打印屏幕,我不想要这个,但我也想显示预加载器正在加载报告记录时。
作为后端开发,我使用 .Net Core。
任何帮助将不胜感激。
最佳答案
您必须在后端处理它,在您的后端
创建一个可以为您完成工作的方法。您可以根据需要使用数据库
。您可以使用ViewAsPDF
方法。
只需编写所需的代码,使其变得有用
假设您有可以执行数据库
相关操作的服务和方法
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;
}
关于javascript - Angular 9 报告打印,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62618761/