C# 如何使用Angular指令自动将浏览器打印到pdf

C# 如何使用Angular指令自动将浏览器打印到pdf,c#,asp.net-mvc,html,angularjs,pdf,C#,Asp.net Mvc,Html,Angularjs,Pdf,现在我有一个Angular指令,它允许我以模式打印HTML。它打开了浏览器的打印屏幕,并为我提供了打印位置的选项。我需要将电子邮件PDF选项添加到此模式。我需要将此打印为PDF并将其附加到电子邮件。这个过程会创建一个临时的.pdf文件吗?这是怎么回事?可以用角度指令来完成吗 我的模式,我需要包括一个电子邮件pdf按钮 <div class="modal-body"> <div class="container" id="jobSetupPrin

现在我有一个Angular指令,它允许我以模式打印HTML。它打开了浏览器的打印屏幕,并为我提供了打印位置的选项。我需要将电子邮件PDF选项添加到此模式。我需要将此打印为PDF并将其附加到电子邮件。这个过程会创建一个临时的.pdf文件吗?这是怎么回事?可以用角度指令来完成吗

我的模式,我需要包括一个电子邮件pdf按钮

 <div class="modal-body">
                <div class="container" id="jobSetupPrintPdf">
                    <form ng-submit="submitJob()" enctype="multipart/form-data">
                        <div class="col-xs-12">
                            <h3 style="margin-left:150px">Texas Exterior Systems</h3>
                            <p style="margin-left:225px">Job Setup Sheet</p>
                        </div><!--End col-xs-12-->
                        <div class="col-xs-6" style="margin-top:30px">
                            <div class="inline-fields">
                                <label style="margin-left:78px">Date:&nbsp;</label>
                                <span style="width:150px">{{currentItem.ContractDate | date : date : shortDate}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:55px">Number:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">{{currentItem.JobNumber}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:41px">Job&nbsp;Name:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">{{currentItem.JobName}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:43px">Customer:&nbsp;</label>
                                <span style="width:200px">{{currentItem.CustomerName}}</span><br />
                                <span style="margin-left:120px">{{currentItem.CustomerAddress}}</span><br />
                                <span style="margin-left: 120px" class="underline_text">{{currentItem.CustomerCity}} {{currentItem.CustomerState}} {{currentItem.CustomerZipcode}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:0px">Project&nbsp;Manager:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">{{currentItem.TESPM}}</span>
                            </div>
                        </div><!--End col-xs-6-->
                        <div class="col-xs-6" style="margin-top:30px">
                            <div class="inline-fields">
                                <label style="margin-left:0px">Original&nbsp;Contract:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">$ {{currentItem.OriginalContract | number : fractionSize}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:0px">Original&nbsp;Estimate:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">$ {{currentItem.OriginalEstimate | number : fractionSize}}</span>
                            </div>
                            <div class="inline-fields">
                                <label style="margin-left:49px">Retainage:&nbsp;</label>
                                <span style="width: 150px" class="underline_text">$ {{currentItem.Retainage | number : fractionSize}}</span>
                            </div>
                        <div class="col-xs-12" style="margin-top:300px">
                            <label style="margin-left:0px">Budget</label><br />
                            <textarea ng-model="currentItem.Budget" style="width: 540px; border: 0px none; resize: none;background-color:white " rows="5"></textarea>
                        </div><!--End col-xs-12-->
                        <br />
                        <a href="#" print="jobSetupPrintPdf"><button style="float:right;margin-right:20px;width:70px">Print</button></a>
                        <a href="#"><button style="float:right; margin-right:20px;width:70px" data-dismiss="modal">Cancel</button></a>

                    </form>
                </div>
            </div>

德克萨斯州外部系统
作业设置表

日期: {{currentItem.ContractDate}日期:日期:shortDate} 编号: {{currentItem.JobNumber} 职务名称: {{currentItem.JobName} 客户: {{currentItem.CustomerName}}
{{currentItem.CustomerAddress}}
{{currentItem.CustomerCity}{{currentItem.CustomerState}{{currentItem.CustomerZipcode}} 项目经理: {{currentItem.TESPM} 原始合同: ${{currentItem.OriginalContract |编号:fractionSize} 原始估计数: ${{currentItem.OriginalEstimate | number:fractionSize} 保留: ${{currentItem.Retainage |编号:fractionSize} 预算

角度指令

app.directive('print', ['$compile', function ($compile) {
return {
    restrict: 'AEC',
    link: function (scope, el, attrs) {
        if (attrs.nopopup) {
            el.bind('click', function () {
                window.print();
            });
        } else {
            el.bind('click', function () {
                var html = document.getElementById(attrs.print);
                var links = document.getElementsByTagName('link');
                var stylesheets = "";
                for (var i = 0; i < links.length; i++) {
                    stylesheets = stylesheets + links[i].outerHTML;
                }
                var printarea = window.open('', '', '');
                printarea.document.write('<html><head><title></title>');
                printarea.document.write(stylesheets);
                printarea.document.write('</head><body>');
                printarea.document.write(html.innerHTML);
                printarea.document.write('</body></html>');
                setTimeout(function () {
                    printarea.print();
                    printarea.close();
                }, 100);
            });
        }
    }
};
 }]);
app.directive('print',['$compile',function($compile){
返回{
限制:“AEC”,
链接:功能(范围、el、属性){
if(属性NOPOPP){
el.bind('单击',函数(){
window.print();
});
}否则{
el.bind('单击',函数(){
var html=document.getElementById(attrs.print);
var links=document.getElementsByTagName('link');
var样式表=”;
对于(变量i=0;i
如果我没弄错的话,您希望在客户端站点上从动态生成的HTML创建PDF。 现有的javascript库应可用于:

e、 g