I have a view that I pass to Rotativa (wkhtmltopdf) to get a PDF version of the view for users to print, once they click the "print button":
Here is the rendered view that will be converted to PDF if the user clicks the "print" button
Here is the button code from the view
<div id="print-pdf" align="center">
<a id="print-me" class = "print-btn"
href='@Url.Action("PrintMyView", "Report",
new { id = Model.MonthlyReportID,
clubKeyNo = Model.ClubKeyNumber,
month = Model.ReportMonth,
year = Model.ReportYear }, null)'>Print Report</a>
</div>
Common sense tells me that I need to remove the button before the PDF is generated from the view, so users don't get a PDF with a button on it:
I tried hiding the button (.hide()) and also removing it (.remove()) but the PDF is still rendering with the button:
<script type="text/javascript">
$(document).ready(function () {
$('#print-me').show();
$('#print-pdf').click(function () {
$('#print-me').hide();
});
});
</script>
Anything else that I could try here?
Thanks!