split all operators
This commit is contained in:
@@ -13,40 +13,6 @@ import { detectQRCodePages } from "./common/detectQRCodePages";
|
||||
|
||||
|
||||
export class SplitPagesByPreset extends Operator {
|
||||
static type = "splitPagesByPreset";
|
||||
|
||||
/**
|
||||
* Validation & Localisation
|
||||
*/
|
||||
|
||||
protected static inputSchema = JoiPDFFileSchema.label(i18next.t("inputs.pdffile.name")).description(i18next.t("inputs.pdffile.description"));
|
||||
protected static valueSchema = Joi.alternatives().try(
|
||||
Joi.object({
|
||||
type: Joi.string().valid("BAR_CODE").required()
|
||||
}),
|
||||
Joi.object({
|
||||
type: Joi.string().valid("QR_CODE").required()
|
||||
}),
|
||||
Joi.object({
|
||||
type: Joi.string().valid("BLANK_PAGE").required(),
|
||||
whiteThreashold: Joi.number().min(0).max(255).required()
|
||||
}),
|
||||
)
|
||||
.label(i18next.t("values.splitSettings.friendlyName", { ns: "splitPagesByPreset" })).description(i18next.t("values.splitSettings.description", { ns: "splitPagesByPreset" })
|
||||
);
|
||||
protected static outputSchema = JoiPDFFileSchema.label(i18next.t("outputs.pdffile.name")).description(i18next.t("outputs.pdffile.description"));
|
||||
|
||||
static schema = Joi.object({
|
||||
input: SplitPagesByPreset.inputSchema,
|
||||
values: SplitPagesByPreset.valueSchema.required(),
|
||||
output: SplitPagesByPreset.outputSchema
|
||||
}).label(i18next.t("friendlyName", { ns: "splitPagesByPreset" })).description(i18next.t("description", { ns: "splitPagesByPreset" }));
|
||||
|
||||
|
||||
/**
|
||||
* Logic
|
||||
*/
|
||||
|
||||
/** Detect and remove white pages */
|
||||
async run(input: PdfFile[], progressCallback: (state: Progress) => void): Promise<PdfFile[]> {
|
||||
return oneToN<PdfFile, PdfFile>(input, async (input, index, max) => {
|
||||
|
||||
Reference in New Issue
Block a user