removeBlankPages. backend only

This commit is contained in:
Felix Kaspar
2024-05-13 20:46:04 +02:00
parent f587797ddb
commit e72f3d5525
6 changed files with 117 additions and 96 deletions

View File

@@ -3,6 +3,8 @@ import { PDFPageProxy } from "pdfjs-dist/types/src/display/api";
import * as PDFJS from "pdfjs-dist";
import { createCanvas } from "canvas";
export interface PDFJSImage {
width: number;
height: number;
@@ -16,7 +18,9 @@ export async function getImagesOnPage(page: PDFPageProxy): Promise<PDFJSImage[]>
const images: PDFJSImage[] = [];
for (let j=0; j < ops.fnArray.length; j++) {
if (ops.fnArray[j] == PDFJS.OPS.paintImageXObject) {
const image = page.objs.get(ops.argsArray[j][0]) as PDFJSImage;
const image: PDFJSImage = page.objs.get(ops.argsArray[j][0])
console.log("Image: ", image);
images.push(image);
}
}