05.05.2013 Views

Programming PHP

Programming PHP

Programming PHP

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Example 10-5. Changing text attributes (continued)<br />

pdf_set_value($p,"textrendering",1);<br />

pdf_setcolor($p,"stroke","rgb", 0, 0.5, 0);<br />

pdf_continue_text($p, "Green Outlined Text");<br />

pdf_set_value($p,"textrendering",2);<br />

pdf_setcolor($p,"fill","rgb", 0, .2, 0.8);<br />

pdf_setlinewidth($p,2);<br />

pdf_continue_text($p, "Green Outlined Blue Text");<br />

pdf_end_page($p);<br />

pdf_close($p);<br />

$buf = pdf_get_buffer($p);<br />

$len = strlen($buf);<br />

header("Content-Type: application/pdf");<br />

header("Content-Length: $len");<br />

header("Content-Disposition: inline; filename=coord.pdf");<br />

echo $buf;<br />

pdf_delete($p);<br />

?><br />

Figure 10-5 shows the output of Example 10-5.<br />

Figure 10-5. Lining, stroking, filling, and coloring text<br />

Fonts<br />

There are 14 built-in fonts in PDF, as listed in Table 10-3. If you use only these fonts,<br />

the documents you create will be smaller and more portable than if you use nonstandard<br />

fonts.<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2002 O’Reilly & Associates, Inc. All rights reserved.<br />

Text | 243

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!