|
163 | 163 |
|
164 | 164 | ## Future Upgrade Process |
165 | 165 |
|
| 166 | +### Standard PDF.js Upgrade Steps |
| 167 | + |
166 | 168 | 1. **Download new PDF.js version** |
167 | | -2. **Replace all PDF.js files** (viewer.mjs, viewer.html, viewer.css, etc.) |
| 169 | +2. **Replace core PDF.js files**: |
| 170 | + - `viewer.mjs` |
| 171 | + - `viewer.html` ⚠️ **Manual edits required** (see below) |
| 172 | + - `viewer.css` ⚠️ **Manual edits required** (see below) |
| 173 | + - All other PDF.js files (worker, fonts, images, etc.) |
168 | 174 | 3. **Preserve `postmessage-wrapper.js`** (single integration file) |
169 | | -4. **Test functionality** - verify all features work |
170 | | -5. **Update wrapper if needed** (much easier than merging patches) |
| 175 | +4. **Re-apply manual edits** (see sections below) |
| 176 | +5. **Test functionality** - verify all features work |
| 177 | +6. **Update wrapper if needed** (much easier than merging patches) |
| 178 | + |
| 179 | +### Manual Edits Required for Each Upgrade |
| 180 | + |
| 181 | +#### 1. viewer.html - PostMessage Wrapper Integration |
| 182 | +**Location**: After the closing `</div>` tag (around line 740) |
| 183 | +**Purpose**: Include our custom postmessage wrapper for Angular integration |
| 184 | + |
| 185 | +```html |
| 186 | +<!-- Add this script tag after the main viewer content --> |
| 187 | +<script src="postmessage-wrapper.js"></script> |
| 188 | +``` |
| 189 | + |
| 190 | +#### 2. viewer.html - CSP Compliance Fix |
| 191 | +**Location**: Line ~706 (printServiceDialog) |
| 192 | +**Purpose**: Remove inline styles for CSP compliance |
| 193 | + |
| 194 | +**Change from:** |
| 195 | +```html |
| 196 | +<dialog id="printServiceDialog" style="min-width: 200px;"> |
| 197 | +``` |
| 198 | + |
| 199 | +**Change to:** |
| 200 | +```html |
| 201 | +<dialog id="printServiceDialog" class="print-service-dialog"> |
| 202 | +``` |
| 203 | + |
| 204 | +#### 3. viewer.css - Print Service Dialog Styling |
| 205 | +**Location**: After `#printButton::before` styles (around line 5300) |
| 206 | +**Purpose**: Add CSS class for print service dialog |
| 207 | + |
| 208 | +```css |
| 209 | +/* Print service dialog styling */ |
| 210 | +.print-service-dialog { |
| 211 | + min-width: 200px; |
| 212 | +} |
| 213 | +``` |
| 214 | + |
| 215 | +### Upgrade Checklist |
| 216 | + |
| 217 | +- [ ] Download new PDF.js version |
| 218 | +- [ ] Replace `viewer.mjs` and other core files |
| 219 | +- [ ] Replace `viewer.html` and add postmessage wrapper script |
| 220 | +- [ ] Remove inline style from `printServiceDialog` in `viewer.html` |
| 221 | +- [ ] Replace `viewer.css` and add print service dialog class |
| 222 | +- [ ] Verify `postmessage-wrapper.js` is preserved |
| 223 | +- [ ] Test component functionality |
| 224 | +- [ ] Verify CSP compliance (no inline style violations) |
| 225 | +- [ ] Update this documentation if new manual edits are needed |
171 | 226 |
|
172 | | -**Proven Success**: v5.3.93 upgrade required **zero code changes** and worked immediately. |
| 227 | +**Proven Success**: v5.3.93 upgrade required **zero code changes** and worked immediately after applying the manual edits above. |
173 | 228 |
|
174 | 229 | --- |
175 | 230 |
|
|
0 commit comments