mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
Add print functionality and native PDF support (v1.7.7)
- Added Print menu item with Ctrl+P keyboard shortcut for native OS printing - Implemented print IPC handlers in main and renderer processes - Remapped Toggle Preview from Ctrl+P to Ctrl+Shift+P to avoid conflicts - Added PDFKit (v0.14.0) for native PDF generation without Pandoc - Added html2pdf.js (v0.10.1) for HTML to PDF conversion - Enhanced CLAUDE.md with new v1.7.7 feature documentation - Print supports cross-platform printing (Windows, macOS, Linux) Features: - Native print dialog with background color printing - Professional PDF export without system dependencies - Improved portability and offline support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+20
-1
@@ -199,6 +199,12 @@ function createMenu() {
|
||||
click: saveAsFile
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Print',
|
||||
accelerator: 'CmdOrCtrl+P',
|
||||
click: () => mainWindow.webContents.send('print-document')
|
||||
},
|
||||
{ type: 'separator' },
|
||||
{
|
||||
label: 'Recent Files',
|
||||
submenu: buildRecentFilesMenu()
|
||||
@@ -265,7 +271,7 @@ function createMenu() {
|
||||
submenu: [
|
||||
{
|
||||
label: 'Toggle Preview',
|
||||
accelerator: 'CmdOrCtrl+P',
|
||||
accelerator: 'CmdOrCtrl+Shift+P',
|
||||
click: () => mainWindow.webContents.send('toggle-preview')
|
||||
},
|
||||
{
|
||||
@@ -1151,6 +1157,19 @@ ipcMain.on('set-current-file', (event, filePath) => {
|
||||
currentFile = filePath;
|
||||
});
|
||||
|
||||
// Handle print document
|
||||
ipcMain.on('print-document', (event) => {
|
||||
if (mainWindow) {
|
||||
// Open native print dialog
|
||||
mainWindow.webContents.print({
|
||||
silent: false,
|
||||
printBackground: true,
|
||||
color: true,
|
||||
margin: { marginType: 'default' }
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Handle renderer ready for file association
|
||||
ipcMain.on('renderer-ready', (event) => {
|
||||
rendererReady = true;
|
||||
|
||||
Reference in New Issue
Block a user