| philip.zeyliger | ffa94c6 | 2025-06-19 18:43:37 -0700 | [diff] [blame] | 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="UTF-8" /> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1.0" /> |
| 6 | <title>Sketch Print Test</title> |
| 7 | <style> |
| 8 | body { |
| 9 | font-family: |
| 10 | system-ui, |
| 11 | -apple-system, |
| 12 | sans-serif; |
| 13 | margin: 0; |
| 14 | padding: 20px; |
| 15 | background: #f5f5f5; |
| 16 | } |
| 17 | |
| 18 | .container { |
| 19 | max-width: 800px; |
| 20 | margin: 0 auto; |
| 21 | background: white; |
| 22 | padding: 20px; |
| 23 | border-radius: 8px; |
| 24 | box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
| 25 | } |
| 26 | |
| 27 | .chat-container { |
| 28 | height: 400px; |
| 29 | overflow-y: auto; |
| 30 | border: 1px solid #ddd; |
| 31 | padding: 10px; |
| 32 | margin: 20px 0; |
| 33 | } |
| 34 | |
| 35 | .message { |
| 36 | margin: 10px 0; |
| 37 | padding: 10px; |
| 38 | border-radius: 6px; |
| 39 | } |
| 40 | |
| 41 | .user-message { |
| 42 | background: #e3f2fd; |
| 43 | border-left: 4px solid #2196f3; |
| 44 | } |
| 45 | |
| 46 | .agent-message { |
| 47 | background: #f3e5f5; |
| 48 | border-left: 4px solid #9c27b0; |
| 49 | } |
| 50 | |
| 51 | .print-button { |
| 52 | background: #4caf50; |
| 53 | color: white; |
| 54 | border: none; |
| 55 | padding: 10px 20px; |
| 56 | border-radius: 4px; |
| 57 | cursor: pointer; |
| 58 | font-size: 16px; |
| 59 | } |
| 60 | |
| 61 | .print-button:hover { |
| 62 | background: #45a049; |
| 63 | } |
| 64 | |
| 65 | /* Print styles */ |
| 66 | @media print { |
| 67 | body { |
| 68 | background: white !important; |
| 69 | padding: 0 !important; |
| 70 | } |
| 71 | |
| 72 | .container { |
| 73 | max-width: none !important; |
| 74 | margin: 0 !important; |
| 75 | padding: 0 !important; |
| 76 | box-shadow: none !important; |
| 77 | border-radius: 0 !important; |
| 78 | } |
| 79 | |
| 80 | .chat-container { |
| 81 | height: auto !important; |
| 82 | max-height: none !important; |
| 83 | overflow: visible !important; |
| 84 | border: none !important; |
| 85 | padding: 0 !important; |
| 86 | margin: 0 !important; |
| 87 | } |
| 88 | |
| 89 | .print-button { |
| 90 | display: none !important; |
| 91 | } |
| 92 | |
| 93 | .message { |
| 94 | page-break-inside: avoid; |
| 95 | margin: 8px 0; |
| 96 | } |
| 97 | |
| 98 | h1, |
| 99 | h2, |
| 100 | h3 { |
| 101 | page-break-after: avoid; |
| 102 | } |
| 103 | } |
| 104 | </style> |
| 105 | </head> |
| 106 | <body> |
| 107 | <div class="container"> |
| 108 | <h1>Sketch Print Test</h1> |
| 109 | <p> |
| 110 | This page tests the print functionality for sketch chat. Use Ctrl+P (or |
| 111 | Cmd+P on Mac) to print. |
| 112 | </p> |
| 113 | |
| 114 | <button class="print-button" onclick="window.print()">Print Test</button> |
| 115 | |
| 116 | <div class="chat-container"> |
| 117 | <div class="message user-message"> |
| 118 | <strong>User:</strong> Hello, can you help me with some code? |
| 119 | </div> |
| 120 | |
| 121 | <div class="message agent-message"> |
| 122 | <strong>Agent:</strong> Of course! I'd be happy to help you with your |
| 123 | code. What specific programming language or problem are you working |
| 124 | on? |
| 125 | </div> |
| 126 | |
| 127 | <div class="message user-message"> |
| 128 | <strong>User:</strong> I need to fix a CSS issue with printing. The |
| 129 | content gets cut off when printing. |
| 130 | </div> |
| 131 | |
| 132 | <div class="message agent-message"> |
| 133 | <strong>Agent:</strong> That's a common issue with web applications. |
| 134 | The problem usually occurs when: |
| 135 | <ul> |
| 136 | <li>Container elements have fixed heights</li> |
| 137 | <li>Overflow properties are set to 'auto' or 'hidden'</li> |
| 138 | <li>Flexbox layouts don't expand properly for print</li> |
| 139 | </ul> |
| 140 | |
| 141 | <p>Here's how to fix it:</p> |
| 142 | |
| 143 | <pre><code>@media print { |
| 144 | .container { |
| 145 | height: auto !important; |
| 146 | max-height: none !important; |
| 147 | overflow: visible !important; |
| 148 | } |
| 149 | |
| 150 | .scrollable-content { |
| 151 | height: auto !important; |
| 152 | overflow: visible !important; |
| 153 | } |
| 154 | }</code></pre> |
| 155 | </div> |
| 156 | |
| 157 | <div class="message user-message"> |
| 158 | <strong>User:</strong> That makes sense! Should I also hide |
| 159 | interactive elements during print? |
| 160 | </div> |
| 161 | |
| 162 | <div class="message agent-message"> |
| 163 | <strong>Agent:</strong> Absolutely! Interactive elements like buttons, |
| 164 | form inputs, and navigation menus should typically be hidden during |
| 165 | print since they're not functional on paper. You can do this with: |
| 166 | |
| 167 | <pre><code>@media print { |
| 168 | .button, .interactive-element { |
| 169 | display: none !important; |
| 170 | } |
| 171 | }</code></pre> |
| 172 | |
| 173 | <p>Also consider:</p> |
| 174 | <ul> |
| 175 | <li> |
| 176 | Use <code>page-break-inside: avoid</code> on important content |
| 177 | blocks |
| 178 | </li> |
| 179 | <li> |
| 180 | Remove shadows, borders, and background colors that waste ink |
| 181 | </li> |
| 182 | <li>Ensure text is black on white for better readability</li> |
| 183 | <li>Adjust margins and padding for better paper layout</li> |
| 184 | </ul> |
| 185 | </div> |
| 186 | |
| 187 | <div class="message user-message"> |
| 188 | <strong>User:</strong> Perfect! This should solve my printing issues. |
| 189 | Thank you! |
| 190 | </div> |
| 191 | |
| 192 | <div class="message agent-message"> |
| 193 | <strong>Agent:</strong> You're welcome! The key is to remember that |
| 194 | print styles should make content flow naturally on paper rather than |
| 195 | being constrained by screen dimensions. Always test your print styles |
| 196 | by using your browser's print preview feature. |
| 197 | </div> |
| 198 | </div> |
| 199 | |
| 200 | <p> |
| 201 | <strong>Instructions:</strong> Click the "Print Test" button or use |
| 202 | Ctrl+P to test the print functionality. The chat should print across |
| 203 | multiple pages if needed, with proper page breaks. |
| 204 | </p> |
| 205 | </div> |
| 206 | </body> |
| 207 | </html> |