在winform中reprot 無預覽 可以直接report.print直接就打印了.而web端 使用前端打印 ,后端盡管也可以打印,只是那一般是在服務上了.于是乎實現無預覽打印的機制就不一樣了.
How to: Print a Report Without Displaying a Preview
https://docs.devexpress.com/eXpressAppFramework/113601/shape-export-print-data/reports/task-based-help/how-to-print-a-report-without-displaying-a-preview
例子頁面
https://supportcenter.devexpress.com/ticket/details/t227361/reporting-for-asp-net-webforms-how-to-print-or-export-a-report-without-showing-a-preview
reporting-asp-net-core-print-without-preview
https://github.com/DevExpress-Examples/reporting-asp-net-core-print-without-preview
原理:
To print the report, export it to the PDF format. Then write the PDF stream to the page's Response with the Content-Disposition header set to the "inline" value.
The browser's built-in PDF viewer opens the PDF file. An alternative method exports the PDF to a separate iframe. In this case, only the print dialog is displayed.
大概意思是在服務器上編譯成pdf流 返回到前端 ,前端會根據返回顯示打印dialog.
技術交流qq群:143280841
浙公網安備 33010602011771號