diff --git a/server-node/src/routes/api/workflow-controller.ts b/server-node/src/routes/api/workflow-controller.ts index 3188b952..169f8431 100644 --- a/server-node/src/routes/api/workflow-controller.ts +++ b/server-node/src/routes/api/workflow-controller.ts @@ -29,7 +29,6 @@ router.post("/:workflowUuid?", [ return new PdfFile(file.originalname.replace(/\.[^/.]+$/, ""), new Uint8Array(await file.buffer), RepresentationType.Uint8Array, file.originalname.replace(/\.[^/.]+$/, "")); })); - // TODO: Enable if traverse & organize migration is done. // Allow option to do it synchronously and just make a long request if(req.body.async === "false") { console.log("Don't do async"); diff --git a/shared-operations/src/functions/common/getImagesOnPage.ts b/shared-operations/src/functions/common/getImagesOnPage.ts index 140fa28a..e036e317 100644 --- a/shared-operations/src/functions/common/getImagesOnPage.ts +++ b/shared-operations/src/functions/common/getImagesOnPage.ts @@ -1,14 +1,22 @@ import { PDFPageProxy } from "pdfjs-dist/types/src/display/api.js"; + import * as PDFJS from 'pdfjs-dist'; -// TODO: Type Return Value -export async function getImagesOnPage(page: PDFPageProxy) { +export type PDFJSImage = { + width: number; + height: number; + interpolate?: any; + kind: number; + data: Uint8Array; +}; + +export async function getImagesOnPage(page: PDFPageProxy): Promise { const ops = await page.getOperatorList(); - const images: any = []; + const images: PDFJSImage[] = []; for (var j=0; j < ops.fnArray.length; j++) { if (ops.fnArray[j] == PDFJS.OPS.paintImageXObject) { - const image = page.objs.get(ops.argsArray[j][0]); + const image = page.objs.get(ops.argsArray[j][0]) as PDFJSImage; images.push(image); } } diff --git a/shared-operations/src/functions/common/pdf-utils.ts b/shared-operations/src/functions/common/sortPdfArray.ts similarity index 97% rename from shared-operations/src/functions/common/pdf-utils.ts rename to shared-operations/src/functions/common/sortPdfArray.ts index 17c7375e..d082bf42 100644 --- a/shared-operations/src/functions/common/pdf-utils.ts +++ b/shared-operations/src/functions/common/sortPdfArray.ts @@ -1,7 +1,7 @@ import { PdfFile } from '../../wrappers/PdfFile'; -export async function sortPdfs( +export async function sortPdfArray( files: PdfFile[], sortType: "orderProvided"|"byFileName"|"byDateModified"|"byDateCreated"|"byPDFTitle" = "orderProvided" ): Promise {