created OperatorConstraints and impelemented it in impose
This commit is contained in:
@@ -1,13 +1,20 @@
|
||||
import { PdfFile, RepresentationType } from "../wrappers/PdfFile";
|
||||
import { FieldConstraint, RecordConstraint } from '../dynamic-ui/OperatorConstraints'
|
||||
|
||||
export type ImposeParamsType = {
|
||||
file: PdfFile;
|
||||
/** Accepted values are 2, 3, 4, 8, 9, 12, 16 - see: {@link https://pdfcpu.io/generate/nup.html#n-up-value} */
|
||||
nup: number;
|
||||
nup: 2 | 3 | 4 | 8 | 9 | 12 | 16;
|
||||
/** A0-A10, other formats available - see: {@link https://pdfcpu.io/paper.html} */
|
||||
format: string;
|
||||
}
|
||||
|
||||
export const ImposeParamConstraints = new RecordConstraint({
|
||||
file: new FieldConstraint("display", "file.pdf", true, "hint"),
|
||||
nup: new FieldConstraint("display", [2, 3, 4, 8, 9, 12, 16], true, "hint"),
|
||||
format: new FieldConstraint("display", "string", true, "hint"),
|
||||
})
|
||||
|
||||
/** PDF-Imposition, PDF-N-Up: Put multiple pages of the input document into a single page of the output document. - see: {@link https://en.wikipedia.org/wiki/N-up} */
|
||||
export async function impose(params: ImposeParamsType, pdfcpuWrapper: any): Promise<PdfFile> {
|
||||
// https://pdfcpu.io/generate/nup.html
|
||||
@@ -34,4 +41,4 @@ export async function impose(params: ImposeParamsType, pdfcpuWrapper: any): Prom
|
||||
|
||||
console.log("ImposeResult: ", result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user