mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-24 07:20:16 +05:30
feat(pdf): add extract text, page numbers, crop, extract images operations
Adds four new PDFOperations: pdfExtractText (pdfjs-dist getTextContent), pdfAddPageNumbers (reuses pdfWatermark's position-mapping logic, extracted into a shared resolvePosition helper), pdfCrop (page.setCropBox against the existing MediaBox), and pdfExtractImages (pdfjs-dist operator list + paintImageXObject + sharp). Wired into executeOperation's switch and the PDF editor dialog UI (4 new sections/toolbar buttons/menu items) with no new IPC channel needed. pdfjs-dist v5 is ESM-only, so it's loaded via dynamic import() of its Node-friendly legacy build; Jest needs --experimental-vm-modules to support that, so the test scripts now set NODE_OPTIONS accordingly via cross-env. Amit Haridas
This commit is contained in:
+20
-1
@@ -1432,6 +1432,25 @@ function createMenu() {
|
||||
label: 'Add Watermark...',
|
||||
click: () => showPDFEditorDialog('watermark'),
|
||||
},
|
||||
{
|
||||
label: 'Add Page Numbers...',
|
||||
click: () => showPDFEditorDialog('pageNumbers'),
|
||||
},
|
||||
{
|
||||
label: 'Crop Pages...',
|
||||
click: () => showPDFEditorDialog('crop'),
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
{
|
||||
label: 'Extract Text...',
|
||||
click: () => showPDFEditorDialog('extractText'),
|
||||
},
|
||||
{
|
||||
label: 'Extract Images...',
|
||||
click: () => showPDFEditorDialog('extractImages'),
|
||||
},
|
||||
{
|
||||
type: 'separator',
|
||||
},
|
||||
@@ -1463,7 +1482,7 @@ function createMenu() {
|
||||
title: 'About PDF Editor',
|
||||
message: 'PDF Editor',
|
||||
detail:
|
||||
'Comprehensive PDF editing capabilities powered by pdf-lib.\n\nFeatures:\n• Merge multiple PDF files\n• Split PDF into separate files\n• Compress PDF to reduce file size\n• Rotate pages (90°, 180°, 270°)\n• Delete unwanted pages\n• Reorder pages\n• Add text watermarks\n\nSecurity Features:\n• Password protection (encryption)\n• Remove passwords (decryption)\n• Set document permissions\n\n100% offline and open-source.',
|
||||
'Comprehensive PDF editing capabilities powered by pdf-lib and pdfjs-dist.\n\nFeatures:\n• Merge multiple PDF files\n• Split PDF into separate files\n• Compress PDF to reduce file size\n• Rotate pages (90°, 180°, 270°)\n• Delete unwanted pages\n• Reorder pages\n• Add text watermarks\n• Add page numbers\n• Crop pages\n• Extract text\n• Extract embedded images\n\nSecurity Features:\n• Password protection (encryption)\n• Remove passwords (decryption)\n• Set document permissions\n\n100% offline and open-source.',
|
||||
buttons: ['OK'],
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user