Skip to content

Commit 163444c

Browse files
committed
Improve HTML/CSS support
1 parent 6c4ed52 commit 163444c

6 files changed

Lines changed: 703 additions & 32 deletions

File tree

examples/E032_html_lists.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@
231231
<h2>6) List text indentation (`text-indent`)</h2>
232232
<ol class="ol-decimal indent-first marker-guide">
233233
<li>First-line indent with long text to make wrapping visible in the list-item rendering path. First-line indent with long text to make wrapping visible in the list-item rendering path.</li>
234-
<li>First-line indent with long text to <span>make</span> wrapping visible in the list-item rendering path. (B) First-line indent with long text to make wrapping visible in the list-item rendering path.</li>
234+
<li><span>First-line</span> indent with long text to <span>make</span> wrapping visible in the list-item rendering path. (B) First-line indent with long text to make wrapping visible in the list-item rendering path.</li>
235235
<li>Second item with first-line indent style applied.</li>
236236
</ol>
237237

examples/E073_css_supported_categories.php

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,129 @@
233233
<tr><td>Search</td><td>188ms</td><td>0.2%</td><td>Healthy</td></tr>
234234
</table>
235235
</div>
236+
237+
<div class="page-break"></div>
238+
<h2>12) Font Shorthand Parsing and Inherit</h2>
239+
<p>This section showcases the newly added support for mapping CSS <code>font</code> shorthand
240+
to longhands and propagating <code>font: inherit</code> to child elements.</p>
241+
<style>
242+
.font-demo-wrap { border: 0.4pt solid #9aa6b2; padding: 6pt; background: #fbfcff; }
243+
.font-explicit {
244+
font: italic 700 14pt/1.5 "Times New Roman", serif;
245+
color: #1f3d5a;
246+
margin-bottom: 5pt;
247+
}
248+
.font-explicit code {
249+
font: normal 400 9pt/1.2 courier;
250+
color: #5b2d00;
251+
}
252+
.font-inherit-parent {
253+
font: oblique 600 12pt/1.4 helvetica;
254+
background: #f0f6fb;
255+
border: 0.4pt solid #9db4c9;
256+
padding: 4pt;
257+
margin-bottom: 5pt;
258+
}
259+
.font-inherit-child {
260+
font: inherit;
261+
border: 0.4pt dashed #aac0d5;
262+
padding: 3pt;
263+
margin-top: 3pt;
264+
}
265+
.font-shorthand-plus-longhand {
266+
font: italic 700 13pt/1.4 "Times New Roman", serif;
267+
font-style: normal;
268+
border: 0.4pt solid #c2c2c2;
269+
padding: 3pt;
270+
}
271+
</style>
272+
273+
<div class="font-demo-wrap">
274+
<div class="font-explicit">
275+
Explicit shorthand: <strong>italic + bold + 14pt + line-height 1.5 + Times family</strong>.
276+
<br /><code>font: italic 700 14pt/1.5 "Times New Roman", serif;</code>
277+
</div>
278+
279+
<div class="font-inherit-parent">
280+
Parent uses shorthand font definition (oblique, semi-bold, 12pt, line-height 1.4).
281+
<div class="font-inherit-child">
282+
Child uses <code>font: inherit</code> and should visually match the parent font settings.
283+
</div>
284+
</div>
285+
286+
<div class="font-shorthand-plus-longhand">
287+
Shorthand + explicit longhand override: italic from shorthand is overridden by
288+
<code>font-style: normal</code>, while weight/size/family from shorthand remain.
289+
</div>
290+
</div>
291+
292+
<div class="page-break"></div>
293+
<h2>13) Form Control CSS to Widget Mapping</h2>
294+
<p>This section demonstrates static style mapping from CSS to AcroForm widgets:
295+
background color, border color/width/style, and text alignment.</p>
296+
<style>
297+
.form-grid { border: 0.4pt solid #b0bac6; background: #f8fafc; padding: 6pt; }
298+
.form-row { margin-bottom: 5pt; }
299+
.form-label { display: inline-block; width: 95pt; font-weight: bold; color: #34495e; }
300+
.ctl-text {
301+
width: 180pt;
302+
border: 0.8pt dashed #3a6ea5;
303+
background: #eaf3ff;
304+
color: #123d66;
305+
text-align: center;
306+
}
307+
.ctl-number {
308+
width: 120pt;
309+
border: 0.8pt solid #6a8f44;
310+
background: #f2faea;
311+
color: #2e4f1d;
312+
}
313+
.ctl-select {
314+
width: 180pt;
315+
border: 0.8pt solid #8e44ad;
316+
background: #f6ebfb;
317+
color: #4c1f61;
318+
}
319+
.ctl-textarea {
320+
width: 180pt;
321+
border: 0.8pt solid #c57b1d;
322+
background: #fff7e8;
323+
color: #6f3d00;
324+
}
325+
.ctl-button {
326+
width: 95pt;
327+
border: 0.8pt solid #7f8c8d;
328+
background: #eef1f2;
329+
color: #2f3a3b;
330+
}
331+
</style>
332+
333+
<div class="form-grid">
334+
<div class="form-row">
335+
<span class="form-label">Styled text input</span>
336+
<input class="ctl-text" type="text" name="demo_text" value="Centered text" />
337+
</div>
338+
<div class="form-row">
339+
<span class="form-label">Styled number input</span>
340+
<input class="ctl-number" type="number" name="demo_num" value="12345" />
341+
</div>
342+
<div class="form-row">
343+
<span class="form-label">Styled select</span>
344+
<select class="ctl-select" name="demo_plan">
345+
<option value="starter">Starter</option>
346+
<option value="pro" selected="selected">Professional</option>
347+
<option value="ent">Enterprise</option>
348+
</select>
349+
</div>
350+
<div class="form-row">
351+
<span class="form-label">Styled textarea</span>
352+
<textarea class="ctl-textarea" name="demo_notes" rows="3" cols="26">Multiline notes example</textarea>
353+
</div>
354+
<div class="form-row">
355+
<span class="form-label">Styled button</span>
356+
<input class="ctl-button" type="button" name="demo_btn" value="Action" />
357+
</div>
358+
</div>
236359
HTML;
237360

238361
$pdf->addHTMLCell($html, 15, 18, 180, 0);

0 commit comments

Comments
 (0)