Changed PdfFile.filename to exclude file extensions. Other naming fixes

This commit is contained in:
Saud Fatayerji
2023-11-16 02:24:10 +03:00
parent 667583984f
commit 576b0e02f6
11 changed files with 108 additions and 83 deletions

View File

@@ -12,7 +12,8 @@ export type ImposeParamsBaseType = {
pdfcpuWrapper: any;
}
export async function impose(params: ImposeParamsBaseType): Promise<PdfFile> {
const result = new PdfFile(params.file.originalFilename, await params.pdfcpuWrapper.oneToOne([
const uint8Array = await params.pdfcpuWrapper.oneToOne(
[
"pdfcpu.wasm",
"nup",
"-c",
@@ -21,7 +22,17 @@ export async function impose(params: ImposeParamsBaseType): Promise<PdfFile> {
"/output.pdf",
String(params.nup),
"input.pdf",
], await params.file.uint8Array), RepresentationType.Uint8Array, params.file.filename + "_imposed");
],
await params.file.uint8Array
);
const result = new PdfFile(
params.file.originalFilename,
uint8Array,
RepresentationType.Uint8Array,
params.file.filename + "_imposed"
);
console.log("ImposeResult: ", result);
return result;
}