|
1 | | -# PDF Converter Desktop App |
| 1 | +# Convert2Doc Desktop App |
2 | 2 |
|
3 | | -A cross-platform desktop application that wraps the PDF Converter PWA in an Electron shell. This app provides a native desktop experience for Windows, macOS, and Linux users. |
| 3 | +This is the desktop application for Convert2Doc, which wraps the web application in an Electron shell. |
4 | 4 |
|
5 | | -## Features |
6 | | - |
7 | | -- Loads the PWA from the URL specified in the project's root .env file |
8 | | -- Native desktop integration |
9 | | -- Cross-platform support (Windows, macOS, Linux) |
10 | | -- Custom application menu |
11 | | -- External link handling |
12 | | -- Offline capabilities (when the PWA supports it) |
13 | | - |
14 | | -## Development Requirements |
| 5 | +## Development Setup |
15 | 6 |
|
16 | | -- Node.js 16.x or later |
17 | | -- npm or yarn |
18 | | -- dotenv (for .env file parsing) |
| 7 | +### Prerequisites |
19 | 8 |
|
20 | | -## Getting Started |
| 9 | +- Node.js (v14 or later) |
| 10 | +- npm or pnpm |
21 | 11 |
|
22 | | -1. Install dependencies: |
23 | | - ``` |
24 | | - cd desktop |
25 | | - npm install |
26 | | - ``` |
27 | | - |
28 | | -2. Run the app in development mode: |
29 | | - ``` |
30 | | - npm start |
31 | | - ``` |
| 12 | +### Running the App |
32 | 13 |
|
33 | | -## Building for Production |
| 14 | +#### Using the provided scripts |
34 | 15 |
|
35 | | -### All Platforms |
| 16 | +The easiest way to run the app is to use one of the provided scripts: |
36 | 17 |
|
37 | | -To build for all platforms (that your current OS supports): |
| 18 | +```bash |
| 19 | +# Using npm |
| 20 | +./run.sh |
38 | 21 |
|
| 22 | +# Using pnpm |
| 23 | +./run-pnpm.sh |
39 | 24 | ``` |
40 | | -npm run build |
41 | | -``` |
42 | | - |
43 | | -### Platform-Specific Builds |
44 | | - |
45 | | -#### Windows |
46 | | - |
47 | | -``` |
48 | | -npm run build:win |
49 | | -``` |
50 | | - |
51 | | -This will generate: |
52 | | -- NSIS installer (.exe) |
53 | | -- Portable executable (.exe) |
54 | 25 |
|
55 | | -#### macOS |
| 26 | +These scripts will automatically install dependencies if needed and start the app. |
56 | 27 |
|
57 | | -``` |
58 | | -npm run build:mac |
59 | | -``` |
| 28 | +#### Manual setup |
60 | 29 |
|
61 | | -This will generate: |
62 | | -- DMG installer (.dmg) |
63 | | -- ZIP archive (.zip) |
64 | | - |
65 | | -#### Linux |
66 | | - |
67 | | -``` |
68 | | -npm run build:linux |
69 | | -``` |
| 30 | +1. Install dependencies: |
| 31 | + ```bash |
| 32 | + # Using npm |
| 33 | + npm install |
| 34 | + |
| 35 | + # Using pnpm |
| 36 | + pnpm install |
| 37 | + ``` |
70 | 38 |
|
71 | | -This will generate: |
72 | | -- AppImage (.AppImage) |
73 | | -- Debian package (.deb) |
74 | | -- RPM package (.rpm) |
| 39 | +2. Start the app: |
| 40 | + ```bash |
| 41 | + # Using npm |
| 42 | + npm start |
| 43 | + |
| 44 | + # Using pnpm |
| 45 | + pnpm start |
| 46 | + ``` |
75 | 47 |
|
76 | 48 | ## Configuration |
77 | 49 |
|
78 | | -The app reads the PWA URL from the `API_BASE_URL` variable in the project's root `.env` file. This allows you to easily switch between different environments (development, staging, production) by modifying a single configuration file. |
79 | | - |
80 | | -### .env Configuration |
| 50 | +The app will connect to the Convert2Doc web application. The URL is determined in the following order: |
81 | 51 |
|
82 | | -In the project root's `.env` file: |
| 52 | +1. From the `API_BASE_URL` environment variable |
| 53 | +2. From the `API_BASE_URL` in the `.env` file in the project root |
| 54 | +3. Fallback to the hardcoded URL: `https://convert2doc.com` |
83 | 55 |
|
84 | | -``` |
85 | | -API_BASE_URL=https://profullstack.com/pdf |
86 | | -``` |
87 | | - |
88 | | -### How It Works |
89 | | - |
90 | | -The `config.js` file reads the API_BASE_URL from the .env file: |
91 | | - |
92 | | -```javascript |
93 | | -// In src/config.js |
94 | | -function getApiBaseUrl() { |
95 | | - try { |
96 | | - // Try to find the .env file in the project root |
97 | | - const rootPath = path.resolve(__dirname, '../../'); |
98 | | - const envPath = path.join(rootPath, '.env'); |
99 | | - |
100 | | - if (fs.existsSync(envPath)) { |
101 | | - // Parse .env file |
102 | | - const envConfig = dotenv.parse(fs.readFileSync(envPath)); |
103 | | - |
104 | | - // Return API_BASE_URL if found |
105 | | - if (envConfig.API_BASE_URL) { |
106 | | - return envConfig.API_BASE_URL; |
107 | | - } |
108 | | - } |
109 | | - |
110 | | - // Check environment variables as fallback |
111 | | - // ... |
112 | | - |
113 | | - // Return default URL if not found |
114 | | - return DEFAULT_API_BASE_URL; |
115 | | - } catch (error) { |
116 | | - // Handle errors |
117 | | - } |
118 | | -} |
119 | | -``` |
120 | | - |
121 | | -And the main.js uses this configuration: |
122 | | - |
123 | | -```javascript |
124 | | -// In src/main.js |
125 | | -const { getApiBaseUrl } = require('./config'); |
| 56 | +## Features |
126 | 57 |
|
127 | | -// URL of the PWA - loaded from .env file |
128 | | -const pwaUrl = getApiBaseUrl(); |
129 | | -``` |
| 58 | +- Access Convert2Doc functionality in a desktop environment |
| 59 | +- Native menu with reload, developer tools, and zoom options |
| 60 | +- External links open in the default browser |
130 | 61 |
|
131 | | -### Application Icons |
| 62 | +## Keyboard Shortcuts |
132 | 63 |
|
133 | | -Replace the placeholder icon files in the `assets` directory with your own icons: |
134 | | -- `icon.png` (512x512 PNG for Linux) |
135 | | -- `icon.ico` (Windows icon) |
136 | | -- `icon.icns` (macOS icon) |
| 64 | +- Reload: `Ctrl+R` (Windows/Linux) or `Cmd+R` (macOS) |
| 65 | +- Developer Tools: `Ctrl+Shift+I` (Windows/Linux) or `Cmd+Alt+I` (macOS) |
| 66 | +- Zoom In: `Ctrl++` (Windows/Linux) or `Cmd++` (macOS) |
| 67 | +- Zoom Out: `Ctrl+-` (Windows/Linux) or `Cmd+-` (macOS) |
| 68 | +- Reset Zoom: `Ctrl+0` (Windows/Linux) or `Cmd+0` (macOS) |
| 69 | +- Fullscreen: `F11` (Windows/Linux) or `Ctrl+Cmd+F` (macOS) |
137 | 70 |
|
138 | | -## Project Structure |
| 71 | +## Building |
139 | 72 |
|
140 | | -- `src/main.js`: Main process script |
141 | | -- `src/config.js`: Configuration module that reads from the .env file |
142 | | -- `src/preload.js`: Preload script for secure renderer process |
143 | | -- `assets/`: Application icons and resources |
144 | | -- `package.json`: Project configuration and dependencies |
| 73 | +Building the app is currently experiencing issues. We recommend running the app in development mode using the provided scripts. |
145 | 74 |
|
146 | | -## Packaging and Distribution |
| 75 | +If you want to attempt building, you can try: |
147 | 76 |
|
148 | | -The app is configured to be packaged using electron-builder. The configuration in `package.json` specifies the build targets for each platform. |
| 77 | +```bash |
| 78 | +# Using npm |
| 79 | +npm run build |
149 | 80 |
|
150 | | -## License |
| 81 | +# Using pnpm |
| 82 | +pnpm build |
| 83 | +``` |
151 | 84 |
|
152 | | -MIT |
| 85 | +Note that building may hang or fail due to missing icon files or other configuration issues. |
0 commit comments