diff --git a/frontend/src/utils/thumbnailUtils.ts b/frontend/src/utils/thumbnailUtils.ts index 8eee201df..a960b5858 100644 --- a/frontend/src/utils/thumbnailUtils.ts +++ b/frontend/src/utils/thumbnailUtils.ts @@ -224,6 +224,25 @@ function drawLargeLockIcon(ctx: CanvasRenderingContext2D, centerX: number, cente ctx.fillRect(keyholeX - 2, keyholeY, 4, 8); } +/** + * Generate standard PDF thumbnail by rendering first page + */ +async function generateStandardPDFThumbnail(pdf: any, scale: number): Promise { + const page = await pdf.getPage(1); + const viewport = page.getViewport({ scale }); + const canvas = document.createElement("canvas"); + canvas.width = viewport.width; + canvas.height = viewport.height; + const context = canvas.getContext("2d"); + + if (!context) { + throw new Error('Could not get canvas context'); + } + + await page.render({ canvasContext: context, viewport }).promise; + return canvas.toDataURL(); +} + /** * Draw extension badge */ @@ -281,98 +300,65 @@ export async function generateThumbnailForFile(file: File): Promise