| 67 | |
| 68 | // Helper: Validate dimensions match presentation layout |
| 69 | function validateDimensions(bodyDimensions, pres) { |
| 70 | const errors = []; |
| 71 | const widthInches = bodyDimensions.width / PX_PER_IN; |
| 72 | const heightInches = bodyDimensions.height / PX_PER_IN; |
| 73 | |
| 74 | if (pres.presLayout) { |
| 75 | const layoutWidth = pres.presLayout.width / EMU_PER_IN; |
| 76 | const layoutHeight = pres.presLayout.height / EMU_PER_IN; |
| 77 | |
| 78 | if (Math.abs(layoutWidth - widthInches) > 0.1 || Math.abs(layoutHeight - heightInches) > 0.1) { |
| 79 | errors.push( |
| 80 | `HTML dimensions (${widthInches.toFixed(1)}" × ${heightInches.toFixed(1)}") ` + |
| 81 | `don't match presentation layout (${layoutWidth.toFixed(1)}" × ${layoutHeight.toFixed(1)}")` |
| 82 | ); |
| 83 | } |
| 84 | } |
| 85 | return errors; |
| 86 | } |
| 87 | |
| 88 | function validateTextBoxPosition(slideData, bodyDimensions) { |
| 89 | const errors = []; |