HTML Rendering with TCPDF(PHP) -
HTML Rendering with TCPDF(PHP) -
i using tcpdf's writehtml function page renders in browser. in output pdf, fonts small. i've tried setfont, doesn't seem have effect. have experience this?
i'd add together here html not in control, prefer tcpdf options(and not modifying source html)
update: able alter font size setting on body. remaining problem that, render correctly in browser, needs 12px. render correctly in pdf, needs 30px. set media on css? media type tcpdf?
are using tags? tcpdf's html engine gives tag precedence on css, or other size-adjusting tags. if remove extraneous tags html , utilize straight css, things should render expected. or, if aren't using css, should. because browser displays correctly doesn't mean same on other formats. browser has performed magic of own fill in gaps in css specifications.
update
here's illustration of specifying css declarations html when using tcpdf. note how styling applied using css declarations within <style>
tag outside actualy html body.
<?php $html = <<<eof <!-- illustration of css style --> <style> h1 { color: navy; font-family: times; font-size: 24pt; text-decoration: underline; } p { color: red; font-family: helvetica; font-size: 12pt; } </style> <body> <h1>example of <i>html + css</i></h1> <p>example of 12pt styled paragraph.</p> </body> eof; $pdf->writehtml($html, true, false, true, false, ''); ?>
php html pdf pdf-generation tcpdf
Comments
Post a Comment