我正在使用 ASPNETZERO 的 Angular 4 + .Net Core。
我有一个显示用户提交表单列表的网格和一个带有打印表单的按钮的列。
这是我的打印功能;我在输入中传递了 ConvertUrl() 方法的 url:
print(item: FormSummaryDto) {
this.beginTask();
let formUrl = AppConsts.appBaseUrl + '/#/app/main/form/' + item.formType.toLowerCase() + '/' + item.id + '/print';
let input = new ExportFormInput({ formId: item.id, formUrl: formUrl, includeAttachments: true });
this.service.exportFormToPdf(input)
.finally(() => { this.endTask(); })
.subscribe((result) => {
if (result == null || result.fileName === '') {
return;
}
this._fileDownloadService.downloadTempFile(result);
}, error => console.log('downloadFile', 'Could not download file.'));
}
在转换和下载文件的过程中一切正常,但是,当我进行转换(如下)时,由于身份验证,url 重定向到登录页面,并且该页面正在被转换。
HtmlToPdf converter = new HtmlToPdf();
PdfDocument doc = converter.ConvertUrl(url);
doc.Save(file);
doc.Close();
我不知道如何将 SelectPdf 的身份验证选项与 ASPNETZERO 一起使用,并希望有人知道我可以传递当前会话/凭据的方法,或者如何使用 SelectPdf 的身份验证选项之一,以便转换传递的 url。
感谢!
工作组