not really. window.print(), only works with a loaded document. the other option is to download a pdf, but then the browser just displays with a registered pdf tool, print is still a separate option.
Print Report Without Preview
Mohamed Sediq
0
Reputation points
I using visual studio 2022 with MVC NET 8 and C# , JavaScript language and Microsoft reporting service 2016.
I want to print an invoice without displaying the report based on its type,
for example: cash payment or home delivery. Both invoices have different data.
A print button has been created in the invoice, and clicking it selects the type of invoice to print.
To implement the On Click using JavaScript.
Is there a better way than using JavaScript to print the report based on the report type?
<button id="Print" onclick="printReport()" style="float : right" type="button">Print </button>
<script>
function printReport() {
alert('Printing');
var reportUrl = "http://MyName/ReportServer/report/POS/[email protected]&rs:Command=Render&rs:Format=PDF&rs:Toolbar=none&rc:Parameters=Collapsed";
var printWindow = window.open(reportUrl, "_blank");
printWindow.onload = function () {
printWindow.print();
};
}
</script>
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,431 questions