javascript - 将多个PDF文件合并为一个角度8
问题描述
我正在尝试在角度 8 中组合多个 pdf。通过上传按钮选择多个文件时,现在我在文件列表或数组中拥有了选定的 pdf。在将合并的 pdf 文件发送到上传 API 发布方法之前,我想将 pdf 合并为具有某个名称的单个 PDF 文档。
html代码:
<input #fileInput type="file" ngf-select ng-model="new_files" accept=".pdf" multiple
(change)="onFileChange($event)">
<span class="btn btn-primary"><i class="fas fa-upload"></i> Upload PDF(s)
</span>
.ts 代码
public onFileChange(event) {
let files = event.target.files;
if (event.target.files && event.target.files.length) {
const [file] = event.target.files;
const fileListAsArray = Array.from(event.target.files)
console.log(fileListAsArray);
this.fileService.upload(file).subscribe(
(result: any) => {
.loading = false;
this.isSuccess = true;
this.successMessage = 'uploaded successfully !!.';
},
(error) => {
this.loading = false;
console.error(error);
});
}
}
如何将以下结果发送到 ASP.net core post web api 调用,以便我可以在服务器端处理 pdf 合并功能。
文件列表:
(2) [File, File] [0: File {name: "Test.pdf", lastModified: 1606692735736, lastModifiedDate: Mon Nov 30 2020 10:32:15 GMT+1100, webkitRelativePath: "", size: 30420, ... }]
[1: 文件 {name: "test1.pdf", lastModified: 1604532330799, lastModifiedDate: Thu Nov 05 2020 10:25:30 GMT+1100, webkitRelativePath: "", size: 1417916, ...}]
解决方案
推荐阅读
- android - 离子 - 实时部署不适用于 Android <5.0
- javascript - 如何在没有刷新页面的情况下清空文之信引导表中点击事件的搜索框?
- angular - 设置布尔打字稿的默认值
- swift - 斯威夫特:在出现后杀死接收者
- c# - 选择数据库中数据时间为空的 IQueryable 行
- kubernetes - Metric server 无法从他的 Pod 所在的节点获取监控数据
- r - 使用嵌套循环分析上调和下调基因
- excel - 使用 vlookup 或索引/匹配更新 Excel 中的价目表
- linux - 默认用户未添加到 docker 组,必须执行 su $USER 吗?
- c# - 更新期间维护的 C# 应用程序用户设置